Bug 1446264 part 3 - Allow window to show earlier when sizemode is changed before window turned visible. r?jimm
This would show a blank window at an earlier time before other stuff are
ready. It saves us from an extra resize reflow which otherwise would
happen because the window is resized only when it's shown.
MozReview-Commit-ID: CNH6rpMmkYW
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -2087,46 +2087,48 @@ nsWindow::SetSizeMode(nsSizeMode aMode)
// (This is needed to prevent problems when calling window.minimize(), which
// calls us directly, and then the OS triggers another call to us.)
if (aMode == mSizeMode)
return;
// save the requested state
mLastSizeMode = mSizeMode;
nsBaseWidget::SetSizeMode(aMode);
+
+ int mode;
+ switch (aMode) {
+ case nsSizeMode_Fullscreen :
+ mode = SW_SHOW;
+ break;
+
+ case nsSizeMode_Maximized :
+ mode = SW_MAXIMIZE;
+ break;
+
+ case nsSizeMode_Minimized :
+ mode = SW_MINIMIZE;
+ break;
+
+ default :
+ mode = SW_RESTORE;
+ }
+
+ // Don't call ::ShowWindow if we're trying to "restore" a window that is
+ // already in a normal state. Prevents a bug where snapping to one side
+ // of the screen and then minimizing would cause Windows to forget our
+ // window's correct restored position/size.
+ if(!(GetCurrentShowCmd(mWnd) == SW_SHOWNORMAL && mode == SW_RESTORE)) {
+ ::ShowWindow(mWnd, mode);
+ }
+
if (mIsVisible) {
- int mode;
-
- switch (aMode) {
- case nsSizeMode_Fullscreen :
- mode = SW_SHOW;
- break;
-
- case nsSizeMode_Maximized :
- mode = SW_MAXIMIZE;
- break;
-
- case nsSizeMode_Minimized :
- mode = SW_MINIMIZE;
- break;
-
- default :
- mode = SW_RESTORE;
- }
-
- // Don't call ::ShowWindow if we're trying to "restore" a window that is
- // already in a normal state. Prevents a bug where snapping to one side
- // of the screen and then minimizing would cause Windows to forget our
- // window's correct restored position/size.
- if(!(GetCurrentShowCmd(mWnd) == SW_SHOWNORMAL && mode == SW_RESTORE)) {
- ::ShowWindow(mWnd, mode);
- }
// we activate here to ensure that the right child window is focused
- if (mode == SW_MAXIMIZE || mode == SW_SHOW)
+ if (mode == SW_MAXIMIZE || mode == SW_SHOW) {
DispatchFocusToTopLevelWindow(true);
+ }
}
}
void
nsWindow::SuppressAnimation(bool aSuppress)
{
DWORD dwAttribute = aSuppress ? TRUE : FALSE;
DwmSetWindowAttribute(mWnd, DWMWA_TRANSITIONS_FORCEDISABLED,