nsIAtom* pseudoTag = aData->mPseudoTag; if (pseudoTag == nsCSSPseudoElements::firstLine) { if (!mFirstLineRule) { mFirstLineRule = new CSSFirstLineRule(this); if (!mFirstLineRule) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(mFirstLineRule); } aData->mRuleWalker->Forward(mFirstLineRule); } else if (pseudoTag == nsCSSPseudoElements::firstLetter) { if (!mFirstLetterRule) { mFirstLetterRule = new CSSFirstLetterRule(this); if (!mFirstLetterRule) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(mFirstLetterRule); } aData->mRuleWalker->Forward(mFirstLetterRule); }
HTMLCSSStyleSheetImpl::RulesMatching(PseudoRuleProcessorData* aData,                                     nsIAtom* aMedium){  // We only want to add these rules if there are real :first-letter or  // :first-line rules that cause a pseudo-element frame to be created.  // Otherwise the use of ProbePseudoStyleContextFor will prevent frame  // creation, and adding rules here would cause it.  if (aData->mRuleWalker->AtRoot())    return NS_OK;  nsIAtom* pseudoTag = aData->mPseudoTag;  if (pseudoTag == nsCSSPseudoElements::firstLine) {    if (!mFirstLineRule) {      mFirstLineRule = new CSSFirstLineRule(this);      if (!mFirstLineRule)        return NS_ERROR_OUT_OF_MEMORY;      NS_ADDREF(mFirstLineRule);    }    aData->mRuleWalker->Forward(mFirstLineRule);  }  else if (pseudoTag == nsCSSPseudoElements::firstLetter) {    if (!mFirstLetterRule) {      mFirstLetterRule = new CSSFirstLetterRule(this);      if (!mFirstLetterRule)        return NS_ERROR_OUT_OF_MEMORY;      NS_ADDREF(mFirstLetterRule);    }    aData->mRuleWalker->Forward(mFirstLetterRule);  }   return NS_OK;}