chore: enable dpr for bidi (#11319)
This commit is contained in:
parent
2e4ddb82d3
commit
5b8c6cb1fc
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import type {Viewport} from '../common/Viewport.js';
|
||||||
|
|
||||||
import type {BrowsingContext} from './BrowsingContext.js';
|
import type {BrowsingContext} from './BrowsingContext.js';
|
||||||
|
|
||||||
@ -27,12 +27,19 @@ export class EmulationManager {
|
|||||||
this.#browsingContext = browsingContext;
|
this.#browsingContext = browsingContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
async emulateViewport(
|
async emulateViewport(viewport: Viewport): Promise<void> {
|
||||||
viewport: Bidi.BrowsingContext.Viewport
|
|
||||||
): Promise<void> {
|
|
||||||
await this.#browsingContext.connection.send('browsingContext.setViewport', {
|
await this.#browsingContext.connection.send('browsingContext.setViewport', {
|
||||||
context: this.#browsingContext.id,
|
context: this.#browsingContext.id,
|
||||||
viewport,
|
viewport:
|
||||||
|
viewport.width && viewport.height
|
||||||
|
? {
|
||||||
|
width: viewport.width,
|
||||||
|
height: viewport.height,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
devicePixelRatio: viewport.deviceScaleFactor
|
||||||
|
? viewport.deviceScaleFactor
|
||||||
|
: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user