Bug 1448760 - Don't try to center window after load when the size mode is not normal. r=bz

MozReview-Commit-ID: Ainh34XuvFg

--HG--
extra : rebase_source : 034caa4085d7fd3836d3f3bf5fb3c7390dc785a7
This commit is contained in:
Xidorn Quan 2018-03-27 23:38:00 +11:00
parent e1ecaae43e
commit 2b0ae4061a
2 changed files with 9 additions and 1 deletions

View File

@ -96,6 +96,13 @@
await changeSizeMode(() => win.maximize());
win.close();
// Open a new window again with centerscreen which shouldn't revert
// the persisted sizemode.
win = openWindow("centerscreen");
await SimpleTest.promiseFocus(win);
checkWindow("when open with centerscreen", win, win.STATE_MAXIMIZED);
win.close();
// Linux doesn't seem to persist sizemode across opening window
// with specified size, so mark it expected fail for now.
let todo = navigator.platform.includes('Linux');

View File

@ -2357,7 +2357,8 @@ nsXULWindow::SizeShell()
LoadMiscPersistentAttributesFromXUL();
if (mChromeLoaded && mCenterAfterLoad && !positionSet) {
if (mChromeLoaded && mCenterAfterLoad && !positionSet &&
mWindow->SizeMode() == nsSizeMode_Normal) {
Center(parentWindow, parentWindow ? false : true, false);
}
}