if (styledContent->IsContentOfType(nsIContent::eHTML)) { nsIAtom* tag = aData->mContentTag;   if (tag == nsHTMLAtoms::a) { if (mLinkRule || mVisitedRule || mActiveRule) { if (aData->mIsHTMLLink) { switch (aData->mLinkState) { case eLinkState_Unvisited: if (mLinkRule) ruleWalker->Forward(mLinkRule); break; case eLinkState_Visited: if (mVisitedRule) ruleWalker->Forward(mVisitedRule); break; default: break; }   if (mActiveRule && (aData->mEventState & NS_EVENT_STATE_ACTIVE)) ruleWalker->Forward(mActiveRule); } } }  else if (tag == nsHTMLAtoms::th) { ruleWalker->Forward(mTableTHRule); } else if (tag == nsHTMLAtoms::tr) { ruleWalker->Forward(mTableRowRule); } else if ((tag == nsHTMLAtoms::thead) || (tag == nsHTMLAtoms::tbody) || (tag == nsHTMLAtoms::tfoot)) { ruleWalker->Forward(mTableTbodyRule); } else if (tag == nsHTMLAtoms::col) { ruleWalker->Forward(mTableColRule); } else if (tag == nsHTMLAtoms::colgroup) { ruleWalker->Forward(mTableColgroupRule); } else if (tag == nsHTMLAtoms::table) { if (aData->mCompatMode == eCompatibility_NavQuirks) ruleWalker->Forward(mDocumentColorRule); } }   styledContent->WalkContentStyleRules(ruleWalker);
if (ruleWalker) { ruleWalker->Forward(mTableColRule); }
HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,                                  nsIAtom* aMedium){  nsIStyledContent *styledContent = aData->mStyledContent;  if (styledContent) {    nsRuleWalker *ruleWalker = aData->mRuleWalker;    if (styledContent->IsContentOfType(nsIContent::eHTML)) {      nsIAtom* tag = aData->mContentTag;      // if we have anchor colors, check if this is an anchor with an href      if (tag == nsHTMLAtoms::a) {        if (mLinkRule || mVisitedRule || mActiveRule) {          if (aData->mIsHTMLLink) {            switch (aData->mLinkState) {              case eLinkState_Unvisited:                if (mLinkRule)                  ruleWalker->Forward(mLinkRule);                break;              case eLinkState_Visited:                if (mVisitedRule)                  ruleWalker->Forward(mVisitedRule);                break;              default:                break;            }            // No need to add to the active rule if it's not a link            if (mActiveRule && (aData->mEventState & NS_EVENT_STATE_ACTIVE))              ruleWalker->Forward(mActiveRule);          }        } // end link/visited/active rules      } // end A tag      // add the rule to handle text-align for a <th>      else if (tag == nsHTMLAtoms::th) {        ruleWalker->Forward(mTableTHRule);      }      else if (tag == nsHTMLAtoms::tr) {        ruleWalker->Forward(mTableRowRule);      }      else if ((tag == nsHTMLAtoms::thead) || (tag == nsHTMLAtoms::tbody) || (tag == nsHTMLAtoms::tfoot)) {        ruleWalker->Forward(mTableTbodyRule);      }      else if (tag == nsHTMLAtoms::col) {        ruleWalker->Forward(mTableColRule);      }      else if (tag == nsHTMLAtoms::colgroup) {        ruleWalker->Forward(mTableColgroupRule);      }      else if (tag == nsHTMLAtoms::table) {        if (aData->mCompatMode == eCompatibility_NavQuirks)          ruleWalker->Forward(mDocumentColorRule);      }    } // end html element    // just get the style rules from the content    styledContent->WalkContentStyleRules(ruleWalker);  }  return NS_OK;}