ladybird/Tests/LibWeb/Text/input/WebAnimations/misc/DocumentTimeline.html
Matthew Olsson 37322baf54 LibWeb: Ensure all DocumentTimeline objects have the same time value
The DocumentTimeline constructor used the current millisecond time to
initialize its currentTime, but that means that a newly created timeline
would always have a different time value than other timelines that have
been through the update_animations_and_send_events function.
2024-06-03 10:53:32 +02:00

18 lines
812 B
HTML

<!DOCTYPE html>
<script src="../../include.js"></script>
<script>
test(() => {
function timesAreClose(a, b) {
return Math.abs(a - b) <= 1;
}
let timeline = new DocumentTimeline();
println(`new timeline time equals document timeline time: ${timesAreClose(timeline.currentTime, document.timeline.currentTime)}`);
timeline = new DocumentTimeline({ originTime: 0 });
println(`new timeline originTime defaults to 0: ${timesAreClose(timeline.currentTime, document.timeline.currentTime)}`);
timeline = new DocumentTimeline({ originTime: 1000 });
let passed = timesAreClose(timeline.currentTime + 1000, document.timeline.currentTime);
println(`new timeline originTime offsets from document timeline: ${passed}`)
});
</script>