From 6d25bf3aac3a10bd741f4193e790ab7886462b93 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Sat, 10 Feb 2024 21:11:51 -0700 Subject: [PATCH] LibWeb: Invalidate element when setting AnimationEffect's animation --- Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp | 8 ++++++++ Userland/Libraries/LibWeb/Animations/AnimationEffect.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp index a202d2c08c..49cbcdfac7 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include namespace Web::Animations { @@ -153,6 +154,13 @@ WebIDL::ExceptionOr AnimationEffect::update_timing(OptionalEffectTiming ti return {}; } +void AnimationEffect::set_associated_animation(JS::GCPtr value) +{ + m_associated_animation = value; + if (auto* target = this->target()) + target->invalidate_style(); +} + // https://www.w3.org/TR/web-animations-1/#animation-direction AnimationDirection AnimationEffect::animation_direction() const { diff --git a/Userland/Libraries/LibWeb/Animations/AnimationEffect.h b/Userland/Libraries/LibWeb/Animations/AnimationEffect.h index c0931ae45a..a7abf938a2 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationEffect.h +++ b/Userland/Libraries/LibWeb/Animations/AnimationEffect.h @@ -95,7 +95,7 @@ public: void set_timing_function(TimingFunction value) { m_timing_function = move(value); } JS::GCPtr associated_animation() const { return m_associated_animation; } - void set_associated_animation(JS::GCPtr value) { m_associated_animation = value; } + void set_associated_animation(JS::GCPtr value); AnimationDirection animation_direction() const;