Skip to content

[Bug]: maximum size isn't respected correctly when aspect ratio is enabled #29100

@CezaryKulakowski

Description

@CezaryKulakowski

Preflight Checklist

Electron Version

14.0.0-nightly.20210507

What operating system are you using?

Windows

Operating System Version

Windows 10

What arch are you using?

x64

Last Known Working Electron version

don't know

Steps to reproduce

  1. Launch following application:
const { app, BrowserWindow } = require('electron')

function startTest() {
  let win = new BrowserWindow({
    width: 200,
    height: 200,
    minWidth: 100,
    maxWidth: 300,
    minHeight: 100,
    maxHeight:300
  });
  win.webContents.loadURL('https://www.example.com');
  win.setAspectRatio(1.0);
}

app.on('ready', startTest)
  1. Resize window to maximum size.

Expected Behavior

Maximum size is correctly respected also when aspect ratio is enabled.

Actual Behavior

It's not possible to resize window to maximum size. Also aspect ratio is not respected (width != height). Additionally there is a DCHECK in Testing build:

[24772:0511/131301.276:FATAL:resize_utils.cc(44)] Check failed: Rect(rect->origin(), max_window_size).Contains(*rect). 860,420 256x250 is larger than the maximum size 284x241

Testcase Gist URL

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions