Repository navigation
Conversation
…nux-resizability-and-constraints
jkleinsc
left a comment
There was a problem hiding this comment.
These changes appear to have broken Windows testing
| SetContentSizeConstraints(old_size_constraints_); | ||
| SetSizeConstraints(old_size_constraints_); | ||
| } else { | ||
| old_size_constraints_ = GetContentSizeConstraints(); | ||
| gfx::Size content_size = GetContentSize(); | ||
| SetContentSizeConstraints( | ||
| extensions::SizeConstraints(content_size, content_size)); |
There was a problem hiding this comment.
@mitchchn why is this code no longer necessary on non Linux OSes?
There was a problem hiding this comment.
So leaving aside Mac because it doesn't use this class: the existing code makes a compromise that isn't accurate for Linux, and only works for Windows in a roundabout way.
Windows controls resizability with window styles (WS_THICKFRAME, WS_MAXIMIZEBOX). The code worked before because setting size constraints (to any value) triggers SizeConstraintsChanged in Chromium. That method does reapply window styles including resizability, but it doesn't depend on the actual constraint values changing or their state in this class.
Linux otoh does depend on the specific value of the size constraints and their cached state, but it needs to use window size constraints instead of content size otherwise some kinds of windows will shrink.
Another option is to bring the code back for Windows, but still change it to use window size constraints instead of content size This would fix Linux but still need to be tested on Windows. But it's a more conservative change if you'd rather I try it.
There was a problem hiding this comment.
Trying the less invasive approach: 2ddce9b. I also updated the test that guards against window size changes to cover Windows.
|
@mitchchn my main concern here is that logic that is currently running on all OSes has been removed/changed. Unless there's a good reason for these changes, I'd prefer that this PR just address the issue specifically for Linux. |
|
Release Notes Persisted
|
…are enforced (#49903) * fix window sizing on linux when constraints are applied * added tests * apply window style directly when changing resizability * Revert "apply window style directly when changing resizability" This reverts commit 949e2ee. * set size constraints for resizability on window and linux Co-authored-by: Mitchell Cohen <[email protected]>
|
I have automatically backported this PR to "41-x-y", please check out #49971 |
…are enforced (#49971) fix: correct window sizing on Linux when constraints on resizability are enforced (#49903) * fix window sizing on linux when constraints are applied * added tests * apply window style directly when changing resizability * Revert "apply window style directly when changing resizability" This reverts commit 949e2ee. * set size constraints for resizability on window and linux Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Mitchell Cohen <[email protected]>
Description of Change
Followup to #49835, which normalized bounds operations on Linux to use logical coordinates. That PR left two edge cases where windows could still draw at the wrong sizes if certain properties were set on the browser window:
Windows with max width and height constraints appeared smaller than they should be. This is because Chromium calls
GetMinimumSizeandGetMaximumSizedirectly and expects them to use widget's total coordinate space, not the logical max window size. To account for this, these methods need to inflate constraints by insets on Linux. This is now handled by the tree host for all Linux frame classes to keep this quirk away from the rest of the API.Setting
resizable: falsewas causing the window to grow taller on Linux in some configurations. I traced this down to a couple related issues insetResizable:I gated the Linux-specific logic and updated it to use window size constraints to prevent resizability, which is the right thing to do even if content size is in use. I also tested for resizability regressions on Windows with frame: true/false, thickFrame: true/false, and transparent: true/false.
(Note: On X11 or Wayland environments with SSD, the window manager draws the frame externally, so a framed window will still be taller than whatever height/max height is requested This is expected and not a bug introduced in this PR.)
Fixes #49902.
Checklist
npm testpassesRelease Notes
Notes: Fixed window sizing on Linux when min/max size constraints are set or
resizableisfalse. Windows no longer shrink below the requested max size or grow taller when resizability is disabled.