Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d46cee42c3f48247c3f92be3a13882e25c33e56c
      
https://github.com/WebKit/WebKit/commit/d46cee42c3f48247c3f92be3a13882e25c33e56c
  Author: Antoine Quint <grao...@webkit.org>
  Date:   2025-02-07 (Fri, 07 Feb 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-deferred-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-deferred.html
    M Source/WebCore/animation/AnimationTimelinesController.cpp
    M Source/WebCore/animation/AnimationTimelinesController.h
    M Source/WebCore/animation/ScrollTimeline.cpp
    M Source/WebCore/animation/ScrollTimeline.h

  Log Message:
  -----------
  [scroll-animations] CSS Animations with an `animation-timeline` matching a 
`timeline-scope` should default to an inactive scroll timeline
https://bugs.webkit.org/show_bug.cgi?id=287239

Reviewed by Dean Jackson.

When dealing with an `animation-timeline` value that did not match a 
`scroll-timeline-name`
within a scope defined by `timeline-scope`, our code would assign a null 
timeline. But the
Scroll-driven Animations specification says [0] that this should result in 
assigning an inactive
timeline, or in other words a scroll timeline without a source:

    Declares the name of a matching named timeline defined by a descendant – 
​whose scope is not
    already explicitly declared by a descendant using timeline-scope – ​to be 
in scope for this
    element and its descendants.

    If no such timeline exists, or if more than one such timeline exists, 
instead declares an
    inactive timeline with the specified name.

So we update our code to correctly create an inactive scroll timeline if we 
fail to determine
an existing timeline or we have multiple options.

Since we may create multiple such timelines as elements are awaiting the 
definition of a named
timeline, we identify those with a specific flag and purge them after dealing 
with pending
attachment operations.

To be able to track those inactive timelines, we must have access to the 
instance's name-to-timeline
map, so we change previously static methods to be instance methods.

This change highlighted that an existing WPT assertion was incorrectly 
expecting a null timeline
instead of an inactive timeline in the scenario outlined above, so we modify 
that test to correctly
check for a null timeline source instead of a null timeline.

[0] 
https://drafts.csswg.org/scroll-animations-1/#valdef-timeline-scope-dashed-ident

* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-deferred-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-deferred.html:
* Source/WebCore/animation/AnimationTimelinesController.cpp:
(WebCore::AnimationTimelinesController::inactiveNamedTimeline):
(WebCore::AnimationTimelinesController::determineTreeOrder):
(WebCore::AnimationTimelinesController::determineTimelineForElement):
(WebCore::AnimationTimelinesController::attachPendingOperations):
(WebCore::AnimationTimelinesController::setTimelineForName):
(WebCore::determineTreeOrder): Deleted.
(WebCore::determineTimelineForElement): Deleted.
* Source/WebCore/animation/AnimationTimelinesController.h:
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::createInactiveStyleOriginatedTimeline):
* Source/WebCore/animation/ScrollTimeline.h:
(WebCore::ScrollTimeline::isInactiveStyleOriginatedTimeline const):

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



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

Reply via email to