Repository navigation
fix(engine): fast capture works on Chrome 157+, which wants content=drawable - #7626
Conversation
Edit accuracy: accurate 267 (base branch 267), smooth 88 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head f45ddb97
The fix uses core's htmlInCanvasForm/CAPTURE_CANVAS_SELECTOR, so the engine and producer now follow the same Chrome-version decision as authored canvases.
Scope
Read the full diff. Rule-2 sweep: every engine drawElementImage call draws root inside __hf_de_canvas, which injectDrawElementCanvas marks. The remaining engine layoutsubtree mentions (frameCapture.ts:1296, threeDProjection.ts:9) are comments. shader-transitions still probes layoutSubtree; the PR discloses this and it uses the existing fallback. The "fails without the fix:" line names drawElementCanvasForm.browser.test.ts and the new htmlCompiler.test.ts case. CI ran the browser test (2 passed; flake gate 10/10). All Actions runs pass at this head, including Windows render verification. Not exercised by anyone: a full export on a real Chrome 157.
What
Fast (drawElement) capture now marks its canvas the way the running Chrome asks for:
layoutsubtreeon Chrome up to 156,content="drawable"plusdrawableon the composition root on 157+. The single-worker pin for html-in-canvas compositions also recognises the 157 canvas.Why
Chrome 157 became Stable and renamed the opt-in. The engine's wrapper canvas always set
layoutsubtree, so on a 157 browser every fast-capture export died at the first frame withInvalidStateError: Failed to execute 'drawElementImage' on 'CanvasRenderingContext2D': DrawElementImage requires the canvas to have the content=drawable attribute.fails without the fix:
drawElementCanvasForm.browser.test.ts(both cases, against a real Chrome 157.0.8103.78 and against Chrome 152 with its 157 marks simulated) and the newhtmlCompiler.test.tscase.Related work
packages/core/src/htmlInCanvas.tsalready owns the form decision for authored canvases (htmlInCanvasForm); the engine was the one capture path still hardcoding the old form. No open PR touches this.How
injectDrawElementCanvasasks the page forhtmlInCanvasForm()(the same function core uses) and applies the matching marks. A build withdrawElementImagebut norequestPaintkeepslayoutsubtree, as before.detectRenderModeHintsuses core'sCAPTURE_CANVAS_SELECTORinstead of its owncanvas[layoutsubtree], so a composition authored with the 157 canvas is still pinned to one worker.Test plan
What I measured
On a Linux box, headless shell,
--enable-features=CanvasDrawElement:layoutSubtreeis absent from the canvas,updateElementGeometrypresent; alayoutsubtreecanvas throws the error above;content="drawable"plusdrawableon the child is accepted.layoutsubtreeaccepted,content="drawable"refused.drawElementService.tsreverted to main: 152 run 1 failed / 1 passed, 157 run 2 failed.drawElementService.test.ts: 22 passed.htmlCompiler.test.ts: 179 passed; withhtmlCompiler.tsreverted, the new case fails (178 pass, 1 fail).What I did NOT execute
packages/shader-transitionsstill probes forlayoutSubtree, so on 157 its page-side compositor and html-in-canvas scene capture report unsupported and use their existing fallbacks; unchanged here.Size
About 120 changed lines, of which about 90 are the new browser test; the fix itself is about 15 lines in two files.