Bug 574690 - Reorder size and position events in nsXULWindow so windows are positioned before they are shown. r=bz, r=neil
authorJim Mathies <jmathies@mozilla.com>
Thu, 15 Jul 2010 22:39:31 -0500
changeset 47785 7124132f0506
parent 47784 aba8cc27fcef
child 47786 574de87782f9
child 55864 a9e92cabc714
push id14418
push userjmathies@mozilla.com
push dateFri, 16 Jul 2010 03:40:19 +0000
treeherdermozilla-central@7124132f0506 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, neil
bugs574690
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 574690 - Reorder size and position events in nsXULWindow so windows are positioned before they are shown. r=bz, r=neil
xpfe/appshell/src/nsXULWindow.cpp
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -989,38 +989,41 @@ NS_IMETHODIMP nsXULWindow::EnsureAuthPro
 void nsXULWindow::OnChromeLoaded()
 {
   nsresult rv = EnsureContentTreeOwner();
 
   if (NS_SUCCEEDED(rv)) {
     mChromeLoaded = PR_TRUE;
     ApplyChromeFlags();
     SyncAttributesToWidget();
-    if (!mIgnoreXULSize)
-      LoadSizeFromXUL();
-    if (mIntrinsicallySized) {
-      // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false)
-      nsCOMPtr<nsIContentViewer> cv;
-      mDocShell->GetContentViewer(getter_AddRefs(cv));
-      nsCOMPtr<nsIMarkupDocumentViewer> markupViewer(do_QueryInterface(cv));
-      if (markupViewer)
-        markupViewer->SizeToContent();
-    }
 
     PRBool positionSet = !mIgnoreXULPosition;
     nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
     // don't override WM placement on unix for independent, top-level windows
     // (however, we think the benefits of intelligent dependent window placement
     // trump that override.)
     if (!parentWindow)
       positionSet = PR_FALSE;
 #endif
     if (positionSet)
       positionSet = LoadPositionFromXUL();
+
+    if (!mIgnoreXULSize)
+      LoadSizeFromXUL();
+
+    if (mIntrinsicallySized) {
+      // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false)
+      nsCOMPtr<nsIContentViewer> cv;
+      mDocShell->GetContentViewer(getter_AddRefs(cv));
+      nsCOMPtr<nsIMarkupDocumentViewer> markupViewer(do_QueryInterface(cv));
+      if (markupViewer)
+        markupViewer->SizeToContent();
+    }
+
     LoadMiscPersistentAttributesFromXUL();
 
     if (mCenterAfterLoad && !positionSet)
       Center(parentWindow, parentWindow ? PR_FALSE : PR_TRUE, PR_FALSE);
 
     if (mShowAfterLoad) {
       SetVisibility(PR_TRUE);
       // At this point the window may have been closed during Show(), so
@@ -1163,17 +1166,17 @@ PRBool nsXULWindow::LoadSizeFromXUL()
           specWidth = screenWidth;
         if (specHeight > screenHeight)
           specHeight = screenHeight;
       }
     }
 
     mIntrinsicallySized = PR_FALSE;
     if (specWidth != currWidth || specHeight != currHeight)
-      SetSize(specWidth, specHeight, PR_FALSE);
+      SetSize(specWidth, specHeight, PR_TRUE);
   }
 
   return gotSize;
 }
 
 /* Miscellaneous persistent attributes are attributes named in the
    |persist| attribute, other than size and position. Those are special
    because it's important to load those before one of the misc