mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 02:26:10 +00:00
LibWeb: Ensure requestAnimationFrame callbacks run in the proper order
From https://html.spec.whatwg.org/#list-of-animation-frame-callbacks: Each target object has a map of animation frame callbacks, which is an ordered map that must be initially empty, and an animation frame callback identifier, which is a number that must initially be zero.
This commit is contained in:
parent
ffc648196a
commit
c33f6b2ff6
Notes:
sideshowbarker
2024-07-17 23:02:37 +09:00
Author: https://github.com/mattco98
Commit: c33f6b2ff6
Pull-request: https://github.com/SerenityOS/serenity/pull/23756
3 changed files with 35 additions and 1 deletions
20
Tests/LibWeb/Text/expected/request-animation-frame-order.txt
Normal file
20
Tests/LibWeb/Text/expected/request-animation-frame-order.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
0
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
14
Tests/LibWeb/Text/input/request-animation-frame-order.html
Normal file
14
Tests/LibWeb/Text/input/request-animation-frame-order.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<div id="foo"></div>
|
||||||
|
<script src="include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
// FIXME: Workaround for https://github.com/SerenityOS/serenity/issues/23552
|
||||||
|
let x = i;
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
println(x);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -56,7 +56,7 @@ struct AnimationFrameCallbackDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HashMap<i32, Callback> m_callbacks;
|
OrderedHashMap<i32, Callback> m_callbacks;
|
||||||
IDAllocator m_id_allocator;
|
IDAllocator m_id_allocator;
|
||||||
RefPtr<Platform::Timer> m_timer;
|
RefPtr<Platform::Timer> m_timer;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue