Bug 1447056: Don't poorly try to optimize out resizes from OnChromeLoaded. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 22 Mar 2018 17:24:39 +0100
changeset 771159 81242a775ed5f028e78fbc94945eb3f30be88361
parent 771158 692c5b38174de76e54f584f410e990d3b05ccd28
push id103589
push userbmo:emilio@crisal.io
push dateThu, 22 Mar 2018 16:29:51 +0000
reviewersxidorn
bugs1447056, 1447292, 1446264
milestone61.0a1
Bug 1447056: Don't poorly try to optimize out resizes from OnChromeLoaded. r?xidorn The curSize stuff doesn't account for constraints that can be set during layout, so if the window is sized to the same specified size, we'd avoid calling SetSize, which prevents the constraining from happening. This is the cross-platform fix equivalent to bug 1447292, in practice. Note that this depends on bug 1446264 part 5, which I'll land before this. MozReview-Commit-ID: GdKqgttnTfU
xpfe/appshell/nsXULWindow.cpp
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -1297,28 +1297,22 @@ nsXULWindow::SetSpecifiedSize(int32_t aS
     }
     if (aSpecHeight > screenHeight) {
       aSpecHeight = screenHeight;
     }
   }
 
   NS_ASSERTION(mWindow, "we expected to have a window already");
 
-  int32_t currWidth = 0;
-  int32_t currHeight = 0;
-  GetSize(&currWidth, &currHeight); // returns device pixels
-
   // convert specified values to device pixels, and resize if needed
   double cssToDevPx = mWindow ? mWindow->GetDefaultScale().scale : 1.0;
   aSpecWidth = NSToIntRound(aSpecWidth * cssToDevPx);
   aSpecHeight = NSToIntRound(aSpecHeight * cssToDevPx);
   mIntrinsicallySized = false;
-  if (aSpecWidth != currWidth || aSpecHeight != currHeight) {
-    SetSize(aSpecWidth, aSpecHeight, false);
-  }
+  SetSize(aSpecWidth, aSpecHeight, false);
 }
 
 /* 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
    attributes (sizemode) and they require extra processing. */
 bool nsXULWindow::LoadMiscPersistentAttributesFromXUL()
 {