From 81596b41457d250bac28db37c1390fa46e6532de Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 1 Oct 2024 14:35:24 +0100 Subject: [PATCH] LibWeb/CSS: Stop invalidating style when setting an animation's effect This reverts 6d25bf3aac3a10bd741f4193e790ab7886462b93 Invalidating the style here means that transitions can cause an element to leave style computation with its "needs style update" flag set to true. This then causes a VERIFY to fail in the TreeBuilder. This invalidation does not otherwise seem to have any effect. The original commit suggests this was to fix a bug, but it's not clear what bug that was. If it reappears, we can try to solve the issue in a different way. --- .../transition-style-invalidation-crash.txt | 1 + .../transition-style-invalidation-crash.html | 18 ++++++++++++++++++ .../LibWeb/Animations/AnimationEffect.cpp | 3 --- Userland/Libraries/LibWeb/DOM/Node.h | 1 - 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/css/transition-style-invalidation-crash.txt create mode 100644 Tests/LibWeb/Text/input/css/transition-style-invalidation-crash.html diff --git a/Tests/LibWeb/Text/expected/css/transition-style-invalidation-crash.txt b/Tests/LibWeb/Text/expected/css/transition-style-invalidation-crash.txt new file mode 100644 index 00000000000..aaecaf93c4a --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/transition-style-invalidation-crash.txt @@ -0,0 +1 @@ +PASS (didn't crash) diff --git a/Tests/LibWeb/Text/input/css/transition-style-invalidation-crash.html b/Tests/LibWeb/Text/input/css/transition-style-invalidation-crash.html new file mode 100644 index 00000000000..ee33abe95d1 --- /dev/null +++ b/Tests/LibWeb/Text/input/css/transition-style-invalidation-crash.html @@ -0,0 +1,18 @@ + + + + + + diff --git a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp index 1a34aff4f86..6dfe4652678 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace Web::Animations { @@ -205,8 +204,6 @@ WebIDL::ExceptionOr AnimationEffect::update_timing(OptionalEffectTiming ti void AnimationEffect::set_associated_animation(JS::GCPtr value) { m_associated_animation = value; - if (auto* target = this->target()) - target->invalidate_style(DOM::StyleInvalidationReason::AnimationEffectSetAssociatedAnimation); } // https://www.w3.org/TR/web-animations-1/#animation-direction diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 3e8fc7b1f56..615b5c08d5d 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -54,7 +54,6 @@ enum class FragmentSerializationMode { #define ENUMERATE_STYLE_INVALIDATION_REASONS(X) \ X(AdoptedStyleSheetsList) \ - X(AnimationEffectSetAssociatedAnimation) \ X(CSSFontLoaded) \ X(CSSImportRule) \ X(DidLoseFocus) \