@@ -588,11 +588,13 @@ export class CdpTarget {
588588 viewport : BrowsingContext . Viewport | null ,
589589 devicePixelRatio : number | null ,
590590 screenOrientation : Emulation . ScreenOrientation | null ,
591+ screenArea : Emulation . ScreenArea | null ,
591592 ) {
592593 if (
593594 viewport === null &&
594595 devicePixelRatio === null &&
595- screenOrientation === null
596+ screenOrientation === null &&
597+ screenArea === null
596598 ) {
597599 await this . cdpClient . sendCommand ( 'Emulation.clearDeviceMetricsOverride' ) ;
598600 return ;
@@ -606,6 +608,8 @@ export class CdpTarget {
606608 screenOrientation :
607609 this . #toCdpScreenOrientationAngle( screenOrientation ) ?? undefined ,
608610 mobile : false ,
611+ screenWidth : screenArea ?. width ,
612+ screenHeight : screenArea ?. height ,
609613 } ;
610614
611615 await this . cdpClient . sendCommand (
@@ -637,13 +641,15 @@ export class CdpTarget {
637641 if (
638642 config . viewport !== undefined ||
639643 config . devicePixelRatio !== undefined ||
640- config . screenOrientation !== undefined
644+ config . screenOrientation !== undefined ||
645+ config . screenArea !== undefined
641646 ) {
642647 promises . push (
643648 this . setDeviceMetricsOverride (
644649 config . viewport ?? null ,
645650 config . devicePixelRatio ?? null ,
646651 config . screenOrientation ?? null ,
652+ config . screenArea ?? null ,
647653 ) . catch ( ( ) => {
648654 // Ignore CDP errors, as the command is not supported by iframe targets. Generic
649655 // catch, as the error can vary between CdpClient implementations: Tab vs
0 commit comments