Skip to content
Permalink
Browse files
[css-transitions] setting transition-property to "none" does not disa…
…ssociate CSS Transition from owning element

https://bugs.webkit.org/show_bug.cgi?id=247884

Reviewed by Antti Koivisto.

We would fail a subtest in web-animations/timing-model/timelines/update-and-send-events-replacement.html where a CSS Transition
was canceled by setting the transition-property CSS property to "none". We would correctly cancel the transition in this situation,
but we would fail to disassociate it from its owning element, the element that was the transition's target when it was created.

That association is critical when determining whether an animation, including transitions, can be replaced, per
https://drafts.csswg.org/web-animations/#removing-replaced-animations.

We now correctly call DeclarativeAnimation::cancelFromStyle() instead of WebAnimation::cancel() when an element's style moves
from having a transition defined for a given property to no longer having one in the new style.

* LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/timelines/update-and-send-events-replacement-expected.txt:
* Source/WebCore/style/Styleable.cpp:
(WebCore::updateCSSTransitionsForStyleableAndProperty):

Canonical link: https://commits.webkit.org/256666@main
  • Loading branch information
graouts committed Nov 14, 2022
1 parent 70ff964 commit 7821448df0f4202c66c24715c1edad7b1cdb0c34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
@@ -27,7 +27,7 @@ PASS Removes an animation after updating its effect to one with a different targ
PASS Does NOT remove a CSS animation tied to markup
PASS Removes a CSS animation no longer tied to markup
PASS Does NOT remove a CSS transition tied to markup
FAIL Removes a CSS transition no longer tied to markup assert_equals: expected "removed" but got "active"
PASS Removes a CSS transition no longer tied to markup
PASS Dispatches an event when removing
PASS Does NOT dispatch a remove event twice
PASS Does NOT remove an animation after making a redundant change to another animation's current time
@@ -548,7 +548,7 @@ static void updateCSSTransitionsForStyleableAndProperty(const Styleable& styleab
// 3. If the element has a running transition or completed transition for the property, and there is not a matching transition-property
// value, then implementations must cancel the running transition or remove the completed transition from the set of completed transitions.
if (hasRunningTransition)
styleable.ensureRunningTransitionsByProperty().take(property)->cancel();
styleable.ensureRunningTransitionsByProperty().take(property)->cancelFromStyle();
else
styleable.ensureCompletedTransitionsByProperty().remove(property);
}

0 comments on commit 7821448

Please sign in to comment.