Skip to content

fix: offscreen rendering with correct screen info. #49494

Closed
trop[bot] wants to merge 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-offscreen-rendering-with-correct-screen-info--1769111943271
Closed

fix: offscreen rendering with correct screen info. #49494
trop[bot] wants to merge 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-offscreen-rendering-with-correct-screen-info--1769111943271

Conversation

@trop

@trop trop Bot commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Backport of #48730

See that PR for details.

Notes:

  • Fixed a bug that cause offscreen rendering doesn't have valid screen info and unable to get valid result of related media queries.
  • Added webPreference.offscreen.deviceScaleFactor to allow user specify a value, instead of using user's primary display's value.

@trop trop Bot requested review from a team as code owners January 22, 2026 19:59
@trop trop Bot added 41-x-y backport This is a backport PR semver/minor backwards-compatible functionality labels Jan 22, 2026
@ckerr ckerr force-pushed the trop/41-x-y-bp-fix-offscreen-rendering-with-correct-screen-info--1769111943271 branch from 6977c7f to 0bb5475 Compare January 22, 2026 23:13
@jkleinsc jkleinsc force-pushed the trop/41-x-y-bp-fix-offscreen-rendering-with-correct-screen-info--1769111943271 branch from 0bb5475 to 3689f9a Compare February 2, 2026 19:34
clavin
clavin previously requested changes Feb 18, 2026

@clavin clavin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Breaking changes doc should be changed here & on main to be 41.0 instead of 42.0 if we land this backport. cc @reitowo 🙇

@reitowo

reitowo commented Feb 18, 2026

Copy link
Copy Markdown
Member

This patch didn't change the breaking change yet. The breaking change will be merged on main at another PR #49683. This still the old behavior so should be good.

@clavin

clavin commented Feb 18, 2026

Copy link
Copy Markdown
Member

I see! Sorry, I understand now. The breaking change was documented in this PR, but the actual breaking change lands separately. My bad 🙇

Co-authored-by: reito <reito@chromium.org>
@clavin clavin force-pushed the trop/41-x-y-bp-fix-offscreen-rendering-with-correct-screen-info--1769111943271 branch from 3689f9a to cd64d48 Compare February 18, 2026 18:48
@clavin clavin dismissed their stale review February 18, 2026 18:49

I was wrong

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Breaking changes should not be included as they do not apply to 41-x-y.

Comment thread docs/breaking-changes.md
Comment on lines +15 to +24
## Planned Breaking API Changes (42.0)

### Behavior Changed: Offscreen rendering will use `1.0` as default device scale factor.

Previously, OSR used the primary display's device scale factor for rendering, which made the output frame size vary across users.
Developers had to manually calculate the correct size using `screen.getPrimaryDisplay().scaleFactor`. We now provide an optional property
`webPreferences.offscreen.deviceScaleFactor` to specify a custom value when creating an OSR window. At first, if the property is not set, it defaults
to the primary display's scale factor (preserving the old behavior). Starting from Electron 42, the default will change to a constant value of `1.0`
for more consistent output sizes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These breaking changes should not be backported to 41-x-y because they do not apply to 41-x-y

@reitowo reitowo Feb 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These were decided to apply after 3 major versions at around 40 so I think it should be added to tell "Planned Breaking Change"? (as an early announcement)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since https://www.electronjs.org/docs/latest/breaking-changes pulls from main, the breaking change update really only needs to be present in main.

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PR needs to be rebased to fixup up conflicts

@reitowo reitowo closed this Mar 19, 2026
@reitowo

reitowo commented Mar 19, 2026

Copy link
Copy Markdown
Member

See #50375

@trop trop Bot deleted the trop/41-x-y-bp-fix-offscreen-rendering-with-correct-screen-info--1769111943271 branch March 19, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport/approved ✅ backport This is a backport PR semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants