From cc89d0aae20011a30958912a8ec5c9732dec69a1 Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Mon, 27 Apr 2026 21:46:06 -0700 Subject: [PATCH] fix(hdr): handle translation-only matrices for clip rect support The previous isIdentity check only caught matrix(1,0,0,1,0,0). Elements with layout translation (e.g. right-half split at left:960px reporting matrix(1,0,0,1,960,0)) still routed through the affine path where clip rects are not applied. Fix: check for translation-only matrices (scale=1, rotation=0, any tx/ty) and route those through the region blit path. el.x/el.y from getBoundingClientRect already include the translation, so the region path handles positioning correctly. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/services/renderOrchestrator.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/producer/src/services/renderOrchestrator.ts b/packages/producer/src/services/renderOrchestrator.ts index e59ef581be..a30afde65b 100644 --- a/packages/producer/src/services/renderOrchestrator.ts +++ b/packages/producer/src/services/renderOrchestrator.ts @@ -578,22 +578,22 @@ function blitHdrVideoLayer( clipped = true; } - // 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 = !!( + // Detect translation-only matrix (no scale/rotation) — route through the + // region path which supports clip rects. Chrome reports a viewport matrix + // for all HDR elements, even untransformed ones or those with only layout + // translation (e.g. `left: 960px` → `matrix(1,0,0,1,960,0)`). The region + // blit handles translation via el.x/el.y, so we only need the affine path + // for actual scale/rotation transforms. + const isTranslationOnly = !!( 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 + Math.abs(viewportMatrix[3]! - 1) < 0.001 ); - if (viewportMatrix && !isIdentity) { + if (viewportMatrix && !isTranslationOnly) { if (clipped && log) { log.debug( `HDR clip rect on affine-transformed element ${el.id} — clip not applied (affine scissor not yet supported)`,