Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scroll-animations/css/animation-range-ignored.html
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 3 additions & 2 deletions scroll-animations/css/progress-based-animation-timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
Expand Down
18 changes: 10 additions & 8 deletions scroll-animations/scroll-timelines/cancel-animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand All @@ -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.');

Expand Down