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
parent 8e481f65f5
commit 1ce1a8f8f1

View File

@ -1523,18 +1523,16 @@ 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;
}