From 1a98943b7b6aee4135675943d645a42e42ec0b03 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Fri, 18 Nov 2022 09:20:30 +0100 Subject: [PATCH] Aligns requestAnimationFrame's callback to the w3c specification --- .../Fix-WebWorker-requestAnimationFrame.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 build/patches/Fix-WebWorker-requestAnimationFrame.patch diff --git a/build/patches/Fix-WebWorker-requestAnimationFrame.patch b/build/patches/Fix-WebWorker-requestAnimationFrame.patch new file mode 100644 index 00000000..1bdf8649 --- /dev/null +++ b/build/patches/Fix-WebWorker-requestAnimationFrame.patch @@ -0,0 +1,38 @@ +From: uazo +Date: Mon, 3 Oct 2022 09:39:07 +0000 +Subject: Fix WebWorker requestAnimationFrame + +Aligns requestAnimationFrame's callback to the w3c specification +See bugid 1236113 +--- + .../animation_frame/worker_animation_frame_provider.cc | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc +--- a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc ++++ b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc +@@ -7,7 +7,9 @@ + #include "base/trace_event/trace_event.h" + #include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h" + #include "third_party/blink/renderer/core/timing/worker_global_scope_performance.h" ++#include "third_party/blink/renderer/core/workers/worker_global_scope.h" + #include "third_party/blink/renderer/platform/bindings/microtask.h" ++#include "third_party/blink/renderer/platform/wtf/casting.h" + #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" + + namespace blink { +@@ -62,7 +64,11 @@ void WorkerAnimationFrameProvider::BeginFrame(const viz::BeginFrameArgs& args) { + } + } + +- double time = (args.frame_time - base::TimeTicks()).InMillisecondsF(); ++ auto* global_scope = DynamicTo(provider->context_.Get()); ++ DCHECK(global_scope); ++ double time = Performance::ClampTimeResolution( ++ args.frame_time - global_scope->TimeOrigin(), ++ provider->context_->CrossOriginIsolatedCapability()); + provider->callback_collection_.ExecuteFrameCallbacks(time, time); + } + provider->begin_frame_provider_->FinishBeginFrame(args); +-- +2.25.1