From 3721a1a81c6c67d9f2d5e9a378f9a8ef022a17dd Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Sat, 10 Feb 2024 20:54:42 -0700 Subject: [PATCH] LibWeb: Run update_finished_state when setting AnimationEffect's timing This will need to a necessary style invalidation --- Userland/Libraries/LibWeb/Animations/Animation.cpp | 5 +++++ Userland/Libraries/LibWeb/Animations/Animation.h | 2 ++ Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/Userland/Libraries/LibWeb/Animations/Animation.cpp b/Userland/Libraries/LibWeb/Animations/Animation.cpp index ebad82036e..625f038e8f 100644 --- a/Userland/Libraries/LibWeb/Animations/Animation.cpp +++ b/Userland/Libraries/LibWeb/Animations/Animation.cpp @@ -509,6 +509,11 @@ void Animation::notify_timeline_time_did_change() } } +void Animation::effect_timing_changed(Badge) +{ + update_finished_state(DidSeek::No, SynchronouslyNotify::Yes); +} + // https://www.w3.org/TR/web-animations-1/#associated-effect-end double Animation::associated_effect_end() const { diff --git a/Userland/Libraries/LibWeb/Animations/Animation.h b/Userland/Libraries/LibWeb/Animations/Animation.h index 1b07584ec9..11ab6ee575 100644 --- a/Userland/Libraries/LibWeb/Animations/Animation.h +++ b/Userland/Libraries/LibWeb/Animations/Animation.h @@ -65,6 +65,8 @@ public: JS::GCPtr document_for_timing() const; void notify_timeline_time_did_change(); + void effect_timing_changed(Badge); + protected: Animation(JS::Realm&); diff --git a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp index 49cbcdfac7..74f4bdf3f7 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp @@ -151,6 +151,9 @@ WebIDL::ExceptionOr AnimationEffect::update_timing(OptionalEffectTiming ti if (timing.easing.has_value()) m_easing_function = timing.easing.value(); + if (auto animation = m_associated_animation) + animation->effect_timing_changed({}); + return {}; }