mRuleHash->EnumerateAllRules(tagAtom, idAtom, classArray, ContentEnumFunc, &data);
mRuleHash->EnumerateTagRules(aPseudoTag, PseudoEnumFunc, &data);
PRInt32 CSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,                                         nsIContent* aContent,                                         nsIStyleContext* aParentContext,                                         nsISupportsArray* aResults){  NS_PRECONDITION(nsnull != aPresContext, "null arg");  NS_PRECONDITION(nsnull != aContent, "null arg");  NS_PRECONDITION(nsnull != aResults, "null arg");  PRInt32 matchCount = 0;  nsIAtom* presMedium = nsnull;  aPresContext->GetMedium(&presMedium);  nsICSSStyleSheet*  child = mFirstChild;  while (nsnull != child) {    PRBool mediumOK = PR_FALSE;    PRInt32 mediumCount;    child->GetMediumCount(mediumCount);    if (0 < mediumCount) {      PRInt32 index = 0;      nsIAtom* medium;      while ((PR_FALSE == mediumOK) && (index < mediumCount)) {        child->GetMediumAt(index++, medium);        if ((medium == nsLayoutAtoms::all) || (medium == presMedium)) {          mediumOK = PR_TRUE;        }        NS_RELEASE(medium);      }    }    else {      mediumOK = PR_TRUE;    }    if (mediumOK) {      matchCount += child->RulesMatching(aPresContext, aContent, aParentContext, aResults);    }    child = ((CSSStyleSheetImpl*)child)->mNext;  }  if (mWeightedRules.IsNotNull()) {    if (nsnull == mRuleHash) {      BuildHash();    }    ContentEnumData data(aPresContext, aContent, aParentContext, aResults);    nsIAtom* tagAtom;    aContent->GetTag(tagAtom);    nsIAtom* idAtom = nsnull;    nsVoidArray classArray; // XXX need to recycle this guy (or make nsAutoVoidArray?)    nsIStyledContent* styledContent;    if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {      styledContent->GetID(idAtom);      styledContent->GetClasses(classArray);      NS_RELEASE(styledContent);    }    mRuleHash->EnumerateAllRules(tagAtom, idAtom, classArray, ContentEnumFunc, &data);    matchCount += data.mCount;#ifdef DEBUG_RULES    nsISupportsArray* list1;    nsISupportsArray* list2;    NS_NewISupportsArray(&list1);    NS_NewISupportsArray(&list2);    data.mResults = list1;    mRuleHash->EnumerateAllRules(tagAtom, idAtom, classArray, ContentEnumFunc, &data);    data.mResults = list2;    mWeightedRules->EnumerateBackwards(ContentEnumWrap, &data);    NS_ASSERTION(list1->Equals(list2), "lists not equal");    NS_RELEASE(list1);    NS_RELEASE(list2);#endif    NS_IF_RELEASE(tagAtom);    NS_IF_RELEASE(idAtom);  }  NS_IF_RELEASE(presMedium);  return matchCount;}