LibWeb: Use InternalAnimationTimeline in the startTime.html test

This commit is contained in:
Matthew Olsson 2024-03-27 16:49:58 -07:00 committed by Andreas Kling
parent 7dcd7206d3
commit d1f35653b1
Notes: sideshowbarker 2024-07-17 01:00:06 +09:00

View file

@ -4,6 +4,7 @@
<script>
asyncTest(async done => {
const foo = document.getElementById("foo");
let animation = foo.animate({ opacity: [0, 1] }, { duration: 1000 });
println(`Animation's startTime is initially null: ${animation.startTime === null}`);
animation.startTime = 100;
@ -20,14 +21,17 @@
animation.currentTime = 100;
println(`Animation's startTime is null after calling pause() and setting currentTime: ${animation.startTime === null}`);
animation = foo.animate({ opacity: [0, 1] }, { duration: 1000 });
const timeline = internals.createInternalAnimationTimeline();
timeline.setTime(0);
animation = foo.animate({ opacity: [0, 1] }, { duration: 1000, timeline });
animation.startTime = 100;
animation.playbackRate = -1;
println(`Animation's startTime updates after reversing playbackRate: ${animation.startTime > -150 && animation.startTime < -50}`);
println(`Animation's startTime updates after reversing playbackRate: ${animation.startTime === -100}`);
animation = foo.animate({ opacity: [0, 1] }, { duration: 1000 });
animation = foo.animate({ opacity: [0, 1] }, { duration: 1000, timeline });
animation.finish();
println(`Animation's startTime updates after calling finish(): ${animation.startTime > -1050 && animation.startTime < -950}`);
println(`Animation's startTime updates after calling finish(): ${animation.startTime === -1000}`);
done();
});