Skip to content

Commit

Permalink
[scroll-timeline] add the ScrollTimeline interface
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264407

Reviewed by Chris Dumez.

The Scroll-driven Animations spec introduces a new ScrollTimeline subclass of AnimationTimeline.
We add the IDL and supporting code for this interface as well as the supporting ScrollTimelineOptions
dictionary and ScrollAxis enum, all behind the appropriate runtime flag.

We're skipping some additional tests because merely exposing the ScrollTimeline interface makes some new
tests progress further and turn early failures into timeouts for unfulfilled promises.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/cancel-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/constructor-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/current-time-nan-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/current-time-root-scroller-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/current-time-writing-modes-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/effect-updateTiming-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/finish-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/intrinsic-iteration-duration.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/pause-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/play-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/reverse-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-effect-fill-modes.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-effect-phases.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-inactive-timeline-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-invalidation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-range-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-snapshotting-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-current-time-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-playback-rate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-start-time-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-timeline.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/source-quirks-mode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/update-playback-rate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/updating-the-finished-state-expected.txt:
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/animation/AnimationTimeline.h:
(WebCore::AnimationTimeline::isDocumentTimeline const):
(WebCore::AnimationTimeline::isScrollTimeline const):
(WebCore::AnimationTimeline::isDocumentTimeline): Deleted.
* Source/WebCore/animation/DocumentTimeline.h:
* Source/WebCore/animation/ScrollAxis.h: Copied from Source/WebCore/animation/AnimationTimeline.h.
* Source/WebCore/animation/ScrollAxis.idl: Added.
* Source/WebCore/animation/ScrollTimeline.cpp: Copied from Source/WebCore/animation/AnimationTimeline.h.
(WebCore::ScrollTimeline::create):
(WebCore::ScrollTimeline::ScrollTimeline):
* Source/WebCore/animation/ScrollTimeline.h: Copied from Source/WebCore/animation/AnimationTimeline.h.
* Source/WebCore/animation/ScrollTimeline.idl: Added.
* Source/WebCore/animation/ScrollTimelineOptions.h: Copied from Source/WebCore/animation/AnimationTimeline.h.
* Source/WebCore/animation/ScrollTimelineOptions.idl: Added.
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:

Canonical link: https://commits.webkit.org/270451@main
  • Loading branch information
graouts committed Nov 9, 2023
1 parent 0499848 commit 5a9734b
Show file tree
Hide file tree
Showing 43 changed files with 695 additions and 354 deletions.
18 changes: 18 additions & 0 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -6811,12 +6811,30 @@ imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/animation-wit
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/animation-with-overflow-hidden.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/animation-with-root-scroller.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/animation-with-transform.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/cancel-animation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/constructor-no-document.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/custom-property.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/effect-updateTiming.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/finish-animation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/layout-changes-on-percentage-based-timeline.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/pause-animation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/play-animation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/progress-based-effect-delay.tentative.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/reverse-animation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-effect-fill-modes.tentative.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-effect-phases.tentative.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-invalidation.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-range.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/set-current-time-before-play.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-current-time.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-playback-rate.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-start-time.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-timeline.tentative.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/two-animations-attach-to-same-scroll-timeline-cancel-one.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/update-playback-rate.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/updating-the-finished-state.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/two-animations-attach-to-same-scroll-timeline.html [ Skip ]
imported/w3c/web-platform-tests/scroll-animations/view-timelines/range-boundary.html [ Skip ]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

FAIL Canceling an animation should cause its start time and hold time to be unresolved promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL A play-pending ready promise should be rejected when the animation is canceled promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL A pause-pending ready promise should be rejected when the animation is canceled promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL When an animation is canceled, it should create a resolved Promise promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL The ready promise should be replaced when the animation is canceled promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL The finished promise should NOT be rejected if the animation is already idle promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL The cancel event should NOT be fired if the animation is already idle promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL Canceling an animation should fire cancel event on orphaned element promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL Canceling an animation with inactive timeline should cause its start time and hold time to be unresolved promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL oncancel event is fired when the timeline is inactive. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
Harness Error (TIMEOUT), message = null

PASS Canceling an animation should cause its start time and hold time to be unresolved
PASS A play-pending ready promise should be rejected when the animation is canceled
TIMEOUT A pause-pending ready promise should be rejected when the animation is canceled Test timed out
NOTRUN When an animation is canceled, it should create a resolved Promise
NOTRUN The ready promise should be replaced when the animation is canceled
NOTRUN The finished promise should NOT be rejected if the animation is already idle
NOTRUN The cancel event should NOT be fired if the animation is already idle
NOTRUN Canceling an animation should fire cancel event on orphaned element
NOTRUN Canceling an animation with inactive timeline should cause its start time and hold time to be unresolved
NOTRUN oncancel event is fired when the timeline is inactive.

Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@

FAIL A ScrollTimeline can be created with a source Can't find variable: ScrollTimeline
FAIL A ScrollTimeline can be created with a non-scrolling source Can't find variable: ScrollTimeline
FAIL A ScrollTimeline created with a null source should have no source Can't find variable: ScrollTimeline
FAIL A ScrollTimeline created without a source should use the document.scrollingElement Can't find variable: ScrollTimeline
FAIL A ScrollTimeline created with the default axis should default to 'block' Can't find variable: ScrollTimeline
FAIL 'block' is a valid axis value Can't find variable: ScrollTimeline
FAIL 'inline' is a valid axis value Can't find variable: ScrollTimeline
FAIL 'x' is a valid axis value Can't find variable: ScrollTimeline
FAIL 'y' is a valid axis value Can't find variable: ScrollTimeline
FAIL Creating a ScrollTimeline with an invalid axis value should throw assert_throws_js: function "function() {
new ScrollTimeline({axis: 'nonsense'})
}" threw object "ReferenceError: Can't find variable: ScrollTimeline" ("ReferenceError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
PASS A ScrollTimeline can be created with a source
PASS A ScrollTimeline can be created with a non-scrolling source
PASS A ScrollTimeline created with a null source should have no source
FAIL A ScrollTimeline created without a source should use the document.scrollingElement assert_equals: expected Element node <html><head><meta charset="utf-8">
<title>ScrollTimeline ... but got null
PASS A ScrollTimeline created with the default axis should default to 'block'
PASS 'block' is a valid axis value
PASS 'inline' is a valid axis value
PASS 'x' is a valid axis value
PASS 'y' is a valid axis value
PASS Creating a ScrollTimeline with an invalid axis value should throw

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

FAIL currentTime should be null for a display: inline source Can't find variable: ScrollTimeline
FAIL currentTime should be null for a display: none source Can't find variable: ScrollTimeline
FAIL currentTime should be null for an unattached source Can't find variable: ScrollTimeline
FAIL currentTime should be null when the source is not a scroller Can't find variable: ScrollTimeline
PASS currentTime should be null for a display: inline source
PASS currentTime should be null for a display: none source
PASS currentTime should be null for an unattached source
PASS currentTime should be null when the source is not a scroller

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

FAIL currentTime calculates the correct time for a document.scrollingElement source promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL currentTime calculates the correct time for a document.scrollingElement source promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')"

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FAIL currentTime handles direction: rtl correctly promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL currentTime handles writing-mode: vertical-rl correctly promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL currentTime handles writing-mode: vertical-lr correctly promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: ScrollTimeline"
FAIL currentTime handles direction: rtl correctly promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')"
FAIL currentTime handles writing-mode: vertical-rl correctly promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')"
FAIL currentTime handles writing-mode: vertical-lr correctly promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')"

Loading

0 comments on commit 5a9734b

Please sign in to comment.