Skip to content

Commit e842e42

Browse files
committed
Bug 1979223 [wpt PR 53971] - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=290993, a=testonly
Automatic update from web-platform-tests WebKit export of https://bugs.webkit.org/show_bug.cgi?id=290993 (#53971) -- wpt-commits: 90baf42ec656dacc24a35d1c7dc7ab6734a4fff2 wpt-pr: 53971 UltraBlame original commit: 665bf8ee74f53c4e0b6fa581fb2e2cf88646b1e7
1 parent 8eda2dd commit e842e42

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

testing/web-platform/tests/web-animations/timing-model/animations/setting-the-start-time-of-an-animation.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,5 +325,58 @@
325325
}, 'Setting the start time on a reverse running animation updates the play '
326326
+ 'state');
327327

328+
promise_test(async t => {
329+
const make_animation = () => createDiv(t).animate(null, 100 * MS_PER_SEC);
330+
331+
// Wait for a couple of page rendering updates to run and record the timeline time.
332+
await waitForAnimationFrames(2);
333+
const timelineTimeForFirstPageRenderingUpdate = document.timeline.currentTime;
334+
335+
// Create a first animation that is created during the page rendering update.
336+
// This animation should have its start time set to the current timeline time.
337+
const animStartedDuringPageRenderingUpdate = make_animation();
338+
339+
// Wait for a new JS call frame and start another animation. This animation
340+
// should have its start time set to the timeline time of the next page
341+
// rendering update.
342+
await new Promise(setTimeout);
343+
const animStartedAfterTimeout = make_animation();
344+
345+
// Wait for another new JS call frame and start another animation. This
346+
// animation, like the previous one, should have its start time set to
347+
// the timeline time of the next page rendering update.
348+
await new Promise(setTimeout);
349+
const animStartedAfterAnotherTimeout = make_animation();
350+
351+
// Now wait until the next page rendering update and record the timeline time.
352+
await waitForAnimationFrames(1);
353+
const timelineTimeForSecondPageRenderingUpdate = document.timeline.currentTime;
354+
355+
// Create an animation that is created during this second page rendering update.
356+
// This animation should have its start time set to the new timeline time.
357+
const animStartedDuringSecondPageRenderingUpdate = make_animation();
358+
359+
// All animations should be ready by the next animation frame.
360+
await waitForAnimationFrames(1);
361+
362+
const assert_start_time = (animation, expected, description) => {
363+
assert_approx_equals(animation.startTime, expected, 0.0001,
364+
`Start time of animation started ${description}`);
365+
};
366+
367+
assert_start_time(animStartedDuringPageRenderingUpdate,
368+
timelineTimeForFirstPageRenderingUpdate,
369+
"during the first page rendering update");
370+
assert_start_time(animStartedAfterTimeout,
371+
timelineTimeForSecondPageRenderingUpdate,
372+
"after waiting for a new JS call frame");
373+
assert_start_time(animStartedAfterAnotherTimeout,
374+
timelineTimeForSecondPageRenderingUpdate,
375+
"after waiting for another new JS call frame");
376+
assert_start_time(animStartedDuringSecondPageRenderingUpdate,
377+
timelineTimeForSecondPageRenderingUpdate,
378+
"during the second page rendering update");
379+
}, 'Checking the start time of animations started at various times between two page rendering updates');
380+
328381
</script>
329382
</body>

0 commit comments

Comments
 (0)