From 1d47c6c64b3da013d6e3c80821b22242de69a059 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Thu, 24 Mar 2016 17:08:19 +0000 Subject: [PATCH] Bug 1259492 - Ensure window position is constrained to the screen after it has been sized properly in nsXULWindow::OnChromeLoaded. r=emk a=ritu --- xpfe/appshell/nsXULWindow.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index 76e4909aa37..ffd8abae957 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -1080,16 +1080,20 @@ void nsXULWindow::OnChromeLoaded() int32_t width = 0, height = 0; if (NS_SUCCEEDED(cv->GetContentSize(&width, &height))) { treeOwner->SizeShellTo(docShellAsItem, width, height); - // Now that we know the window's final size, we can re-do its - // positioning so that it is properly constrained to the screen. - if (positionSet) { - LoadPositionFromXUL(width, height); - } + // Update specified size for the final LoadPositionFromXUL call. + specWidth = width; + specHeight = height; } } } } + // Now that we have set the window's final size, we can re-do its + // positioning so that it is properly constrained to the screen. + if (positionSet) { + LoadPositionFromXUL(specWidth, specHeight); + } + LoadMiscPersistentAttributesFromXUL(); if (mCenterAfterLoad && !positionSet) {