1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

LibWeb: Do not invalidate elements with animations in the CSS cascade

See the note added to Animation::cancel for more info
This commit is contained in:
Matthew Olsson 2024-03-02 08:54:37 -07:00 committed by Andreas Kling
parent b9d2d1b478
commit c1ab6ca6b4
3 changed files with 16 additions and 5 deletions

View file

@ -1395,7 +1395,7 @@ ErrorOr<void> StyleComputer::compute_cascaded_values(StyleProperties& style, DOM
if (source_declaration != element.cached_animation_name_source()) {
// This animation name is new, so we need to create a new animation for it.
if (auto existing_animation = element.cached_animation_name_animation())
existing_animation->cancel();
existing_animation->cancel(Animations::Animation::ShouldInvalidate::No);
element.set_cached_animation_name_source(source_declaration);
auto effect = Animations::KeyframeEffect::create(realm);
@ -1422,7 +1422,7 @@ ErrorOr<void> StyleComputer::compute_cascaded_values(StyleProperties& style, DOM
} else {
// If the element had an existing animation, cancel it
if (auto existing_animation = element.cached_animation_name_animation()) {
existing_animation->cancel();
existing_animation->cancel(Animations::Animation::ShouldInvalidate::No);
element.set_cached_animation_name_animation({});
element.set_cached_animation_name_source({});
}