Skip to content

feat: support device scale factor in --viewport#1141

Closed
Aalivexy wants to merge 2 commits intoChromeDevTools:mainfrom
Aalivexy:feat/cli-viewport-dpr
Closed

feat: support device scale factor in --viewport#1141
Aalivexy wants to merge 2 commits intoChromeDevTools:mainfrom
Aalivexy:feat/cli-viewport-dpr

Conversation

@Aalivexy
Copy link
Copy Markdown

@Aalivexy Aalivexy commented Mar 7, 2026

Summary

This PR updates the server CLI --viewport flag to reuse the existing viewport syntax used by emulation tools.

--viewport now accepts both:

  • 1280x720
  • 1280x720x2

When a device scale factor is provided, it is applied during browser startup in addition to the initial viewport size.

Changes

  • add CLI parsing support for <width>x<height>x<deviceScaleFactor>
  • preserve the existing <width>x<height> format
  • apply deviceScaleFactor during initial browser launch
  • update CLI documentation and examples
  • add tests for CLI parsing and browser launch behavior

reslove #1140

@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 7, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Aalivexy Aalivexy marked this pull request as ready for review March 7, 2026 16:13
@OrKoN
Copy link
Copy Markdown
Collaborator

OrKoN commented Apr 1, 2026

@Lightning00Blade could you please review?

Copy link
Copy Markdown
Collaborator

@Lightning00Blade Lightning00Blade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking the implementation - I think we can't use this approach as this set the ViewPort only for a single page, which will be reset upon navigation and some other cases as well.

A better approach would be to set the Chrome argument --force-device-scale-factor=X as that will force everything to scale with that factor accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants