#53810: fix: capture offscreen pages at the view's device scale factor
Merged
Created: Sep 10, 2026, 12:45:23 AM
Merged: Sep 10, 2026, 9:23:32 AM
5 comments
Target: main
Description of Change
capturePage() sized its bitmap from the nearest display's scale factor. Offscreen windows render at webPreferences.offscreen.deviceScaleFactor (default 1), so their captures were resampled whenever that differed from the display, e.g. a 1x frame upscaled to 2x on a Retina display.
- Size the capture from
view->GetDeviceScaleFactor(). Onscreen views already report the display's factor, so onscreen captures are unchanged. - Add a spec that captures an offscreen window at
deviceScaleFactor: 1.5.
Fixes #53675
Checklist
- PR description included
- I have built and tested this PR
-
npm testpasses - tests are changed or added
Release Notes
Notes: Fixed webContents.capturePage() on offscreen windows returning an image resampled to the display's scale factor instead of rendered at the window's offscreen.deviceScaleFactor.
Backports
45-x-y
MergedPR Number
#53817Merged At
Sep 10, 2026, 10:41:37 AM
Released In
v45.0.0-alpha.6Release Date
Sep 10, 2026, 3:00:16 PM
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron