chore(chromium): small improvement with updating touch (#1659)
This commit is contained in:
parent
fc73d54039
commit
f216ab98e7
|
|
@ -145,7 +145,9 @@ export class CRPage implements PageDelegate {
|
||||||
if (options.ignoreHTTPSErrors)
|
if (options.ignoreHTTPSErrors)
|
||||||
promises.push(this._client.send('Security.setIgnoreCertificateErrors', { ignore: true }));
|
promises.push(this._client.send('Security.setIgnoreCertificateErrors', { ignore: true }));
|
||||||
if (options.viewport)
|
if (options.viewport)
|
||||||
promises.push(this._updateViewport(true /* updateTouch */));
|
promises.push(this._updateViewport());
|
||||||
|
if (options.hasTouch)
|
||||||
|
promises.push(this._client.send('Emulation.setTouchEmulationEnabled', { enabled: true }));
|
||||||
if (options.javaScriptEnabled === false)
|
if (options.javaScriptEnabled === false)
|
||||||
promises.push(this._client.send('Emulation.setScriptExecutionDisabled', { value: true }));
|
promises.push(this._client.send('Emulation.setScriptExecutionDisabled', { value: true }));
|
||||||
if (options.userAgent || options.locale)
|
if (options.userAgent || options.locale)
|
||||||
|
|
@ -378,10 +380,10 @@ export class CRPage implements PageDelegate {
|
||||||
|
|
||||||
async setViewportSize(viewportSize: types.Size): Promise<void> {
|
async setViewportSize(viewportSize: types.Size): Promise<void> {
|
||||||
assert(this._page._state.viewportSize === viewportSize);
|
assert(this._page._state.viewportSize === viewportSize);
|
||||||
await this._updateViewport(false /* updateTouch */);
|
await this._updateViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
async _updateViewport(updateTouch: boolean): Promise<void> {
|
async _updateViewport(): Promise<void> {
|
||||||
const options = this._browserContext._options;
|
const options = this._browserContext._options;
|
||||||
let viewport = options.viewport || { width: 0, height: 0 };
|
let viewport = options.viewport || { width: 0, height: 0 };
|
||||||
const viewportSize = this._page._state.viewportSize;
|
const viewportSize = this._page._state.viewportSize;
|
||||||
|
|
@ -399,8 +401,6 @@ export class CRPage implements PageDelegate {
|
||||||
screenOrientation: isLandscape ? { angle: 90, type: 'landscapePrimary' } : { angle: 0, type: 'portraitPrimary' },
|
screenOrientation: isLandscape ? { angle: 90, type: 'landscapePrimary' } : { angle: 0, type: 'portraitPrimary' },
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
if (updateTouch)
|
|
||||||
promises.push(this._client.send('Emulation.setTouchEmulationEnabled', { enabled: !!options.hasTouch }));
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue