NS_RELEASE(styleSheet);
void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aData){  if (!aAttributes || !aData)    return;    if (aData->mDisplayData && aData->mSID == eStyleStruct_Display) {    // When display if first asked for, go ahead and get our colors set up.    nsHTMLValue value;        nsCOMPtr<nsIPresShell> presShell;    aData->mPresContext->GetShell(getter_AddRefs(presShell));    if (presShell) {      nsCOMPtr<nsIDocument> doc;      presShell->GetDocument(getter_AddRefs(doc));      if (doc) {        nsIHTMLContentContainer*  htmlContainer;        if (NS_OK == doc->QueryInterface(NS_GET_IID(nsIHTMLContentContainer),                                         (void**)&htmlContainer)) {          nsIHTMLStyleSheet* styleSheet;          if (NS_OK == htmlContainer->GetAttributeStyleSheet(&styleSheet)) {            aAttributes->GetAttribute(nsHTMLAtoms::link, value);            if ((eHTMLUnit_Color == value.GetUnit()) ||                 (eHTMLUnit_ColorName == value.GetUnit())) {              styleSheet->SetLinkColor(value.GetColorValue());            }            aAttributes->GetAttribute(nsHTMLAtoms::alink, value);            if ((eHTMLUnit_Color == value.GetUnit()) ||                 (eHTMLUnit_ColorName == value.GetUnit())) {              styleSheet->SetActiveLinkColor(value.GetColorValue());            }            aAttributes->GetAttribute(nsHTMLAtoms::vlink, value);            if ((eHTMLUnit_Color == value.GetUnit()) ||                (eHTMLUnit_ColorName == value.GetUnit())) {              styleSheet->SetVisitedLinkColor(value.GetColorValue());            }            NS_RELEASE(styleSheet);          }          NS_RELEASE(htmlContainer);        }      }    }  }  if (aData->mColorData && aData->mSID == eStyleStruct_Color) {    if (aData->mColorData->mColor.GetUnit() == eCSSUnit_Null) {      // color: color      nsHTMLValue value;      aAttributes->GetAttribute(nsHTMLAtoms::text, value);      if (((eHTMLUnit_Color == value.GetUnit())) ||          (eHTMLUnit_ColorName == value.GetUnit()))        aData->mColorData->mColor.SetColorValue(value.GetColorValue());    }  }  nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);}