mFont.mFont.name = strName; mFont.mFixedFont.name = strMixedName;
StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse){  mDataCode = -1;  if (nsnull != mParent) {    mFont.ResetFrom(&(mParent->mFont), aPresContext);    mColor.ResetFrom(&(mParent->mColor), aPresContext);    mSpacing.ResetFrom(&(mParent->mSpacing), aPresContext);    mList.ResetFrom(&(mParent->mList), aPresContext);    mPosition.ResetFrom(&(mParent->mPosition), aPresContext);    mText.ResetFrom(&(mParent->mText), aPresContext);    mDisplay.ResetFrom(&(mParent->mDisplay), aPresContext);    mTable.ResetFrom(&(mParent->mTable), aPresContext);    mContent.ResetFrom(&(mParent->mContent), aPresContext);    mUserInterface.ResetFrom(&(mParent->mUserInterface), aPresContext);    mPrint.ResetFrom(&(mParent->mPrint), aPresContext);  }  else {    mFont.ResetFrom(nsnull, aPresContext);    mColor.ResetFrom(nsnull, aPresContext);    mSpacing.ResetFrom(nsnull, aPresContext);    mList.ResetFrom(nsnull, aPresContext);    mPosition.ResetFrom(nsnull, aPresContext);    mText.ResetFrom(nsnull, aPresContext);    mDisplay.ResetFrom(nsnull, aPresContext);    mTable.ResetFrom(nsnull, aPresContext);    mContent.ResetFrom(nsnull, aPresContext);    mUserInterface.ResetFrom(nsnull, aPresContext);    mPrint.ResetFrom(nsnull, aPresContext);  }  PRUint32 cnt = 0;  if (mRules) {    nsresult rv = mRules->Count(&cnt);    NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");  }  if (0 < cnt) {    MapStyleData  data(this, aPresContext);    mRules->EnumerateForwards(MapStyleRuleFont, &data);    if (mFont.mFlags & NS_STYLE_FONT_USE_FIXED) {      mFont.mFont = mFont.mFixedFont;    }    mRules->EnumerateForwards(MapStyleRule, &data);  }  if (-1 == mDataCode) {    mDataCode = 0;  }  nsCompatibility quirkMode = eCompatibility_Standard;  aPresContext->GetCompatibilityMode(&quirkMode);  if (eCompatibility_NavQuirks == quirkMode) {    if (((mDisplay.mDisplay == NS_STYLE_DISPLAY_TABLE) ||          (mDisplay.mDisplay == NS_STYLE_DISPLAY_TABLE_CAPTION)) &&         (nsnull == mPseudoTag)) {      StyleContextImpl* holdParent = mParent;      mParent = nsnull; // cut off all inheritance. this really blows      // XXX the style we do preserve is visibility, direction, language      PRUint8 visible = mDisplay.mVisible;      PRUint8 direction = mDisplay.mDirection;      nsCOMPtr<nsILanguageAtom> language = mDisplay.mLanguage;      // time to emulate a sub-document      // This is ugly, but we need to map style once to determine display type      // then reset and map it again so that all local style is preserved      if (mDisplay.mDisplay != NS_STYLE_DISPLAY_TABLE) {        mFont.ResetFrom(nsnull, aPresContext);      }      mColor.ResetFrom(nsnull, aPresContext);      mSpacing.ResetFrom(nsnull, aPresContext);      mList.ResetFrom(nsnull, aPresContext);      mText.ResetFrom(nsnull, aPresContext);      mPosition.ResetFrom(nsnull, aPresContext);      mDisplay.ResetFrom(nsnull, aPresContext);      mTable.ResetFrom(nsnull, aPresContext);      mContent.ResetFrom(nsnull, aPresContext);      mUserInterface.ResetFrom(nsnull, aPresContext);      mPrint.ResetFrom(nsnull, aPresContext);      mDisplay.mVisible = visible;      mDisplay.mDirection = direction;      mDisplay.mLanguage = language;      PRUint32 numRules = 0;      if (mRules) {        nsresult rv = mRules->Count(&numRules);        NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");      }      if (0 < numRules) {        MapStyleData  data(this, aPresContext);        mRules->EnumerateForwards(MapStyleRuleFont, &data);        if (mFont.mFlags & NS_STYLE_FONT_USE_FIXED) {          mFont.mFont = mFont.mFixedFont;        }        mRules->EnumerateForwards(MapStyleRule, &data);      }      // reset all font data for tables again      if (mDisplay.mDisplay == NS_STYLE_DISPLAY_TABLE) {        mFont.ResetFrom(nsnull, aPresContext);      }      mParent = holdParent;    }  }  RecalcAutomaticData(aPresContext);  if (aRecurse) {    if (nsnull != mChild) {      StyleContextImpl* child = mChild;      do {        child->RemapStyle(aPresContext);        child = child->mNextSibling;      } while (mChild != child);    }    if (nsnull != mEmptyChild) {      StyleContextImpl* child = mEmptyChild;      do {        child->RemapStyle(aPresContext);        child = child->mNextSibling;      } while (mEmptyChild != child);    }  }  return NS_OK;}