NS_PRECONDITION(nsnull != aPresContext, "null arg"); NS_PRECONDITION(nsnull != aContent, "null arg"); NS_PRECONDITION(nsnull != aResults, "null arg");  PRInt32 matchCount = 0;  nsIStyledContent* styledContent;   if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) { nsIStyleRule* rule = nsnull; if (NS_SUCCEEDED(styledContent->GetInlineStyleRule(rule))) { if (nsnull != rule) { aResults->AppendElement(rule); matchCount++; nsICSSStyleRule*  cssRule; if (NS_SUCCEEDED(rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule))) { nsIStyleRule* important = cssRule->GetImportantRule(); if (nsnull != important) { aResults->AppendElement(important); matchCount++; NS_RELEASE(important); } NS_RELEASE(cssRule);
if (aPseudoTag == nsHTMLAtoms::firstLinePseudo) { if (aResults->Count()) { if (nsnull == mFirstLineRule) { mFirstLineRule = new CSSFirstLineRule(this); if (mFirstLineRule) { NS_ADDREF(mFirstLineRule);
PRInt32 HTMLCSSStyleSheetImpl::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;  nsIStyledContent* styledContent;  // just get the one and only style rule from the content's STYLE attribute  if (NS_SUCCEEDED(aContent->QueryInterface(nsIStyledContent::GetIID(), (void**)&styledContent))) {    nsIStyleRule* rule = nsnull;    if (NS_SUCCEEDED(styledContent->GetInlineStyleRule(rule))) {      if (nsnull != rule) {        aResults->AppendElement(rule);        matchCount++;        nsICSSStyleRule*  cssRule;        if (NS_SUCCEEDED(rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule))) {          nsIStyleRule* important = cssRule->GetImportantRule();          if (nsnull != important) {            aResults->AppendElement(important);            matchCount++;            NS_RELEASE(important);          }          NS_RELEASE(cssRule);        }        NS_RELEASE(rule);      }    }    NS_RELEASE(styledContent);  }  return matchCount;}