File mozilla-bmo1998188.patch of Package thunderbird146
diff --git a/xpfe/appshell/AppWindow.cpp b/xpfe/appshell/AppWindow.cpp
index eba6c33224..9b5e7b5d3a 100644
--- a/xpfe/appshell/AppWindow.cpp
+++ b/xpfe/appshell/AppWindow.cpp
@@ -751,8 +751,8 @@ nsresult AppWindow::MoveResize(const Maybe<DesktopPoint>& aPosition,
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;
@@ -820,12 +820,20 @@ NS_IMETHODIMP AppWindow::Center(nsIAppWindow* aRelative, bool aScreen,
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::Repaint(bool aForce) {
// XXX First Check In
NS_ASSERTION(false, "Not Yet Implemented");
diff --git a/xpfe/appshell/AppWindow.h b/xpfe/appshell/AppWindow.h
index 6ffce77706..b29697fba4 100644
--- a/xpfe/appshell/AppWindow.h
+++ b/xpfe/appshell/AppWindow.h
@@ -374,6 +374,8 @@ class AppWindow final : public nsIBaseWindow,
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;
};