Automatic update from web-platform-tests [ScrollTimeline] Run tests on cc if threaded compositing is enabled The scroller in the updated tests is not composited by default. When we run the tests with the virtual/threaded test suite, the tests can not properly run on the compositor because cc::ScrollTimeline is considered as inactive, i.e. scroller is not in cc::ScrollTree because it's not composited. This patch forces compositing the scrollers if the animation needs to play. Note that once all ScrollNodes including uncomposited ones are in the compositor after the scroll unification (crbug.com/476553), we no longer need to add will-change to the scrollers. Bug: None Change-Id: I0e379abb071c9bffc58f2167f4cac9f92edbb9da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211048 Reviewed-by: Xida Chen <xidachen@chromium.org> Commit-Queue: Yi Gu <yigu@chromium.org> Cr-Commit-Position: refs/heads/master@{#771161} -- wpt-commits: 4a7093f7968cd6badcd1720cf08cb1f285e20c9a wpt-pr: 23719
107 lines
3.6 KiB
HTML
107 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>ScrollTimeline invalidation</title>
|
|
<link rel="help" href="https://wicg.github.io/scroll-animations/#current-time-algorithm">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/web-animations/testcommon.js"></script>
|
|
<script src="testcommon.js"></script>
|
|
<style>
|
|
.scroller {
|
|
overflow: auto;
|
|
height: 100px;
|
|
width: 100px;
|
|
will-change: transform;
|
|
}
|
|
.contents {
|
|
height: 1000px;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
<div id="log"></div>
|
|
|
|
<script>
|
|
'use strict';
|
|
|
|
promise_test(async t => {
|
|
const animation = createScrollLinkedAnimation(t);
|
|
animation.effect.updateTiming({ duration: 350 });
|
|
const scroller = animation.timeline.scrollSource;
|
|
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
|
|
scroller.scrollTop = 0.2 * maxScroll;
|
|
// Wait for new animation frame which allows the timeline to compute new
|
|
// current time.
|
|
await waitForNextFrame();
|
|
|
|
animation.play();
|
|
await animation.ready;
|
|
|
|
// Change scroller content size.
|
|
scroller.firstChild.style.height = "500px";
|
|
|
|
await animation.finished;
|
|
const newTime = animation.effect.getTiming().duration;
|
|
assert_times_equal(animation.currentTime, newTime,
|
|
'Animation current time is updated after scroller invalidation.');
|
|
|
|
assert_times_equal(
|
|
animation.effect.getComputedTiming().localTime, newTime,
|
|
'Effect local time is updated after scroller invalidation.');
|
|
}, 'Animation current time and effect local time are updated after scroller ' +
|
|
'content size changes.');
|
|
|
|
promise_test(async t => {
|
|
const animation = createScrollLinkedAnimation(t);
|
|
animation.effect.updateTiming({ duration: 350 });
|
|
const scroller = animation.timeline.scrollSource;
|
|
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
|
|
scroller.scrollTop = 0.2 * maxScroll;
|
|
// Wait for new animation frame which allows the timeline to compute new
|
|
// current time.
|
|
await waitForNextFrame();
|
|
|
|
animation.play();
|
|
await animation.ready;
|
|
|
|
// Change scroller size.
|
|
scroller.style.height = "500px";
|
|
|
|
await animation.finished;
|
|
const newTime = animation.effect.getTiming().duration;
|
|
assert_times_equal(animation.currentTime, newTime,
|
|
'Animation current time is updated after scroller invalidation.');
|
|
|
|
assert_times_equal(
|
|
animation.effect.getComputedTiming().localTime, newTime,
|
|
'Effect local time is updated after scroller invalidation.');
|
|
}, 'Animation current time and effect local time are updated after scroller ' +
|
|
'size changes.');
|
|
|
|
promise_test(async t => {
|
|
const timeline = createScrollTimeline(t);
|
|
const scroller = timeline.scrollSource;
|
|
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
|
|
// Instantiate scroll animation that resizes its scroll timeline scroller.
|
|
const animation = new Animation(
|
|
new KeyframeEffect(
|
|
timeline.scrollSource.firstChild,
|
|
[{ height: '1000px' }, { height: '2000px' }],
|
|
{ duration: 1000, }
|
|
), timeline);
|
|
animation.play();
|
|
await animation.ready;
|
|
await waitForNextFrame();
|
|
scroller.scrollTop = 0.2 * maxScroll;
|
|
// Wait for new animation frame which allows the timeline to compute new
|
|
// current time.
|
|
await waitForNextFrame();
|
|
assert_times_equal(timeline.currentTime, 200,
|
|
'Timeline current time is updated after animation frame.');
|
|
await waitForNextFrame();
|
|
assert_times_equal(timeline.currentTime, 163.636,
|
|
'Timeline current time is updated after two animation frames and ' +
|
|
'reflects single layout run.');
|
|
}, 'If scroll animation resizes its scroll timeline scroller, ' +
|
|
'layout runs only once to reflect the initial update.');
|
|
</script>
|