if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) != NS_CONTENT_ATTR_NOT_THERE && eHTMLUnit_String == value.GetUnit()) { nsAutoString tmp; value.GetStringValue(tmp);
const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::type); if (value && value->Type() == nsAttrValue::eString) { nsAutoString tmp(value->GetStringValue());
SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes,                            nsRuleData* aData){  nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);  nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);  if (aData->mSID == eStyleStruct_Position) {    nsHTMLValue value;    const nsStyleDisplay* display = aData->mStyleContext->GetStyleDisplay();    PRBool typeIsBlock = (display->mDisplay == NS_STYLE_DISPLAY_BLOCK);    if (typeIsBlock) {      // width: value      if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {        aAttributes->GetAttribute(nsHTMLAtoms::width, value);        if (value.GetUnit() == eHTMLUnit_Integer) {          aData->mPositionData->            mWidth.SetFloatValue((float)value.GetIntValue(), eCSSUnit_Pixel);        } else if (value.GetUnit() == eHTMLUnit_Percent) {          aData->mPositionData->            mWidth.SetPercentValue(value.GetPercentValue());        }      }      // height: value      if (aData->mPositionData->mHeight.GetUnit() == eCSSUnit_Null) {        aAttributes->GetAttribute(nsHTMLAtoms::height, value);        if (value.GetUnit() == eHTMLUnit_Integer) {          aData->mPositionData->            mHeight.SetFloatValue((float)value.GetIntValue(),                                  eCSSUnit_Pixel);        } else if (value.GetUnit() == eHTMLUnit_Percent) {          aData->mPositionData->            mHeight.SetPercentValue(value.GetPercentValue());        }      }    } else {      // size: value      if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {        aAttributes->GetAttribute(nsHTMLAtoms::size, value);        if (value.GetUnit() == eHTMLUnit_Integer)          aData->mPositionData->            mWidth.SetFloatValue((float)value.GetIntValue(),                                 eCSSUnit_Pixel);      }    }  } else if (aData->mSID == eStyleStruct_Display) {    nsHTMLValue value;    aAttributes->GetAttribute(nsHTMLAtoms::align, value);    if (value.GetUnit() == eHTMLUnit_Enumerated) {      PRUint8 align = (PRUint8)(value.GetIntValue());      if (aData->mDisplayData->mFloat.GetUnit() == eCSSUnit_Null) {        if (align == NS_STYLE_TEXT_ALIGN_LEFT)          aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_LEFT,                                                  eCSSUnit_Enumerated);        else if (align == NS_STYLE_TEXT_ALIGN_RIGHT)          aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_RIGHT,                                                  eCSSUnit_Enumerated);      }    }    if (aData->mDisplayData->mDisplay == eCSSUnit_Null) {      if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) !=          NS_CONTENT_ATTR_NOT_THERE &&          eHTMLUnit_String == value.GetUnit()) {        nsAutoString tmp;        value.GetStringValue(tmp);        if (tmp.EqualsIgnoreCase("line") ||            tmp.EqualsIgnoreCase("vert") ||            tmp.EqualsIgnoreCase("vertical") ||            tmp.EqualsIgnoreCase("block")) {          // This is not strictly 100% compatible: if the spacer is given          // a width of zero then it is basically ignored.          aData->mDisplayData->mDisplay = NS_STYLE_DISPLAY_BLOCK;        }      }    }  }  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);}