mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
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.
This commit is contained in:
parent
4e9480b719
commit
37322baf54
Notes:
sideshowbarker
2024-07-17 05:02:35 +09:00
Author: https://github.com/mattco98
Commit: 37322baf54
Pull-request: https://github.com/SerenityOS/serenity/pull/24530
5 changed files with 32 additions and 3 deletions
|
@ -0,0 +1,18 @@
|
|||
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue