diff --git a/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative-expected.txt index bdaf6e1cb0640..db2159eac3fae 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative-expected.txt @@ -1,7 +1,7 @@ -FAIL Changing animation-timeline changes the timeline (sanity check) assert_equals: expected "140px" but got "0px" -FAIL animation-timeline ignored after setting timeline with JS (ScrollTimeline from JS) assert_equals: expected "180px" but got "0px" -FAIL animation-timeline ignored after setting timeline with JS (ScrollTimeline from CSS) assert_equals: expected "140px" but got "0px" +PASS Changing animation-timeline changes the timeline (sanity check) +PASS animation-timeline ignored after setting timeline with JS (ScrollTimeline from JS) +PASS animation-timeline ignored after setting timeline with JS (ScrollTimeline from CSS) PASS animation-timeline ignored after setting timeline with JS (document timeline) FAIL animation-timeline ignored after setting timeline with JS (null) assert_equals: expected "120px" but got "0px" diff --git a/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-timeline.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-timeline.tentative-expected.txt index d6fa148fe972d..950e9fa99a02f 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-timeline.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/setting-timeline.tentative-expected.txt @@ -2,17 +2,17 @@ PASS Setting a scroll timeline on a play-pending animation synchronizes currentTime of the animation with the scroll position. PASS Setting a scroll timeline on a pause-pending animation fixes the currentTime of the animation based on the scroll position once resumed PASS Setting a scroll timeline on a reversed play-pending animation synchronizes the currentTime of the animation with the scroll position. -FAIL Setting a scroll timeline on a running animation synchronizes the currentTime of the animation with the scroll position. assert_approx_equals: Timeline's currentTime aligns with the scroll position even when paused expected a number but got a "object" +PASS Setting a scroll timeline on a running animation synchronizes the currentTime of the animation with the scroll position. PASS Setting a scroll timeline on a paused animation fixes the currentTime of the animation based on the scroll position when resumed PASS Setting a scroll timeline on a reversed paused animation fixes the currentTime of the animation based on the scroll position when resumed PASS Transitioning from a scroll timeline to a document timeline on a running animation preserves currentTime PASS Transitioning from a scroll timeline to a document timeline on a pause-pending animation preserves currentTime PASS Transition from a scroll timeline to a document timeline on a reversed paused animation maintains correct currentTime PASS Transitioning from a scroll timeline to a null timeline on a running animation preserves current progress. -FAIL Switching from a null timeline to a scroll timeline on an animation with a resolved start time preserved the play state promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')" -FAIL Switching from one scroll timeline to another updates currentTime promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')" +PASS Switching from a null timeline to a scroll timeline on an animation with a resolved start time preserved the play state +PASS Switching from one scroll timeline to another updates currentTime PASS Switching from a document timeline to a scroll timeline updates currentTime when unpaused via CSS. PASS Switching from a document timeline to a scroll timeline and updating currentTime preserves the progress while paused. FAIL Switching from a document timeline to a scroll timeline on an infinite duration animation. assert_approx_equals: values do not match for "undefined" expected 100 +/- 0.125 but got 200 -FAIL Changing from a scroll-timeline to a view-timeline updates start time. promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'actual.unit')" +PASS Changing from a scroll-timeline to a view-timeline updates start time. diff --git a/LayoutTests/platform/glib/TestExpectations b/LayoutTests/platform/glib/TestExpectations index 103f5e3d0f498..caf08de7ff882 100644 --- a/LayoutTests/platform/glib/TestExpectations +++ b/LayoutTests/platform/glib/TestExpectations @@ -2004,6 +2004,7 @@ webkit.org/b/281211 [ Debug ] imported/w3c/web-platform-tests/css/css-view-trans webkit.org/b/263870 imported/w3c/web-platform-tests/scroll-animations/css/animation-range-ignored.html [ Skip ] webkit.org/b/263870 imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-range.html [ Skip ] +imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative.html [ Skip ] #//////////////////////////////////////////////////////////////////////////////////////// # End of WebAnimations-related bugs diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations index a8389ddc1fd80..90c5ba66e4985 100644 --- a/LayoutTests/platform/win/TestExpectations +++ b/LayoutTests/platform/win/TestExpectations @@ -1048,6 +1048,8 @@ webkit.org/b/263870 imported/w3c/web-platform-tests/scroll-animations/scroll-tim imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/progress-based-effect-delay.tentative.html [ ImageOnlyFailure ] +imported/w3c/web-platform-tests/scroll-animations/css/animation-timeline-ignored.tentative.html [ Skip ] + #////////////////////////////////////////////////////////////////////////////////////////// # Compositing #////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Source/WebCore/animation/WebAnimation.cpp b/Source/WebCore/animation/WebAnimation.cpp index 8650c7e505a55..7612e489aae65 100644 --- a/Source/WebCore/animation/WebAnimation.cpp +++ b/Source/WebCore/animation/WebAnimation.cpp @@ -319,7 +319,13 @@ void WebAnimation::setTimeline(RefPtr&& timeline) if (previousPlayState == PlayState::Finished || previousPlayState == PlayState::Running) { // 5. If previous play state is "finished" or "running": // Schedule a pending play task. + // FIXME: re-creating the ready promise is not part of the spec but Chrome implements this + // behavior and it makes sense since the new start time won't be computed until the timeline + // is updated. This is covered by https://github.com/w3c/csswg-drafts/issues/11465. + auto wasAlreadyPending = pending(); m_timeToRunPendingPlayTask = TimeToRunPendingTask::WhenReady; + if (!wasAlreadyPending) + m_readyPromise = makeUniqueRef(*this, &WebAnimation::readyPromiseResolve); } else if (previousPlayState == PlayState::Paused && previousProgress) { // 6. If previous play state is "paused" and previous progress is resolved: // Set hold time to previous progress * end time.