Bug 602341 part 2. Switch tree pseudoelements to using an nsAtomList (mClassList, to be exact), not an nsPseudoClassList (mPseudoClassList), for their list of atoms. r=dbaron
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 23 Mar 2011 09:52:25 -0400
changeset 63826 d15ce901326e433604da2a5c80d96820df4c97fd
parent 63825 1af999391d51ba8ea189fb2e7aa55d893d868701
child 63827 b89fb3d5ba0223c9f0d3ab831ff4dec91182bf32
push idunknown
push userunknown
push dateunknown
reviewersdbaron
bugs602341
milestone2.0b13pre
Bug 602341 part 2. Switch tree pseudoelements to using an nsAtomList (mClassList, to be exact), not an nsPseudoClassList (mPseudoClassList), for their list of atoms. r=dbaron
layout/style/nsCSSParser.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -377,17 +377,17 @@ protected:
   // aPseudoElement and aPseudoElementArgs are the location where
   // pseudo-elements (as opposed to pseudo-classes) are stored;
   // pseudo-classes are stored on aSelector.  aPseudoElement and
   // aPseudoElementArgs must be non-null iff !aIsNegated.
   nsSelectorParsingStatus ParsePseudoSelector(PRInt32&       aDataMask,
                                               nsCSSSelector& aSelector,
                                               PRBool         aIsNegated,
                                               nsIAtom**      aPseudoElement,
-                                              nsPseudoClassList** aPseudoElementArgs,
+                                              nsAtomList**   aPseudoElementArgs,
                                               nsCSSPseudoElements::Type* aPseudoElementType);
 
   nsSelectorParsingStatus ParseAttributeSelector(PRInt32&       aDataMask,
                                                  nsCSSSelector& aSelector);
 
   nsSelectorParsingStatus ParseTypeOrUniversalSelector(PRInt32&       aDataMask,
                                                        nsCSSSelector& aSelector,
                                                        PRBool         aIsNegated);
@@ -428,17 +428,17 @@ protected:
   enum PriorityParsingStatus {
     ePriority_None,
     ePriority_Important,
     ePriority_Error
   };
   PriorityParsingStatus ParsePriority();
 
 #ifdef MOZ_XUL
-  PRBool ParseTreePseudoElement(nsPseudoClassList **aPseudoElementArgs);
+  PRBool ParseTreePseudoElement(nsAtomList **aPseudoElementArgs);
 #endif
 
   void InitBoxPropsAsPhysical(const nsCSSProperty *aSourceProperties);
 
   // Property specific parsing routines
   PRBool ParseAzimuth(nsCSSValue& aValue);
   PRBool ParseBackground();
 
@@ -2957,17 +2957,17 @@ CSSParserImpl::ParseAttributeSelector(PR
 //
 // Parse pseudo-classes and pseudo-elements
 //
 CSSParserImpl::nsSelectorParsingStatus
 CSSParserImpl::ParsePseudoSelector(PRInt32&       aDataMask,
                                    nsCSSSelector& aSelector,
                                    PRBool         aIsNegated,
                                    nsIAtom**      aPseudoElement,
-                                   nsPseudoClassList** aPseudoElementArgs,
+                                   nsAtomList**   aPseudoElementArgs,
                                    nsCSSPseudoElements::Type* aPseudoElementType)
 {
   NS_ASSERTION(aIsNegated || (aPseudoElement && aPseudoElementArgs),
                "expected location to store pseudo element");
   NS_ASSERTION(!aIsNegated || (!aPseudoElement && !aPseudoElementArgs),
                "negated selectors shouldn't have a place to store "
                "pseudo elements");
   if (! GetToken(PR_FALSE)) { // premature eof
@@ -3468,17 +3468,17 @@ CSSParserImpl::ParseSelector(nsCSSSelect
 {
   if (! GetToken(PR_TRUE)) {
     REPORT_UNEXPECTED_EOF(PESelectorEOF);
     return PR_FALSE;
   }
 
   nsCSSSelector* selector = aList->AddSelector(aPrevCombinator);
   nsCOMPtr<nsIAtom> pseudoElement;
-  nsAutoPtr<nsPseudoClassList> pseudoElementArgs;
+  nsAutoPtr<nsAtomList> pseudoElementArgs;
   nsCSSPseudoElements::Type pseudoElementType =
     nsCSSPseudoElements::ePseudo_NotPseudoElement;
 
   PRInt32 dataMask = 0;
   nsSelectorParsingStatus parsingStatus =
     ParseTypeOrUniversalSelector(dataMask, *selector, PR_FALSE);
 
   while (parsingStatus == eSelectorParsingStatus_Continue) {
@@ -3535,30 +3535,30 @@ CSSParserImpl::ParseSelector(nsCSSSelect
     if (selector->mNext || !IsUniversalSelector(*selector)) {
       REPORT_UNEXPECTED(PEAnonBoxNotAlone);
       return PR_FALSE;
     }
 
     // Rewrite the current selector as this pseudo-element.
     // It does not contribute to selector weight.
     selector->mLowercaseTag.swap(pseudoElement);
-    selector->mPseudoClassList = pseudoElementArgs.forget();
+    selector->mClassList = pseudoElementArgs.forget();
     selector->SetPseudoType(pseudoElementType);
     return PR_TRUE;
   }
 
   aList->mWeight += selector->CalcWeight();
 
   // Pseudo-elements other than anonymous boxes are represented as
   // direct children ('>' combinator) of the rest of the selector.
   if (pseudoElement) {
     selector = aList->AddSelector('>');
 
     selector->mLowercaseTag.swap(pseudoElement);
-    selector->mPseudoClassList = pseudoElementArgs.forget();
+    selector->mClassList = pseudoElementArgs.forget();
     selector->SetPseudoType(pseudoElementType);
   }
 
   return PR_TRUE;
 }
 
 css::Declaration*
 CSSParserImpl::ParseDeclarationBlock(PRBool aCheckForBraces)
@@ -3930,40 +3930,38 @@ CSSParserImpl::ParseColorOpacity(PRUint8
 
   aOpacity = value;
 
   return PR_TRUE;
 }
 
 #ifdef MOZ_XUL
 PRBool
-CSSParserImpl::ParseTreePseudoElement(nsPseudoClassList **aPseudoElementArgs)
+CSSParserImpl::ParseTreePseudoElement(nsAtomList **aPseudoElementArgs)
 {
   // The argument to a tree pseudo-element is a sequence of identifiers
   // that are either space- or comma-separated.  (Was the intent to
   // allow only comma-separated?  That's not what was done.)
   nsCSSSelector fakeSelector; // so we can reuse AddPseudoClass
 
   while (!ExpectSymbol(')', PR_TRUE)) {
     if (!GetToken(PR_TRUE)) {
       return PR_FALSE;
     }
     if (eCSSToken_Ident == mToken.mType) {
-      nsCOMPtr<nsIAtom> pseudo = do_GetAtom(mToken.mIdent);
-      fakeSelector.AddPseudoClass(pseudo,
-                                  nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
+      fakeSelector.AddClass(mToken.mIdent);
     }
     else if (!mToken.IsSymbol(',')) {
       UngetToken();
       SkipUntil(')');
       return PR_FALSE;
     }
   }
-  *aPseudoElementArgs = fakeSelector.mPseudoClassList;
-  fakeSelector.mPseudoClassList = nsnull;
+  *aPseudoElementArgs = fakeSelector.mClassList;
+  fakeSelector.mClassList = nsnull;
   return PR_TRUE;
 }
 #endif
 
 //----------------------------------------------------------------------
 
 PRBool
 CSSParserImpl::ParseDeclaration(css::Declaration* aDeclaration,
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -4191,21 +4191,21 @@ nsTreeBodyFrame::GetPseudoStyleContext(n
                                      mStyleContext, aPseudoElement,
                                      mScratchArray);
 }
 
 // Our comparator for resolving our complex pseudos
 PRBool
 nsTreeBodyFrame::PseudoMatches(nsCSSSelector* aSelector)
 {
-  // Iterate the pseudoclass list.  For each item in the list, see if
+  // Iterate the class list.  For each item in the list, see if
   // it is contained in our scratch array.  If we have a miss, then
-  // we aren't a match.  If all items in the pseudoclass list are
+  // we aren't a match.  If all items in the class list are
   // present in the scratch array, then we have a match.
-  nsPseudoClassList* curr = aSelector->mPseudoClassList;
+  nsAtomList* curr = aSelector->mClassList;
   while (curr) {
     PRInt32 index;
     mScratchArray->GetIndexOf(curr->mAtom, &index);
     if (index == -1) {
       return PR_FALSE;
     }
     curr = curr->mNext;
   }