aPresContext->SetDefaultColor(color->mColor);
} else if (eHTMLUnit_String == value.GetUnit()) { nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); color->mColor = ColorNameToRGB(value);
MapAttributesInto(nsIHTMLAttributes* aAttributes,                  nsIStyleContext* aContext,                  nsIPresContext* aPresContext){  if (nsnull != aAttributes) {    nsHTMLValue value;    nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext);    aAttributes->GetAttribute(nsHTMLAtoms::text, value);    if (eHTMLUnit_Color == value.GetUnit()) {      nsStyleColor* color = (nsStyleColor*)        aContext->GetMutableStyleData(eStyleStruct_Color);      color->mColor = value.GetColorValue();      aPresContext->SetDefaultColor(color->mColor);    }    nsIPresShell* presShell = aPresContext->GetShell();    if (nsnull != presShell) {      nsIDocument*  doc = presShell->GetDocument();      if (nsnull != doc) {        nsIHTMLDocument*  htmlDoc;        if (NS_OK == doc->QueryInterface(kIHTMLDocumentIID,                                         (void**)&htmlDoc)) {          nsIHTMLStyleSheet* styleSheet;          if (NS_OK == htmlDoc->GetAttributeStyleSheet(&styleSheet)) {            aAttributes->GetAttribute(nsHTMLAtoms::link, value);            if (eHTMLUnit_Color == value.GetUnit()) {              styleSheet->SetLinkColor(value.GetColorValue());            }            aAttributes->GetAttribute(nsHTMLAtoms::alink, value);            if (eHTMLUnit_Color == value.GetUnit()) {              styleSheet->SetActiveLinkColor(value.GetColorValue());            }            aAttributes->GetAttribute(nsHTMLAtoms::vlink, value);            if (eHTMLUnit_Color == value.GetUnit()) {              styleSheet->SetVisitedLinkColor(value.GetColorValue());            }            NS_RELEASE(styleSheet);          }          NS_RELEASE(htmlDoc);        }        NS_RELEASE(doc);      }      NS_RELEASE(presShell);    }    // marginwidth/height get set by a special style rule    // set up the basefont (defaults to 3)    nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font);    const nsFont& defaultFont = aPresContext->GetDefaultFont();     const nsFont& defaultFixedFont = aPresContext->GetDefaultFixedFont();     PRInt32 scaler = aPresContext->GetFontScaler();    float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);    font->mFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFont.size, scaleFactor);    font->mFixedFont.size = nsStyleUtil::CalcFontPointSize(3, (PRInt32)defaultFixedFont.size, scaleFactor);  }  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);}