diff --git a/Tests/LibWeb/Text/expected/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.txt b/Tests/LibWeb/Text/expected/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.txt new file mode 100644 index 00000000000..5d24743029f --- /dev/null +++ b/Tests/LibWeb/Text/expected/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.txt @@ -0,0 +1 @@ +This is a animated div animation count: 1 diff --git a/Tests/LibWeb/Text/input/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.html b/Tests/LibWeb/Text/input/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.html new file mode 100644 index 00000000000..4eb6398404b --- /dev/null +++ b/Tests/LibWeb/Text/input/WebAnimations/misc/get-animations-should-make-sure-style-is-updated.html @@ -0,0 +1,26 @@ + + + +
This is a animated div
+ diff --git a/Userland/Libraries/LibWeb/Animations/Animatable.cpp b/Userland/Libraries/LibWeb/Animations/Animatable.cpp index 9ab44faa9d4..c495a2205e0 100644 --- a/Userland/Libraries/LibWeb/Animations/Animatable.cpp +++ b/Userland/Libraries/LibWeb/Animations/Animatable.cpp @@ -60,6 +60,12 @@ WebIDL::ExceptionOr> Animatable::animate(Optional> Animatable::get_animations(GetAnimationsOptions options) +{ + verify_cast(*this).document().update_style(); + return get_animations_internal(options); +} + +Vector> Animatable::get_animations_internal(GetAnimationsOptions options) { // Returns the set of relevant animations for this object, or, if an options parameter is passed with subtree set to // true, returns the set of relevant animations for a subtree for this object. diff --git a/Userland/Libraries/LibWeb/Animations/Animatable.h b/Userland/Libraries/LibWeb/Animations/Animatable.h index cbd419d645e..a7ff426a57c 100644 --- a/Userland/Libraries/LibWeb/Animations/Animatable.h +++ b/Userland/Libraries/LibWeb/Animations/Animatable.h @@ -41,6 +41,7 @@ public: WebIDL::ExceptionOr> animate(Optional> keyframes, Variant options = {}); Vector> get_animations(GetAnimationsOptions options = {}); + Vector> get_animations_internal(GetAnimationsOptions options = {}); void associate_with_animation(JS::NonnullGCPtr); void disassociate_with_animation(JS::NonnullGCPtr); diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 6c886e5b851..17dc234ed34 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -1563,7 +1563,7 @@ void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element } } - auto animations = element.get_animations({ .subtree = false }); + auto animations = element.get_animations_internal({ .subtree = false }); for (auto& animation : animations) { if (auto effect = animation->effect(); effect && effect->is_keyframe_effect()) { auto& keyframe_effect = *static_cast(effect.ptr());