fix: fix aspect ratio when max width/height is set (#29101)
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.
This commit is contained in:
parent
c4ea33d1bf
commit
557e586667
3 changed files with 50 additions and 0 deletions
|
@ -952,6 +952,17 @@ describe('BrowserWindow module', () => {
|
|||
await resize;
|
||||
expectBoundsEqual(w.getSize(), size);
|
||||
});
|
||||
|
||||
it('doesn\'t change bounds when maximum size is set', () => {
|
||||
w.setMenu(null);
|
||||
w.setMaximumSize(400, 400);
|
||||
// Without https://github.com/electron/electron/pull/29101
|
||||
// following call would shrink the window to 384x361.
|
||||
// There would be also DCHECK in resize_utils.cc on
|
||||
// debug build.
|
||||
w.setAspectRatio(1.0);
|
||||
expectBoundsEqual(w.getSize(), [400, 400]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('BrowserWindow.setPosition(x, y)', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue