system-metrics-comarray
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 153 cd96178a2e472dc6cd10443a56a3cedf9e8e1140
permissions -rw-r--r--
State as of now

* * *

diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -82,7 +82,7 @@
 #include "nsContentUtils.h"
 
 static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
-static nsTArray< nsCOMPtr<nsIAtom> >* sSystemMetrics = 0;
+static nsCOMArray<nsIAtom>* sSystemMetrics = 0;
 
 struct RuleValue {
   /**
@@ -752,41 +752,41 @@ InitSystemMetrics()
 {
   NS_ASSERTION(!sSystemMetrics, "already initialized");
 
-  sSystemMetrics = new nsTArray< nsCOMPtr<nsIAtom> >;
+  sSystemMetrics = new nsCOMArray<nsIAtom>;
   NS_ENSURE_TRUE(sSystemMetrics, PR_FALSE);
 
   nsresult rv;
-  nsCOMPtr<nsILookAndFeel> lookAndFeel(do_GetService(kLookAndFeelCID, &rv));
+  nsILookAndFeel* lookAndFeel(do_GetService(kLookAndFeelCID, &rv));
   NS_ENSURE_SUCCESS(rv, PR_FALSE);
 
   PRInt32 metricResult;
   lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollArrowStyle, metricResult);
   if (metricResult & nsILookAndFeel::eMetric_ScrollArrowStartBackward) {
-    sSystemMetrics->AppendElement(do_GetAtom("scrollbar-start-backward"));
+    sSystemMetrics->AppendObject(do_GetAtom("scrollbar-start-backward"));
   }
   if (metricResult & nsILookAndFeel::eMetric_ScrollArrowStartForward) {
-    sSystemMetrics->AppendElement(do_GetAtom("scrollbar-start-forward"));
+    sSystemMetrics->AppendObject(do_GetAtom("scrollbar-start-forward"));
   }
   if (metricResult & nsILookAndFeel::eMetric_ScrollArrowEndBackward) {
-    sSystemMetrics->AppendElement(do_GetAtom("scrollbar-end-backward"));
+    sSystemMetrics->AppendObject(do_GetAtom("scrollbar-end-backward"));
   }
   if (metricResult & nsILookAndFeel::eMetric_ScrollArrowEndForward) {
-    sSystemMetrics->AppendElement(do_GetAtom("scrollbar-end-forward"));
+    sSystemMetrics->AppendObject(do_GetAtom("scrollbar-end-forward"));
   }
 
   lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ScrollSliderStyle, metricResult);
   if (metricResult != nsILookAndFeel::eMetric_ScrollThumbStyleNormal) {
-    sSystemMetrics->AppendElement(do_GetAtom("scrollbar-thumb-proportional"));
+    sSystemMetrics->AppendObject(do_GetAtom("scrollbar-thumb-proportional"));
   }
 
   lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ImagesInMenus, metricResult);
   if (metricResult) {
-    sSystemMetrics->AppendElement(do_GetAtom("images-in-menus"));
+    sSystemMetrics->AppendObject(do_GetAtom("images-in-menus"));
   }
 
   rv = lookAndFeel->GetMetric(nsILookAndFeel::eMetric_WindowsDefaultTheme, metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
-    sSystemMetrics->AppendElement(do_GetAtom("windows-default-theme"));
+    sSystemMetrics->AppendObject(do_GetAtom("windows-default-theme"));
   }
 
   return PR_TRUE;
@@ -1324,8 +1324,7 @@ static PRBool SelectorMatches(RuleProces
       }
       NS_ASSERTION(pseudoClass->u.mString, "Must have string!");
       nsCOMPtr<nsIAtom> metric = do_GetAtom(pseudoClass->u.mString);
-      result = sSystemMetrics->IndexOf(metric) !=
-               sSystemMetrics->NoIndex;
+      result = sSystemMetrics->IndexOf(metric) != -1;
     }
     else if (nsCSSPseudoClasses::mozHasHandlerRef == pseudoClass->mAtom) {
       nsIContent *child = nsnull;
@@ -1816,8 +1815,8 @@ static void ContentEnumFunc(nsICSSStyleR
       // nsICSSStyleRule return the same pointer for nsIStyleRule (why
       // would anything multiply inherit nsIStyleRule anyway?)
 #ifdef DEBUG
-      nsCOMPtr<nsIStyleRule> iRule = do_QueryInterface(aRule);
-      NS_ASSERTION(static_cast<nsIStyleRule*>(aRule) == iRule.get(),
+      nsIStyleRule* iRule = do_QueryInterface(aRule);
+      NS_ASSERTION(static_cast<nsIStyleRule*>(aRule) == iRule,
                    "Please fix QI so this performance optimization is valid");
 #endif
       data->mRuleWalker->Forward(static_cast<nsIStyleRule*>(aRule));
@@ -1881,8 +1880,8 @@ static void PseudoEnumFunc(nsICSSStyleRu
     // nsICSSStyleRule return the same pointer for nsIStyleRule (why
     // would anything multiply inherit nsIStyleRule anyway?)
 #ifdef DEBUG
-    nsCOMPtr<nsIStyleRule> iRule = do_QueryInterface(aRule);
-    NS_ASSERTION(static_cast<nsIStyleRule*>(aRule) == iRule.get(),
+    nsIStyleRule* iRule = do_QueryInterface(aRule);
+    NS_ASSERTION(static_cast<nsIStyleRule*>(aRule) == iRule,
                  "Please fix QI so this performance optimization is valid");
 #endif
     data->mRuleWalker->Forward(static_cast<nsIStyleRule*>(aRule));