electron/electron

[Bug]: Electron setContentBounds / setContentSize doesn't work

brondibur opened this issue · 3 comments

Preflight Checklist

Electron Version

30.0.4

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.4.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

setContentBounds / setContentSize resize the contents relative to the window.

Actual Behavior

setContentBounds / setContentSize actually behave like setBounds and set the bounds of the entire window instead of the contents within it.

Testcase Gist URL

https://gist.github.com/brondibur/f063baec603e95a206a3e69afafd32a1

Additional Information

In the Fiddle Gist, setContentBounds({ x: 10, y: 10, width: 400, height: 300 }) should set the contents as 400x300 originating from (10, 10) within the 800x600 window, whereas it converts the BrowserWindow to 400x300 that originates from (10, 10) of the screen.
Same goes for setContentSize

Hi @codebytere

Bug reports for this issue have been incorrectly closed multiple times (#41665, #33969, #23758).

Can you please take a look?

This unfortunately has never worked as you expect - we should probably reclassify this as a feature request or otherwise decide what to do with those functions.