LibWeb: Add slots for pseudo-elements animation cache in Animatable

Fixes the bug when animation does not run at all if an element has a
pseudo-element, because both of them use the same cache.
This commit is contained in:
Aliaksandr Kalenik
2024-08-01 15:43:44 +03:00
committed by Andreas Kling
parent 6a19cffdde
commit 4049cce40c
Notes: github-actions[bot] 2024-08-02 06:06:26 +00:00
3 changed files with 51 additions and 16 deletions

View File

@@ -33,11 +33,11 @@ public:
void associate_with_animation(JS::NonnullGCPtr<Animation>);
void disassociate_with_animation(JS::NonnullGCPtr<Animation>);
JS::GCPtr<CSS::CSSStyleDeclaration const> cached_animation_name_source() const { return m_cached_animation_name_source; }
void set_cached_animation_name_source(JS::GCPtr<CSS::CSSStyleDeclaration const> value) { m_cached_animation_name_source = value; }
JS::GCPtr<CSS::CSSStyleDeclaration const> cached_animation_name_source(Optional<CSS::Selector::PseudoElement::Type>) const;
void set_cached_animation_name_source(JS::GCPtr<CSS::CSSStyleDeclaration const> value, Optional<CSS::Selector::PseudoElement::Type>);
JS::GCPtr<Animations::Animation> cached_animation_name_animation() const { return m_cached_animation_name_animation; }
void set_cached_animation_name_animation(JS::GCPtr<Animations::Animation> value) { m_cached_animation_name_animation = value; }
JS::GCPtr<Animations::Animation> cached_animation_name_animation(Optional<CSS::Selector::PseudoElement::Type>) const;
void set_cached_animation_name_animation(JS::GCPtr<Animations::Animation> value, Optional<CSS::Selector::PseudoElement::Type>);
protected:
void visit_edges(JS::Cell::Visitor&);
@@ -45,8 +45,9 @@ protected:
private:
Vector<JS::NonnullGCPtr<Animation>> m_associated_animations;
bool m_is_sorted_by_composite_order { true };
JS::GCPtr<CSS::CSSStyleDeclaration const> m_cached_animation_name_source;
JS::GCPtr<Animations::Animation> m_cached_animation_name_animation;
Array<JS::GCPtr<CSS::CSSStyleDeclaration const>, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount) + 1> m_cached_animation_name_source;
Array<JS::GCPtr<Animations::Animation>, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount) + 1> m_cached_animation_name_animation;
};
}