Backed out changeset 7d40106bafeb (bug 1442521) for various window sizing regressions. a=jcristau
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 26 Mar 2018 10:29:55 -0400
changeset 462833 270b317fe5c319adc9ed3ab24ed8e0e0cb15d73f
parent 462832 1635a57d13f60a4914dc3d5803c34a825eea48bf
child 462834 48151778db661b967db3f8e6ebca118752e0b203
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcristau
bugs1442521
milestone60.0
backs out7d40106bafebdd868ca7f6d188b5f0e30cb6f0e3
Backed out changeset 7d40106bafeb (bug 1442521) for various window sizing regressions. a=jcristau
toolkit/content/tests/chrome/test_screenPersistence.xul
xpfe/appshell/nsXULWindow.cpp
--- a/toolkit/content/tests/chrome/test_screenPersistence.xul
+++ b/toolkit/content/tests/chrome/test_screenPersistence.xul
@@ -39,18 +39,18 @@
   }
   function checkTest2() {
     let runTime = Cc["@mozilla.org/xre/app-info;1"]
                     .getService(Ci.nsIXULRuntime);
     if (runTime.OS != "Linux") {
       is(win.screenX, 80, "The window should be placed now at x=80px");
       is(win.screenY, 80, "The window should be placed now at y=80px");
     }
-    is(win.innerHeight, 300, "The window size should be height=300px");
-    is(win.innerWidth, 300, "The window size should be width=300px");
+    is(win.outerHeight, 300, "The window size should be height=300px");
+    is(win.outerWidth, 300, "The window size should be width=300px");
     win.close();
     SimpleTest.finish();
   }
 ]]></script>
 
 <body xmlns="http://www.w3.org/1999/xhtml">
 <p id="display">
 </p>
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -1059,55 +1059,37 @@ NS_IMETHODIMP nsXULWindow::ForceRoundedD
   SetPrimaryContentSize(targetContentWidth, targetContentHeight);
 
   mIgnoreXULSize = true;
   mIgnoreXULSizeMode = true;
 
   return NS_OK;
 }
 
-static LayoutDeviceIntSize
-GetWindowOuterInnerDiff(nsIWidget* aWindow)
-{
-  if (!aWindow) {
-    return LayoutDeviceIntSize();
-  }
-  LayoutDeviceIntSize baseSize(200, 200);
-  LayoutDeviceIntSize windowSize = aWindow->ClientToWindowSize(baseSize);
-  return windowSize - baseSize;
-}
-
 void nsXULWindow::OnChromeLoaded()
 {
   nsresult rv = EnsureContentTreeOwner();
 
   if (NS_SUCCEEDED(rv)) {
     mChromeLoaded = true;
     ApplyChromeFlags();
     SyncAttributesToWidget();
 
     int32_t specWidth = -1, specHeight = -1;
     bool gotSize = false;
     bool isContent = false;
 
     GetHasPrimaryContent(&isContent);
 
-    CSSIntSize windowDiff = mWindow
-      ? RoundedToInt(GetWindowOuterInnerDiff(mWindow) /
-                     mWindow->GetDefaultScale())
-      : CSSIntSize();
-
     // If this window has a primary content and fingerprinting resistance is
     // enabled, we enforce this window to rounded dimensions.
     if (isContent && nsContentUtils::ShouldResistFingerprinting()) {
       ForceRoundedDimensions();
     } else if (!mIgnoreXULSize) {
       gotSize = LoadSizeFromXUL(specWidth, specHeight);
-      specWidth += windowDiff.width;
-      specHeight += windowDiff.height;
     }
 
     bool 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.)
@@ -1136,18 +1118,18 @@ void nsXULWindow::OnChromeLoaded()
         docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
         if (treeOwner) {
           // GetContentSize can fail, so initialise |width| and |height| to be
           // on the safe side.
           int32_t width = 0, height = 0;
           if (NS_SUCCEEDED(cv->GetContentSize(&width, &height))) {
             treeOwner->SizeShellTo(docShellAsItem, width, height);
             // Update specified size for the final LoadPositionFromXUL call.
-            specWidth = width + windowDiff.width;
-            specHeight = height + windowDiff.height;
+            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) {
@@ -1671,30 +1653,27 @@ NS_IMETHODIMP nsXULWindow::SavePersisten
       if (shouldPersist) {
         IgnoredErrorResult err;
         ownerXULDoc->Persist(windowElementId, SCREENY_ATTRIBUTE, err);
       }
     }
   }
 
   if ((mPersistentAttributesDirty & PAD_SIZE) && gotRestoredBounds) {
-    LayoutDeviceIntSize winDiff = GetWindowOuterInnerDiff(mWindow);
     if (persistString.Find("width") >= 0) {
-      auto width = rect.Width() - winDiff.width;
-      SprintfLiteral(sizeBuf, "%d", NSToIntRound(width / sizeScale.scale));
+      SprintfLiteral(sizeBuf, "%d", NSToIntRound(rect.Width() / sizeScale.scale));
       CopyASCIItoUTF16(sizeBuf, sizeString);
       docShellElement->SetAttribute(WIDTH_ATTRIBUTE, sizeString, rv);
       if (shouldPersist) {
         IgnoredErrorResult err;
         ownerXULDoc->Persist(windowElementId, WIDTH_ATTRIBUTE, err);
       }
     }
     if (persistString.Find("height") >= 0) {
-      auto height = rect.Height() - winDiff.height;
-      SprintfLiteral(sizeBuf, "%d", NSToIntRound(height / sizeScale.scale));
+      SprintfLiteral(sizeBuf, "%d", NSToIntRound(rect.Height() / sizeScale.scale));
       CopyASCIItoUTF16(sizeBuf, sizeString);
       docShellElement->SetAttribute(HEIGHT_ATTRIBUTE, sizeString, rv);
       if (shouldPersist) {
         IgnoredErrorResult err;
         ownerXULDoc->Persist(windowElementId, HEIGHT_ATTRIBUTE, err);
       }
     }
   }