@@ -135,11 +135,10 @@ export async function pageScreenshotCapture(page: Page, options: CaptureOptions)
135135 format : isPng ? "png" : "jpeg" ,
136136 quality : isPng ? undefined : ( options . quality ?? 80 ) ,
137137 fromSurface : true ,
138- // The explicit clip rect constrains output to exact composition
139- // dimensions. The viewport-boundary pre-clip from captureBeyondViewport:
140- // false is redundant, and Chrome's compositor rounds it inward under
141- // multi-tab load — clipping the bottom/right edge of tall viewports.
142- captureBeyondViewport : true ,
138+ // Use Chrome's faster viewport-bound screenshot path by default. Callers
139+ // opt into the beyond-viewport path only for known compositor edge cases,
140+ // such as native video surfaces in tall portrait renders.
141+ captureBeyondViewport : options . captureBeyondViewport ?? false ,
143142 optimizeForSpeed : ! isPng ,
144143 clip,
145144 } ) ;
@@ -172,7 +171,8 @@ export async function captureScreenshotWithAlpha(
172171 const result = await client . send ( "Page.captureScreenshot" , {
173172 format : "png" ,
174173 fromSurface : true ,
175- captureBeyondViewport : true , // see pageScreenshotCapture for rationale
174+ // Preserve the #1094 tall-portrait edge-clipping guard on HDR alpha captures.
175+ captureBeyondViewport : true ,
176176 optimizeForSpeed : false , // `true` uses a zero-alpha-aware fast path that crushes real alpha values — observed empirically, CDP docs don't spell it out
177177 clip : { x : 0 , y : 0 , width, height, scale : 1 } ,
178178 } ) ;
@@ -237,7 +237,8 @@ export async function captureAlphaPng(page: Page, width: number, height: number)
237237 const result = await client . send ( "Page.captureScreenshot" , {
238238 format : "png" ,
239239 fromSurface : true ,
240- captureBeyondViewport : true , // see pageScreenshotCapture for rationale
240+ // Preserve the #1094 tall-portrait edge-clipping guard on HDR alpha captures.
241+ captureBeyondViewport : true ,
241242 optimizeForSpeed : false , // must be false to preserve alpha
242243 clip : { x : 0 , y : 0 , width, height, scale : 1 } ,
243244 } ) ;
0 commit comments