File mozilla-bmo1998188.patch of Package MozillaFirefox
diff --git a/xpfe/appshell/AppWindow.h b/xpfe/appshell/AppWindow.h
--- a/xpfe/appshell/AppWindow.h
+++ b/xpfe/appshell/AppWindow.h
@@ -374,10 +374,13 @@
int32_t shellItemWidth, int32_t shellItemHeight);
nsresult MoveResize(const Maybe<LayoutDeviceIntPoint>& aPosition,
const Maybe<LayoutDeviceIntSize>& aSize, bool aRepaint);
nsresult MoveResize(const Maybe<DesktopPoint>& aPosition,
const Maybe<DesktopSize>& aSize, bool aRepaint);
+ nsresult CenterImpl(nsIAppWindow* aRelative, bool aScreen, bool aAlert,
+ bool aAllowCenteringForSizeChange);
+
nsCOMPtr<nsIXULStore> mLocalStore;
bool mIsWidgetInFullscreen = false;
};
} // namespace mozilla
diff --git a/xpfe/appshell/AppWindow.cpp b/xpfe/appshell/AppWindow.cpp
--- a/xpfe/appshell/AppWindow.cpp
+++ b/xpfe/appshell/AppWindow.cpp
@@ -743,12 +743,12 @@
PersistentAttributesDirty(dirtyAttributes, Sync);
return NS_OK;
}
-NS_IMETHODIMP AppWindow::Center(nsIAppWindow* aRelative, bool aScreen,
- bool aAlert) {
+nsresult AppWindow::CenterImpl(nsIAppWindow* aRelative, bool aScreen,
+ bool aAlert, bool aAllowCenteringForSizeChange) {
DesktopIntRect rect;
bool screenCoordinates = false, windowCoordinates = false;
nsresult result;
if (!mChromeLoaded) {
@@ -812,16 +812,24 @@
}
SetPositionDesktopPix(newPos.x, newPos.y);
// If moving the window caused it to change size, re-do the centering.
- if (GetSize() != ourDevSize) {
- return Center(aRelative, aScreen, aAlert);
+ // Allow only one recursion here.
+ if (GetSize() != ourDevSize && aAllowCenteringForSizeChange) {
+ return CenterImpl(aRelative, aScreen, aAlert,
+ /* aAllowCenteringForSizeChange */ false);
}
return NS_OK;
}
+NS_IMETHODIMP AppWindow::Center(nsIAppWindow* aRelative, bool aScreen,
+ bool aAlert) {
+ return CenterImpl(aRelative, aScreen, aAlert,
+ /* aAllowCenteringForSizeChange */ true);
+}
+
NS_IMETHODIMP AppWindow::GetParentWidget(nsIWidget** aParentWidget) {
NS_ENSURE_ARG_POINTER(aParentWidget);
NS_ENSURE_STATE(mWindow);
NS_IF_ADDREF(*aParentWidget = mWindow->GetParent());