diff --git a/packages/producer/src/services/renderOrchestrator.ts b/packages/producer/src/services/renderOrchestrator.ts index b855107f0c..e59ef581be 100644 --- a/packages/producer/src/services/renderOrchestrator.ts +++ b/packages/producer/src/services/renderOrchestrator.ts @@ -578,7 +578,22 @@ function blitHdrVideoLayer( clipped = true; } - if (viewportMatrix) { + // Detect identity matrix — route through the region path (which supports + // clip rects) instead of the affine path. Chrome reports a viewport matrix + // for all HDR elements, including untransformed ones inside overflow:hidden + // wrappers. An identity matrix means no visual transform is applied. + const isIdentity = !!( + viewportMatrix && + viewportMatrix.length >= 6 && + Math.abs(viewportMatrix[0]! - 1) < 0.001 && + Math.abs(viewportMatrix[1]!) < 0.001 && + Math.abs(viewportMatrix[2]!) < 0.001 && + Math.abs(viewportMatrix[3]! - 1) < 0.001 && + Math.abs(viewportMatrix[4]!) < 0.001 && + Math.abs(viewportMatrix[5]!) < 0.001 + ); + + if (viewportMatrix && !isIdentity) { if (clipped && log) { log.debug( `HDR clip rect on affine-transformed element ${el.id} — clip not applied (affine scissor not yet supported)`,