commit 595d9508a2c8f89ccccd7c504818441d037e4f67
parent 668eab02a97b1c7603d153e0b61d1565bf2f623a
Author: Rune Lillesveen <futhark@chromium.org>
Date: Fri, 14 Nov 2025 10:22:32 +0000
Bug 1999761 [wpt PR 56000] - Make scroll-timeline snapshotting tests align with spec and proposal, a=testonly
Automatic update from web-platform-tests
Make scroll-timeline snapshotting tests align with spec and proposal
According to the current spec, scroll-timelines are update after scroll
events are dispatched, but before style and layout is updated for the
frame update. With the proposed change[1] in the HTML specification,
the scroll-timelines are updated after a first style/layout update in
the resizeObserver loop.
We modify the scroll-timeline-snapshotting tests to allow them to pass
for both timings. This reveals an issue with the current Blink
implementation not matching the current spec, as we snapshot the
timelines before the scroll events are dispatched.
WebKit implements the current spec and still pass the tests after
modification.
[1] https://github.com/whatwg/html/pull/11613
Bug: 384523570
Change-Id: I03b29b1f85527f9e54d597586d0764fc53f7776b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7141779
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1543753}
--
wpt-commits: d702e50d6999b5ac1fdd815992887be83e49cbd7
wpt-pr: 56000
Diffstat:
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/testing/web-platform/tests/scroll-animations/scroll-timelines/scroll-timeline-snapshotting.html b/testing/web-platform/tests/scroll-animations/scroll-timelines/scroll-timeline-snapshotting.html
@@ -1,7 +1,8 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>ScrollTimeline snapshotting</title>
-<link rel="help" href="https://wicg.github.io/scroll-animations/#avoiding-cycles">
+<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#event-loop">
+<link rel="help" href="https://github.com/whatwg/html/pull/11613">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
@@ -9,6 +10,7 @@
<script src="/resources/testdriver-actions.js"></script>
<script src="/web-animations/testcommon.js"></script>
<script src="./testcommon.js"></script>
+<script src="/css/css-scroll-snap/support/common.js"></script>
<style>
body {
@@ -30,13 +32,17 @@ promise_test(async t => {
scroller.scrollBy({top: 100, behavior: 'smooth'});
// Wait for the scroll to change.
- const startScroll = scroller.scrollTop;
- do {
- await waitForNextFrame();
- } while(scroller.scrollTop == startScroll);
+ await waitForScrollEvent(document);
+ // The next frame the scroll changes, the scroll-timelines should not be
+ // updated before the scroll events are dispatched. Store the scroll position
+ // from the previous frame to compare the timeline to.
+ let scroll_percentage = (scroller.scrollTop / maxScroll) * 100;
+
+ await waitForScrollEvent(document);
+
assert_percents_equal(
timeline.currentTime,
- (scroller.scrollTop / maxScroll) * 100,
+ scroll_percentage,
'Scroll timeline current time corresponds to the scroll position.');
}, 'ScrollTimeline current time is updated after programmatic animated ' +
'scroll.');