Skip to content

Commit

Permalink
LibWeb/CSS: Stop invalidating style when setting an animation's effect
Browse files Browse the repository at this point in the history
This reverts 6d25bf3

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.
  • Loading branch information
AtkinsSJ authored and trflynn89 committed Oct 15, 2024
1 parent 63d9ed9 commit 81596b4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
.foo {
opacity: 0;
transition: opacity 200ms;
}
</style>
<ul>
<li class="foo"></li>
<li></li>
</ul>
<video src=""></video>
<script>
test(() => {
println("PASS (didn't crash)");
});
</script>
3 changes: 0 additions & 3 deletions Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <LibWeb/Bindings/AnimationEffectPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/WebIDL/ExceptionOr.h>

namespace Web::Animations {
Expand Down Expand Up @@ -205,8 +204,6 @@ WebIDL::ExceptionOr<void> AnimationEffect::update_timing(OptionalEffectTiming ti
void AnimationEffect::set_associated_animation(JS::GCPtr<Animation> 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
Expand Down
1 change: 0 additions & 1 deletion Userland/Libraries/LibWeb/DOM/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ enum class FragmentSerializationMode {

#define ENUMERATE_STYLE_INVALIDATION_REASONS(X) \
X(AdoptedStyleSheetsList) \
X(AnimationEffectSetAssociatedAnimation) \
X(CSSFontLoaded) \
X(CSSImportRule) \
X(DidLoseFocus) \
Expand Down

0 comments on commit 81596b4

Please sign in to comment.