blob: d909843b7cc55bc6914d8549b7a257c3e84cdf6f [file] [log] [blame]
<!DOCTYPE html>
<style>
#box {
width: 100px;
height: 100px;
background-color: #00ff00;
}
#covered {
width: 100px;
height: 100px;
background-color: #ff8080;
}
/* Note that the 'scroller' deliberately doesn't have overflow. */
#scroller {
overflow: visible;
height: 100px;
width: 100px;
}
#contents {
height: 1000px;
width: 100%;
}
</style>
<div id="box"></div>
<div id="covered"></div>
<div id="scroller">
<div id="contents"></div>
</div>
<script id="test_animator" type="text/worklet">
registerAnimator("test_animator", class {
animate(currentTime, effect) {
// This method should not get called. If this happens then the scroller was
// composited somehow and the test is invalid. Set the output to 50% to
// signal that and fail the test.
effect.localTime = 500;
}
});
</script>
<script src="resources/animation-worklet-tests.js"></script>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
}
runInAnimationWorklet(
document.getElementById('test_animator').textContent
).then(()=>{
const box = document.getElementById('box');
const effect = new KeyframeEffect(box,
[
{ transform: 'translateY(0)' },
{ transform: 'translateY(200px)' }
], {
duration: 1000,
}
);
const scroller = document.getElementById('scroller');
const timeline = new ScrollTimeline({ scrollSource: scroller, timeRange: 1000, orientation: 'block' });
const animation = new WorkletAnimation('test_animator', effect, timeline);
animation.play();
if (window.testRunner) {
waitTwoAnimationFrames(_ => {
testRunner.notifyDone();
});
}
});
</script>