New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: aspect ratio when max width/height is set #29101
Conversation
7e2438f
to
bb5f6aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the patch itself is good, can you also try to upstream this patch to Chromium?
This PR requires review from @electron/wg-upgrades.
I'll try. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch is pretty small and self-contained, but there are no tests. We periodically sweep our patch list and remove patches that don't cause tests to fail when deleted, so this would be liable to be removed without a test.
@nornagon it would be hard (if possible) to create test for it as current testing environment does't allow to perform user initiated window resize (i.e. resize with mouse and window's edge). It would require browser test functionality and generating winapi events WM_SIZING. |
I was trying to get a repro on clean chromium to be able to upstream the fix to them. Unfortunately the only use case in chromium which uses this code (at least the only one I was able to find) is html5 video's pip: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/requestPictureInPicture. The problem is that this window is frameless so its content size is equal to its window size and check which I added is not needed for such case (it also wouldn't break anything but we won't be able to get a repro). |
I've just checked that I should be able to create spec test for it. I'll handle it tomorrow and I'all also rebase the changes to the newest main. |
Add the native frame border size to the minimum and maximum size if the view reports its size as the client size. It allows to enlarge window to proper values when aspect ratio and max width/height are set. It also fixes DCHECK which was triggered when user tried to enlarge window above dimensions set during creation of the BrowserWindow.
39a825b
to
0b0394d
Compare
I've pushed branch rebased to the newest main. I've also added a test. |
Test has been added and I think this PR should be ready to go, we still need approval from @electron/wg-upgrades. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM since it now addresses #29101 (review)
Release Notes Persisted
|
I have automatically backported this PR to "14-x-y", please check out #31955 |
I have automatically backported this PR to "15-x-y", please check out #31956 |
I have automatically backported this PR to "16-x-y", please check out #31957 |
I have automatically backported this PR to "17-x-y", please check out #31958 |
Add the native frame border size to the minimum and maximum size if the view reports its size as the client size. It allows to enlarge window to proper values when aspect ratio and max width/height are set. It also fixes DCHECK which was triggered when user tried to enlarge window above dimensions set during creation of the BrowserWindow.
Add the native frame border size to the minimum and maximum size if
the view reports its size as the client size. It allows to enlarge
window to proper values when aspect ratio and max width/height are
set. It also fixes DCHECK which was triggered when user tried to
enlarge window above dimensions set during creation of the
BrowserWindow.
Fixes #29100
Description of Change
Checklist
npm test
passesRelease Notes
Notes: fixed respecting aspect ratio when maximum size is set on BrowserWindow