Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 95675d2184dce25690106ac45b3e88d3c8ec90e7
      
https://github.com/WebKit/WebKit/commit/95675d2184dce25690106ac45b3e88d3c8ec90e7
  Author: Antoine Quint <[email protected]>
  Date:   2025-02-08 (Sat, 08 Feb 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/timeline-scope-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/view-timeline-lookup.html
    M Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebCore/animation/KeyframeEffectStack.cpp
    M Source/WebCore/animation/StyleOriginatedAnimation.cpp
    M Source/WebCore/animation/StyleOriginatedAnimation.h
    M Source/WebCore/animation/WebAnimation.cpp

  Log Message:
  -----------
  [web-animations] animations without an associated timeline should have their 
effects in the effect stack
https://bugs.webkit.org/show_bug.cgi?id=287327

Reviewed by Tim Nguyen.

Prior to the addition of Scroll-driven Animations, there was no real practical 
purpose to set a null
timeline on an animation, and in fact it wasn't possible to set one via CSS, 
only using the Web
Animations API. With that assumption in mind, we incorrectly did not list 
effects associated with
an animation without a timeline in the effect stack of their associated target. 
However, with
Scroll-driven Animations, the `animation-timeline` property allows to set 
various types of timelines
(document, scroll and view) and the interaction with the `timeline-scope` 
property may also yield null
timelines. Some new WPT tests now rely on effects associated with animations 
with no timelines to appear
in the effect stack, so we must update our implementation to remove our 
timeline requirement.

To implement that behavior we remove the timeline check in 
`KeyframeEffectStack::addEffect()` and
remove the timeline assertion in `KeyframeEffectStack::applyKeyframeEffects()`.

While that is sufficient to allow effects not associated with a timeline 
through their animation to
appear in an effect stack, this change uncovered an issue in 
`css/css-animations/event-dispatch.tentative.html`
which checked that an animation that has its timeline set to null via the Web 
Animations API would
dispatch an `animationcancel` event. Indeed, to dispatch such an event, we 
simply overloaded the
`setTimeline()` method on `StyleOriginatedAnimation` and called `cancel()` if 
we switched to a null
timeline. But calling `cancel()` has other implications beyond dispatching an 
`animationcancel` event,
such as resetting timing properties of the animation. To address this, we 
refactor the `invalidateDOMEvents()`
method to allow a callback to be evaluated in between computing the current 
animation time (which will be
used as the cancelation time) and the evaluation of the state change to 
determine which events to dispatch.
Using this callback, we can have `setTimeline()` and `cancel()` call their 
respective superclass methods
in that process.

Finally, this uncovered an issue in 
`scroll-animations/css/view-timeline-lookup.html` where the test
assumed an inactive timeline instead of a "null" timeline, which only started 
behaving differently in
WebKit with this patch since we now correctly apply the animation in this case.

* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/timeline-scope-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/view-timeline-lookup.html:
* Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/animation/KeyframeEffectStack.cpp:
(WebCore::KeyframeEffectStack::addEffect):
(WebCore::KeyframeEffectStack::applyKeyframeEffects):
* Source/WebCore/animation/StyleOriginatedAnimation.cpp:
(WebCore::StyleOriginatedAnimation::setTimeline):
(WebCore::StyleOriginatedAnimation::cancel):
(WebCore::StyleOriginatedAnimation::invalidateDOMEvents):
* Source/WebCore/animation/StyleOriginatedAnimation.h:
* Source/WebCore/animation/WebAnimation.cpp:
(WebCore::WebAnimation::enqueueAnimationEvent):

Canonical link: https://commits.webkit.org/290092@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to