From b97de59c84a751e0ac91af5fe539bc491edbc149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Sat, 24 Oct 2026 22:35:57 +0000 Subject: [PATCH] fix(core): motion blur no longer blacks out videos inside sub-compositions (#6252) * fix(core): motion blur no longer blacks out videos inside sub-compositions * chore(core): drop the explanatory comment from the motion blur isolate move --- .../src/runtime/captureMotionBlur/index.test.ts | 14 ++++++++++++++ .../core/src/runtime/captureMotionBlur/index.ts | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/core/src/runtime/captureMotionBlur/index.test.ts b/packages/core/src/runtime/captureMotionBlur/index.test.ts index 7d6891c2a4..3979c6ebe6 100644 --- a/packages/core/src/runtime/captureMotionBlur/index.test.ts +++ b/packages/core/src/runtime/captureMotionBlur/index.test.ts @@ -705,6 +705,20 @@ describe("two-phase frames", () => { expect(el.hasAttribute(MOVER)).toBe(false); }); + it("keeps the page visible until an engine frame is armed, so video frames inject into it", async () => { + installHtmlInCanvas(); + const { root, h } = movingHost(); + initCaptureMotionBlur(h); + const done = paintCaptureMotionBlur(0.5, { engineMode: true }); + expect(root.hasAttribute(ONLY)).toBe(false); + releaseCaptureMotionBlurFrame(); + expect(root.hasAttribute(ONLY)).toBe(true); + captureCanvas(root).dispatchEvent(new Event("paint")); + captureCanvas(root).dispatchEvent(new Event("paint")); + win.__hf_page_composite_resolve?.(); + await done; + }); + it("shows plain DOM, not a half frame, when the engine's step runs before the background capture", async () => { installHtmlInCanvas(); const { root, el, h } = movingHost(); diff --git a/packages/core/src/runtime/captureMotionBlur/index.ts b/packages/core/src/runtime/captureMotionBlur/index.ts index d32c791224..dae1d42e55 100644 --- a/packages/core/src/runtime/captureMotionBlur/index.ts +++ b/packages/core/src/runtime/captureMotionBlur/index.ts @@ -527,7 +527,7 @@ function createInstance(host: CaptureMotionBlurHost, config: Config, form: HtmlI resolve(); }, }; - if (pending.phase === "movers") isolate(pending); + if (pending.phase === "movers" && !engineMode) isolate(pending); if (engineMode) return; startTimer(); src.requestPaint(); @@ -576,6 +576,7 @@ function createInstance(host: CaptureMotionBlurHost, config: Config, form: HtmlI arm: () => { if (!pending || pending.armed) return; pending.armed = true; + if (pending.phase === "movers") isolate(pending); pending.startTimer(); src.requestPaint(); },