diff --git a/scroll-animations/css/animation-range-ignored.html b/scroll-animations/css/animation-range-ignored.html index 1aa2864ad4c6c8..3a4f8073ce2ecb 100644 --- a/scroll-animations/css/animation-range-ignored.html +++ b/scroll-animations/css/animation-range-ignored.html @@ -63,8 +63,9 @@ const anim = startAnimation(t); await anim.ready; - scroller.scrollTop = 650; - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.scrollTop = 650; + }); // Timline time = (scroll pos - cover 0%) / (cover 100% - cover 0%) * 100% // = (650 - 600)/(900 - 600) * 100% = 100/6% diff --git a/scroll-animations/css/animation-range-normal-matches-cover.html b/scroll-animations/css/animation-range-normal-matches-cover.html index a91e3d3e29a09c..619cf2debaa576 100644 --- a/scroll-animations/css/animation-range-normal-matches-cover.html +++ b/scroll-animations/css/animation-range-normal-matches-cover.html @@ -70,8 +70,9 @@ assert_range_equals(anims[1].rangeEnd, { rangeName: 'cover', offset: CSS.percent(100) }); - scroller.scrollTop = 600; // Start boundary for cover range. - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.scrollTop = 600; // Start boundary for cover range. + }); assert_percents_equal(anims[0].currentTime, 0, 'currentTime at start of normal range'); diff --git a/scroll-animations/css/progress-based-animation-timeline.html b/scroll-animations/css/progress-based-animation-timeline.html index bbc60e3fbddf6f..f9cc0ced7be094 100644 --- a/scroll-animations/css/progress-based-animation-timeline.html +++ b/scroll-animations/css/progress-based-animation-timeline.html @@ -48,8 +48,9 @@ await waitForNextFrame(); const anim = document.getAnimations()[0]; await anim.ready; - scroller1.scrollTop = 20; - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller1.scrollTop = 20; + }); assert_equals(getComputedStyle(element).top, '120px'); }, 'progress based animation timeline works'); }; diff --git a/scroll-animations/scroll-timelines/cancel-animation.html b/scroll-animations/scroll-timelines/cancel-animation.html index 7daf76a7a5465b..24b6f32f171c69 100644 --- a/scroll-animations/scroll-timelines/cancel-animation.html +++ b/scroll-animations/scroll-timelines/cancel-animation.html @@ -25,10 +25,12 @@ 'use strict'; promise_test(async t => { - const animation = createScrollLinkedAnimation(t); + let animation; // Wait for new animation frame which allows the timeline to compute new // current time. - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + animation = createScrollLinkedAnimation(t); + }); animation.play(); animation.cancel(); @@ -170,9 +172,9 @@ await animation.ready; // Make the scroll timeline inactive. - scroller.style.overflow = 'visible'; - scroller.scrollTop; - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.style.overflow = 'visible'; + }); assert_equals(animation.timeline.currentTime, null, 'Sanity check the timeline is inactive.'); animation.cancel(); @@ -194,9 +196,9 @@ await animation.ready; // Make the scroll timeline inactive. - scroller.style.overflow = 'visible'; - scroller.scrollTop; - await waitForNextFrame(); + await runAndWaitForFrameUpdate(() => { + scroller.style.overflow = 'visible'; + }); assert_equals(animation.timeline.currentTime, null, 'Sanity check the timeline is inactive.');