LibWeb: Reset and update animated style in a single pass

...and skip resetting animated style of finished animations.
This commit is contained in:
Aliaksandr Kalenik 2025-03-03 20:25:06 +01:00 committed by Alexander Kalenik
commit 1ce1a8f8f1
Notes: github-actions[bot] 2025-03-03 20:46:28 +00:00

View file

@ -1523,16 +1523,14 @@ void Document::update_animated_style_if_needed()
invalidate_display_list();
for (auto& timeline : m_associated_animation_timelines) {
for (auto& animation : timeline->associated_animations()) {
if (auto effect = animation->effect(); effect && effect->target())
effect->target()->reset_animated_css_properties();
}
for (auto& animation : timeline->associated_animations()) {
if (animation->is_finished())
continue;
if (auto effect = animation->effect())
if (auto effect = animation->effect()) {
if (auto* target = effect->target())
target->reset_animated_css_properties();
effect->update_computed_properties();
}
}
}
m_needs_animated_style_update = false;