Bug 1443392 - Send resize event when FRAMECHANGED flag is set even if the window isn't resized. r?jimm
MozReview-Commit-ID: 9wpiFr9Tw9c
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6786,21 +6786,34 @@ void nsWindow::OnWindowPosChanged(WINDOW
// If a maximized window is resized, recalculate the non-client margins.
if (mSizeMode == nsSizeMode_Maximized) {
if (UpdateNonClientMargins(nsSizeMode_Maximized, true)) {
// gecko resize event already sent by UpdateNonClientMargins.
return;
}
}
-
- // Recalculate the width and height based on the client area for gecko events.
- LayoutDeviceIntSize clientSize(newWidth, newHeight);
+ }
+
+ // Notify the widget listener for size change of client area for gecko
+ // events. This needs to be done when either window size is changed,
+ // or window frame is changed. They may not happen together.
+ // However, we don't invoke that for popup when window frame changes,
+ // because popups may trigger frame change before size change via
+ // {Set,Clear}ThemeRegion they invoke in Resize. That would make the
+ // code below call OnResize with a wrong client size first, which can
+ // lead to flickerling for some popups.
+ if (!(wp->flags & SWP_NOSIZE) ||
+ ((wp->flags & SWP_FRAMECHANGED) && !IsPopup())) {
+ RECT r;
+ LayoutDeviceIntSize clientSize;
if (::GetClientRect(mWnd, &r)) {
clientSize = WinUtils::ToIntRect(r).Size();
+ } else {
+ clientSize = mBounds.Size();
}
// Send a gecko resize event
OnResize(clientSize);
}
}
void nsWindow::OnWindowPosChanging(LPWINDOWPOS& info)
{