Repository navigation
Description
Context
We capture HTML compositions to video using drawElementImage for frame capture
(~1.5× faster than CDP screenshots on real production content). At today's
implementation maturity, several content classes capture incorrectly in Chromium —
CSS 3D rendering contexts (crbug.com/522872457),
stacked containers with animated partial opacity (crbug.com/521861819), and
accelerated canvases whose paint records freeze at the first frame.
Implementation bugs get fixed over time. The structural problem we want to raise
here is an API-design one: when drawElementImage mis-renders a region, the
application has no escape path at all, because two restrictions compose badly:
-
drawElementImageonly accepts immediate children of its canvas.
When a deep subtree (a 3D flip card, a fading scene wrapper) captures
incorrectly, we cannot capture that subtree separately and composite it
manually — hoisting it to be an immediate canvas child breaks descendant CSS
selectors and layout context. -
Children of a
layoutsubtreecanvas never paint to the screen.
So the traditional fallback — screenshot the affected region and paste it
over the capture — is also impossible: the page is visually blank while the
canvas wraps the content.
Together these mean any rendering gap in drawElementImage is a hard wall.
Our current production posture is to statically detect affected content and
route the entire render back to screenshot capture, losing the API's benefit
for ~70% of real compositions (10 of 14 in our sample use CSS 3D scene
entrances).
What we tried (all dead ends)
- Capture the problem subtree with its own
drawElementImagecall → rejected:
"Only immediate children of the element can be passed". - CDP
Page.captureScreenshotfor the affected region → blank page under
layoutsubtree. - Re-express the problematic styles (e.g. fades as
filter: opacity(),
3D as flat single-elementperspective()transforms) → same failures. - Rasterize the subtree to a texture (SVG
foreignObject) and re-project via
WebGL, compositing under/over the DOM paint → works, but only for subtrees
with static content; animated descendants freeze at the rasterization
snapshot.
Ask
Either of the following would unblock applications generically:
-
Subtree capture: allow
drawElementImage(element)for any descendant of
the layoutsubtree canvas (perhaps with an explicit opt-in attribute on the
element), so applications can compose captures and substitute their own
rendering for regions the implementation doesn't yet handle. -
A spec'd region-fallback story: e.g. a way to ask the engine to rasterize
a given descendant via the full compositor path into an ImageBitmap
(element.captureToImageBitmap()-style), usable alongsidedrawElementImage.
A third, softer option is spec text enumerating which CSS features
drawElementImage is required to honor (3D rendering contexts, backface
visibility, filters, animated opacity on promoted layers), so implementations
fail loudly (throw) rather than silently emitting wrong pixels — silent
divergence from on-screen rendering is the most expensive failure mode for
capture pipelines.
Happy to provide the deterministic repros referenced above; they're ~50-line
Puppeteer scripts.
Activity
fix(producer): crossfade + software-GL gates for fast capture
progers commentedon Jun 26, 2026
Thanks for taking the time to file this. I've triaged the two chromium bugs you filed. Please keep the bugs coming!
I think the meta issue you are reporting here will be fixed with a solution to either #134 or #120, both of which we are pursuing.