Skip to content

Commit

Permalink
chore: enable dpr for bidi (#11319)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Nov 8, 2023
1 parent 2e4ddb8 commit 5b8c6cb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/puppeteer-core/src/bidi/EmulationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* 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';

Expand All @@ -27,12 +27,19 @@ export class EmulationManager {
this.#browsingContext = browsingContext;
}

async emulateViewport(
viewport: Bidi.BrowsingContext.Viewport
): Promise<void> {
async emulateViewport(viewport: Viewport): Promise<void> {
await this.#browsingContext.connection.send('browsingContext.setViewport', {
context: this.#browsingContext.id,
viewport,
viewport:
viewport.width && viewport.height
? {
width: viewport.width,
height: viewport.height,
}
: null,
devicePixelRatio: viewport.deviceScaleFactor
? viewport.deviceScaleFactor
: null,
});
}
}

0 comments on commit 5b8c6cb

Please sign in to comment.