Closed Bug 1443392 Opened 2 years ago Closed 2 years ago

Window content is not resized when frame is changed but window is not resized

Categories

(Core :: Widget: Win32, enhancement, P1)

Unspecified
Windows
enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox60 --- wontfix
firefox61 --- fixed

People

(Reporter: xidorn, Assigned: xidorn)

References

Details

Attachments

(1 file)

See bug 1439875 comment 50 for the problem without correctly handling this.

According to the document of WINDOWPOS structure, when SWP_FRAMECHANGED flag is set, WM_NCCALCSIZE message is sent even if window's size is not changed. [1]

That indicates that, we may need to resize the window content in response to SWP_FRAMECHANGED even if SWP_NOSIZE flag is set, since Windows informs us that the window's client area must be calculated.

There seems to be multiple places where we may want to handle it:
* nsWindow::OnWindowPosChanged, call OnResize when SWP_FRAMECHANGED is set.
* nsWindow::OnWindowPosChanging, remove the check of no SWP_NOSIZE.
* nsWindow::ProcessMessage, call into either OnResize or UpdateNonClientMargins for WM_NCCALCSIZE when mCustomNonClient is false.

In my experiment with bug 1439875, I used the first approach, and it makes the test passes.

It is not clear to me whether we need to call into UpdateNonClientMargins in this case. The window style itself is probably not changing in this case, neither is size mode, so we probably don't need to update mNonClientOffset, which seems to be the only thing UpdateNonClientMargins is doing except a conditionally reflow.

Given this I guess it's fine to just call OnResize in this case, then...


[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms632612(v=vs.85).aspx
Depends on: 1443397
Hmmm... Probably need to figure out what's going on with test_popupSizeTo.xul and test_popupanchor.xul.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=748d6dbea927be8d04ccabab93e33249e0b8a634
Priority: -- → P1
Comment on attachment 8956347 [details]
Bug 1443392 - Send resize event when FRAMECHANGED flag is set even if the window isn't resized.

https://reviewboard.mozilla.org/r/225216/#review231660

windowing related events are a little crazy in Windows widget. Expect odd regressions from changes like this. You migth want to wait for 61 too.
Attachment #8956347 - Flags: review?(jmathies) → review+
OK, I'm going to land it on 61.
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e3dae8b7e2f2
Send resize event when FRAMECHANGED flag is set even if the window isn't resized. r=jimm
https://hg.mozilla.org/mozilla-central/rev/e3dae8b7e2f2
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.