NS_PRECONDITION(nsnull != aPresContext, "null arg"); NS_PRECONDITION(nsnull != aContent, "null arg"); NS_PRECONDITION(nsnull != aResults, "null arg");  nsIStyledContent* styledContent; if (NS_SUCCEEDED(aContent->QueryInterface(NS_GET_IID(nsIStyledContent), (void**)&styledContent))) { PRInt32 nameSpace; styledContent->GetNameSpaceID(nameSpace); if (kNameSpaceID_HTML == nameSpace) { nsIAtom*  tag; styledContent->GetTag(tag);  if (tag == nsHTMLAtoms::a) { if (mLinkRule || mVisitedRule || mActiveRule) { nsLinkState linkState; if (nsStyleUtil::IsHTMLLink(aContent, tag, aPresContext, &linkState)) { switch (linkState) { case eLinkState_Unvisited: if (nsnull != mLinkRule) { aResults->AppendElement(mLinkRule); } break; case eLinkState_Visited: if (nsnull != mVisitedRule) { aResults->AppendElement(mVisitedRule); } break; default: break; }  if (mActiveRule) { nsIEventStateManager* eventStateManager;  if ((NS_OK == aPresContext->GetEventStateManager(&eventStateManager)) && (nsnull != eventStateManager)) { PRInt32 state; if (NS_OK == eventStateManager->GetContentState(aContent, state)) { if (0 != (state & NS_EVENT_STATE_ACTIVE)) { aResults->AppendElement(mActiveRule); } } NS_RELEASE(eventStateManager); } } } } }   else if ((tag == nsHTMLAtoms::td) || (tag == nsHTMLAtoms::th) || (tag == nsHTMLAtoms::tr) || (tag == nsHTMLAtoms::thead) || (tag == nsHTMLAtoms::tbody) || (tag == nsHTMLAtoms::tfoot)) {  if (tag == nsHTMLAtoms::th) { aResults->AppendElement(mTableTHRule); } nsCompatibility mode; aPresContext->GetCompatibilityMode(&mode); if (eCompatibility_NavQuirks == mode) { if (mDocumentColorRule) { aResults->AppendElement(mDocumentColorRule); } aResults->AppendElement(mTableBackgroundRule); } } else if (tag == nsHTMLAtoms::html) { if (mDocumentColorRule) { aResults->AppendElement(mDocumentColorRule); } } NS_IF_RELEASE(tag); }   styledContent->GetContentStyleRules(aResults);  NS_RELEASE(styledContent); }
HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,                                  nsIAtom* aMedium,                                  nsIContent* aParentContent,                                  nsIAtom* aPseudoTag,                                  nsIStyleContext* aParentContext,                                  nsISupportsArray* aResults){  // no pseudo frame style  return NS_OK;}