Closed Bug 1756621 Opened 2 years ago Closed 2 years ago

Cleanup Win32 nsWindow size mode logic

Categories

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

All
Windows
enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: cmartin, Assigned: cmartin)

Details

Attachments

(7 files)

The logic of the Win32 nsWindow mSizeMode is rather difficult to follow, as it goes through a bit of a maze of code, is touched by Win32 API callbacks after it is set, etc. As a result, there are likely subtle bugs and other hard-to-reason-about behavior, and maintainability also suffers.

Let's try and refactor this code a bit to pull mSizeMode and others into some objects and try to enforce some variants around them so we can more easily reason about this code.

Keywords: leave-open
Pushed by cmartin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7a5554703a48
Allow nsBaseWidget::mBorderStyle to be set via constructor r=handyman

It looks like it was added to abstract commonalities between Win32 and
WinRT. But we dropped support for WinRT a long time ago, and there hasn't been
any work on this area of code in 8 years. In the meantime, it just adds an
extra layer of indirection that doesn't need to exist.

As a first step to making this code easier to understand, we pull the members
into a smaller class with a limited API to reduce their scope.

I will move all these new methods together in the next changelist -- It just
makes review difficult if everything is moving and changing at the same time.

This is just a copy/paste change

Now that the code has been restructured, let's simplify some of the methods
by propagating constants and removing redundant logic

Pushed by cmartin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/53be97731374
Encapsulate Win32 nsWindow size mode members r=handyman
https://hg.mozilla.org/integration/autoland/rev/e08c65b89343
Move new Win32 nsWindow::FrameState functions r=handyman
https://hg.mozilla.org/integration/autoland/rev/832276c12c9c
Cleanup nsWindow::FrameState code r=handyman
https://hg.mozilla.org/integration/autoland/rev/c9dad72c910f
Add CheckInvariantWrapper to nsWindow and use for FrameState r=handyman

Chris, do you intend to land more patches as part of this bug, or can the leave-open keyword be removed and this bug be closed?

Flags: needinfo?(cmartin)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(cmartin)
Resolution: --- → FIXED
Keywords: leave-open
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: