bug 794038 pt 0 - use the existing #defines for XUL window attribute names instead of repeating NS_LITERAL_STRING. r=roc
authorJonathan Kew <jkew@mozilla.com>
Tue, 16 Oct 2012 20:41:19 +0100
changeset 110581 a2a2ad2cfb501526bf5e0c60f9ce67dfd8c85c32
parent 110580 e7497bc33b3c2b25b2aa40e29f2973aeff012084
child 110582 5ec67c1dd2e1d5b737a60a8118034e40171dfc5b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersroc
bugs794038
milestone19.0a1
bug 794038 pt 0 - use the existing #defines for XUL window attribute names instead of repeating NS_LITERAL_STRING. r=roc
xpfe/appshell/src/nsXULWindow.cpp
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -1017,25 +1017,25 @@ bool nsXULWindow::LoadPositionFromXUL()
   GetPositionAndSize(&currX, &currY, &currWidth, &currHeight);
 
   // Obtain the position information from the <xul:window> element.
   int32_t specX = currX;
   int32_t specY = currY;
   nsAutoString posString;
   int32_t appPerDev = AppUnitsPerDevPixel();
 
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("screenX"), posString);
+  rv = windowElement->GetAttribute(SCREENX_ATTRIBUTE, posString);
   if (NS_SUCCEEDED(rv)) {
     temp = posString.ToInteger(&errorCode);
     if (NS_SUCCEEDED(errorCode)) {
       specX = CSSToDevPixels(temp, appPerDev);
       gotPosition = true;
     }
   }
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("screenY"), posString);
+  rv = windowElement->GetAttribute(SCREENY_ATTRIBUTE, posString);
   if (NS_SUCCEEDED(rv)) {
     temp = posString.ToInteger(&errorCode);
     if (NS_SUCCEEDED(errorCode)) {
       specY = CSSToDevPixels(temp, appPerDev);
       gotPosition = true;
     }
   }
     
@@ -1081,25 +1081,25 @@ bool nsXULWindow::LoadSizeFromXUL()
   GetSize(&currWidth, &currHeight);
 
   // Obtain the position and sizing information from the <xul:window> element.
   int32_t specWidth = currWidth;
   int32_t specHeight = currHeight;
   nsAutoString sizeString;
   int32_t appPerDev = AppUnitsPerDevPixel();
 
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("width"), sizeString);
+  rv = windowElement->GetAttribute(WIDTH_ATTRIBUTE, sizeString);
   if (NS_SUCCEEDED(rv)) {
     temp = sizeString.ToInteger(&errorCode);
     if (NS_SUCCEEDED(errorCode) && temp > 0) {
       specWidth = CSSToDevPixels(NS_MAX(temp, 100), appPerDev);
       gotSize = true;
     }
   }
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("height"), sizeString);
+  rv = windowElement->GetAttribute(HEIGHT_ATTRIBUTE, sizeString);
   if (NS_SUCCEEDED(rv)) {
     temp = sizeString.ToInteger(&errorCode);
     if (NS_SUCCEEDED(errorCode) && temp > 0) {
       specHeight = CSSToDevPixels(NS_MAX(temp, 100), appPerDev);
       gotSize = true;
     }
   }
 
@@ -1149,17 +1149,17 @@ bool nsXULWindow::LoadMiscPersistentAttr
     return false;
 
   nsCOMPtr<nsIDOMElement> windowElement = GetWindowDOMElement();
   NS_ENSURE_TRUE(windowElement, false);
 
   nsAutoString stateString;
 
   // sizemode
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("sizemode"), stateString);
+  rv = windowElement->GetAttribute(MODE_ATTRIBUTE, stateString);
   if (NS_SUCCEEDED(rv)) {
     int32_t sizeMode = nsSizeMode_Normal;
     /* ignore request to minimize, to not confuse novices
     if (stateString.Equals(SIZEMODE_MINIMIZED))
       sizeMode = nsSizeMode_Minimized;
     */
     if (!mIgnoreXULSizeMode &&
         (stateString.Equals(SIZEMODE_MAXIMIZED) || stateString.Equals(SIZEMODE_FULLSCREEN))) {
@@ -1197,17 +1197,17 @@ bool nsXULWindow::LoadMiscPersistentAttr
       ourWindow->SetFullScreen(true);
     } else {
       mWindow->SetSizeMode(sizeMode);
     }
     gotState = true;
   }
 
   // zlevel
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("zlevel"), stateString);
+  rv = windowElement->GetAttribute(ZLEVEL_ATTRIBUTE, stateString);
   if (NS_SUCCEEDED(rv) && stateString.Length() > 0) {
     nsresult errorCode;
     uint32_t zLevel = stateString.ToInteger(&errorCode);
     if (NS_SUCCEEDED(errorCode) && zLevel >= lowestZ && zLevel <= highestZ)
       SetZLevel(zLevel);
   }
 
   return gotState;
@@ -1360,17 +1360,17 @@ void nsXULWindow::SyncAttributesToWidget
   // "accelerated" attribute
   bool isAccelerated;
   rv = windowElement->HasAttribute(NS_LITERAL_STRING("accelerated"), &isAccelerated);
   if (NS_SUCCEEDED(rv)) {
     mWindow->SetAcceleratedRendering(isAccelerated);
   }
 
   // "windowtype" attribute
-  rv = windowElement->GetAttribute(NS_LITERAL_STRING("windowtype"), attr);
+  rv = windowElement->GetAttribute(WINDOWTYPE_ATTRIBUTE, attr);
   if (NS_SUCCEEDED(rv) && !attr.IsEmpty()) {
     mWindow->SetWindowClass(attr);
   }
 
   // "id" attribute for icon
   rv = windowElement->GetAttribute(NS_LITERAL_STRING("id"), attr);
   if (NS_FAILED(rv) || attr.IsEmpty()) {
     attr.AssignLiteral("default");