diff --git a/Libraries/LibWeb/Animations/Animation.h b/Libraries/LibWeb/Animations/Animation.h index 57e5ad704da..277e888bfc5 100644 --- a/Libraries/LibWeb/Animations/Animation.h +++ b/Libraries/LibWeb/Animations/Animation.h @@ -66,6 +66,8 @@ public: GC::Ref finished() const { return current_finished_promise(); } bool is_finished() const { return m_is_finished; } + bool is_idle() const { return play_state() == Bindings::AnimationPlayState::Idle; } + GC::Ptr onfinish(); void set_onfinish(GC::Ptr); GC::Ptr oncancel(); diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 01c881a3ad1..1a389704285 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -1522,7 +1522,7 @@ void Document::update_animated_style_if_needed() for (auto& timeline : m_associated_animation_timelines) { for (auto& animation : timeline->associated_animations()) { - if (animation->is_finished()) + if (animation->is_idle() || animation->is_finished()) continue; if (auto effect = animation->effect()) { if (auto* target = effect->target())