1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

LibWeb: Pass the correct timestamp to requestAnimationFrame callbacks

The timestamp needs to be consistent with the "current high resolution
time" as reflected by window.performance.now
This commit is contained in:
Andreas Kling 2021-10-03 12:48:15 +02:00
parent 5cf439cce0
commit 97ea277f8f

View file

@ -188,7 +188,7 @@ i32 Window::request_animation_frame(JS::FunctionObject& js_callback)
auto callback = request_animation_frame_driver().add([this, handle = JS::make_handle(&js_callback)](i32 id) mutable { auto callback = request_animation_frame_driver().add([this, handle = JS::make_handle(&js_callback)](i32 id) mutable {
auto& function = *handle.cell(); auto& function = *handle.cell();
auto& vm = function.vm(); auto& vm = function.vm();
(void)vm.call(function, JS::js_undefined(), JS::Value((double)Core::DateTime::now().timestamp())); (void)vm.call(function, JS::js_undefined(), JS::Value(performance().now()));
if (vm.exception()) if (vm.exception())
vm.clear_exception(); vm.clear_exception();
m_request_animation_frame_callbacks.remove(id); m_request_animation_frame_callbacks.remove(id);