Skip to content

Commit 1bfef24

Browse files
lillesmoz-wptsync-bot
authored andcommitted
Bug 1990305 [wpt PR 55017] - Make scroll-timelines/setting-* tests pass for run-snapshot-post-layout, a=testonly
Automatic update from web-platform-tests Make scroll-timelines/setting-* tests pass for run-snapshot-post-layout Preparing for proposed change: whatwg/html#11613 Bug: 384523570 Change-Id: Ic4ba0c31dcf0a1783dd2710462a5061ff8586c52 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6976604 Commit-Queue: Rune Lillesveen <[email protected]> Reviewed-by: Kevin Ellis <[email protected]> Cr-Commit-Position: refs/heads/main@{#1519481} -- wpt-commits: 538a74ceed6fb26498dccfb6a3ec3aa8baec363a wpt-pr: 55017
1 parent a19da4e commit 1bfef24

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

testing/web-platform/tests/scroll-animations/scroll-timelines/setting-current-time.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@
228228
await animation.ready;
229229

230230
// Make the timeline inactive.
231-
scroller.style.overflow = 'visible';
232-
scroller.scrollTop;
233-
await waitForNextFrame();
231+
await runAndWaitForFrameUpdate(() => {
232+
scroller.style.overflow = 'visible';
233+
});
234234

235235
assert_equals(animation.currentTime, null,
236236
'Current time is unresolved when the timeline is inactive.');
@@ -255,9 +255,9 @@
255255
await animation.ready;
256256

257257
// Make the timeline inactive.
258-
scroller.style.overflow = 'visible';
259-
scroller.scrollTop;
260-
await waitForNextFrame();
258+
await runAndWaitForFrameUpdate(() => {
259+
scroller.style.overflow = 'visible';
260+
});
261261

262262
assert_equals(animation.timeline.currentTime, null,
263263
'Current time is unresolved when the timeline is inactive.');
@@ -270,9 +270,9 @@
270270
'timeline is inactive.');
271271

272272
// Make the timeline active.
273-
scroller.style.overflow = 'auto';
274-
scroller.scrollTop;
275-
await waitForNextFrame();
273+
await runAndWaitForFrameUpdate(() => {
274+
scroller.style.overflow = 'auto';
275+
});
276276

277277
assert_percents_equal(animation.timeline.currentTime, 0,
278278
'Current time is resolved when the timeline is active.');

testing/web-platform/tests/scroll-animations/scroll-timelines/setting-playback-rate.html

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@
104104
animation.playbackRate = 2;
105105
animation.play();
106106
await animation.ready;
107-
scroller.scrollTop = 0.2 * maxScroll;
107+
108108
// Wait for new animation frame which allows the timeline to compute new
109109
// current time.
110-
await waitForNextFrame();
110+
await runAndWaitForFrameUpdate(() => {
111+
scroller.scrollTop = 0.2 * maxScroll;
112+
});
111113

112114
assert_percents_equal(animation.currentTime, 40,
113115
'The current time should increase two times faster ' +
@@ -208,8 +210,9 @@
208210

209211
animation.playbackRate = -1;
210212

211-
scroller.scrollTop = 0.8 * maxScroll;
212-
await waitForNextFrame();
213+
await runAndWaitForFrameUpdate(() => {
214+
scroller.scrollTop = 0.8 * maxScroll;
215+
});
213216
// -300 = 500 - 800
214217

215218
// let timelineDiff =
@@ -219,8 +222,9 @@
219222
assert_percents_equal(animation.timeline.currentTime, 80);
220223
assert_percents_equal(animation.currentTime, 20);
221224

222-
scroller.scrollTop = 0.2 * maxScroll;
223-
await waitForNextFrame();
225+
await runAndWaitForFrameUpdate(() => {
226+
scroller.scrollTop = 0.2 * maxScroll;
227+
});
224228
// // 300 = 500 - 200
225229
// timelineDiff =
226230
// startingTimelineTime.value - animation.timeline.currentTime.value;
@@ -259,9 +263,10 @@
259263

260264
await animation.ready;
261265
assert_percents_equal(animation.currentTime, 20);
262-
animation.playbackRate = 0;
263-
scroller.scrollTop = 0.5 * maxScroll;
264-
await waitForNextFrame();
266+
await runAndWaitForFrameUpdate(() => {
267+
animation.playbackRate = 0;
268+
scroller.scrollTop = 0.5 * maxScroll;
269+
});
265270

266271
// Ensure that current time does not change.
267272
assert_percents_equal(animation.timeline.currentTime, 50);

testing/web-platform/tests/scroll-animations/scroll-timelines/setting-start-time.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
const animation = createScrollLinkedAnimation(t);
4242
const scroller = animation.timeline.source;
4343
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
44-
scroller.scrollTop = 0.2 * maxScroll;
44+
4545
// Wait for new animation frame which allows the timeline to compute new
4646
// current time.
47-
await waitForNextFrame();
47+
await runAndWaitForFrameUpdate(() => {
48+
scroller.scrollTop = 0.2 * maxScroll;
49+
});
4850

4951
// So long as a hold time is set, querying the current time will return
5052
// the hold time.

testing/web-platform/tests/scroll-animations/scroll-timelines/setting-timeline.tentative.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@
5353
function updateScrollPosition(timeline, offset) {
5454
const scroller = timeline.source;
5555
assert_true(!!scroller, 'source is resolved');
56-
scroller.scrollTop = offset;
56+
5757
// Wait for new animation frame which allows the timeline to compute new
5858
// current time.
59-
return waitForNextFrame();
59+
return runAndWaitForFrameUpdate(() => {
60+
scroller.scrollTop = offset;
61+
});
6062
}
6163

6264
function assert_timeline_current_time(animation, timeline_current_time) {

0 commit comments

Comments
 (0)