Backed out changeset 2fbc5d0584e4 (bug 1211344)
authorWes Kocher <wkocher@mozilla.com>
Tue, 13 Oct 2015 18:35:49 -0700
changeset 606997 6ee2ce4e485f5ffcebd2573531cabe9d08c16b25
parent 606996 ac129c8e6dfbdc727076c6117b9a28787e86f09e
child 606998 38cffa3439e4820205978f3218e087b122a95048
push id93006
push userjyavenard@mozilla.com
push dateThu, 15 Oct 2015 05:15:33 +0000
treeherdertry@45ea2a01301e [default view] [failures only]
bugs1211344
milestone43.0a2
backs out2fbc5d0584e4797a21b232a26f95f0fc3bceca04
Backed out changeset 2fbc5d0584e4 (bug 1211344)
xpfe/appshell/nsXULWindow.cpp
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -1437,19 +1437,16 @@ void nsXULWindow::SaveAttributes()
     return;
   }
 
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   if (!docShellElement) {
     return;
   }
 
-  nsAutoString persistString;
-  docShellElement->GetAttribute(PERSIST_ATTRIBUTE, persistString);
-
   // get our size, position and mode to persist
   nsIntRect rect;
   bool gotRestoredBounds = NS_SUCCEEDED(mWindow->GetRestoredBounds(rect));
 
   CSSToLayoutDeviceScale scale = mWindow->GetDefaultScale();
 
   // make our position relative to our parent, if any
   nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
@@ -1462,62 +1459,55 @@ void nsXULWindow::SaveAttributes()
   }
 
   char                        sizeBuf[10];
   nsAutoString                sizeString;
 
   ErrorResult rv;
   // (only for size elements which are persisted)
   if ((mPersistentAttributesDirty & PAD_POSITION) && gotRestoredBounds) {
-    if (persistString.Find("screenX") >= 0) {
-      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.x / scale.scale));
-      sizeString.AssignWithConversion(sizeBuf);
-      docShellElement->SetAttribute(SCREENX_ATTRIBUTE, sizeString, rv);
-    }
-    if (persistString.Find("screenY") >= 0) {
-      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.y / scale.scale));
-      sizeString.AssignWithConversion(sizeBuf);
-      docShellElement->SetAttribute(SCREENY_ATTRIBUTE, sizeString, rv);
-    }
+    PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.x / scale.scale));
+    sizeString.AssignWithConversion(sizeBuf);
+    docShellElement->SetAttribute(SCREENX_ATTRIBUTE, sizeString, rv);
+
+    PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.y / scale.scale));
+    sizeString.AssignWithConversion(sizeBuf);
+    docShellElement->SetAttribute(SCREENY_ATTRIBUTE, sizeString, rv);
   }
 
   if ((mPersistentAttributesDirty & PAD_SIZE) && gotRestoredBounds) {
-    if (persistString.Find("width") >= 0) {
-      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.width / scale.scale));
-      sizeString.AssignWithConversion(sizeBuf);
-      docShellElement->SetAttribute(WIDTH_ATTRIBUTE, sizeString, rv);
-    }
-    if (persistString.Find("height") >= 0) {
-      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.height / scale.scale));
-      sizeString.AssignWithConversion(sizeBuf);
-      docShellElement->SetAttribute(HEIGHT_ATTRIBUTE, sizeString, rv);
-    }
+    PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.width / scale.scale));
+    sizeString.AssignWithConversion(sizeBuf);
+    docShellElement->SetAttribute(WIDTH_ATTRIBUTE, sizeString, rv);
+
+    PR_snprintf(sizeBuf, sizeof(sizeBuf), "%d", NSToIntRound(rect.height / scale.scale));
+    sizeString.AssignWithConversion(sizeBuf);
+    docShellElement->SetAttribute(HEIGHT_ATTRIBUTE, sizeString, rv);
   }
 
   if (mPersistentAttributesDirty & PAD_MISC) {
     nsSizeMode sizeMode = mWindow->SizeMode();
 
     if (sizeMode != nsSizeMode_Minimized) {
       if (sizeMode == nsSizeMode_Maximized)
         sizeString.Assign(SIZEMODE_MAXIMIZED);
       else if (sizeMode == nsSizeMode_Fullscreen)
         sizeString.Assign(SIZEMODE_FULLSCREEN);
       else
         sizeString.Assign(SIZEMODE_NORMAL);
       docShellElement->SetAttribute(MODE_ATTRIBUTE, sizeString, rv);
     }
-    if (persistString.Find("zlevel") >= 0) {
-      uint32_t zLevel;
-      nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
-      if (mediator) {
-        mediator->GetZLevel(this, &zLevel);
-        PR_snprintf(sizeBuf, sizeof(sizeBuf), "%lu", (unsigned long)zLevel);
-        sizeString.AssignWithConversion(sizeBuf);
-        docShellElement->SetAttribute(ZLEVEL_ATTRIBUTE, sizeString, rv);
-      }
+
+    uint32_t zLevel;
+    nsCOMPtr<nsIWindowMediator> mediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
+    if (mediator) {
+      mediator->GetZLevel(this, &zLevel);
+      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%lu", (unsigned long)zLevel);
+      sizeString.AssignWithConversion(sizeBuf);
+      docShellElement->SetAttribute(ZLEVEL_ATTRIBUTE, sizeString, rv);
     }
   }
 
   mPersistentAttributesDirty = 0;
 }
 
 NS_IMETHODIMP nsXULWindow::GetWindowDOMWindow(nsIDOMWindow** aDOMWindow)
 {