} else if (value.GetUnit() == eHTMLUnit_Percent) { float heightPercent = value.GetPercentValue(); pos->mHeight.SetPercentValue(heightPercent);
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,                  nsIStyleContext* aContext,                  nsIPresContext* aPresContext){  NS_PRECONDITION(nsnull!=aContext, "bad style context arg");  NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");  if (nsnull!=aAttributes)  {    nsHTMLValue value;    nsHTMLValue widthValue;    nsStyleText* textStyle = nsnull;    // align: enum    aAttributes->GetAttribute(nsHTMLAtoms::align, value);    if (value.GetUnit() == eHTMLUnit_Enumerated)     {      textStyle = (nsStyleText*)aContext->GetMutableStyleData(eStyleStruct_Text);      textStyle->mTextAlign = value.GetIntValue();    }      // valign: enum    aAttributes->GetAttribute(nsHTMLAtoms::valign, value);    if (value.GetUnit() == eHTMLUnit_Enumerated)     {      if (nsnull==textStyle)        textStyle = (nsStyleText*)aContext->GetMutableStyleData(eStyleStruct_Text);      textStyle->mVerticalAlign.SetIntValue(value.GetIntValue(), eStyleUnit_Enumerated);    }    // width: pixel    float p2t;    aPresContext->GetScaledPixelsToTwips(&p2t);    nsStylePosition* pos = (nsStylePosition*)      aContext->GetMutableStyleData(eStyleStruct_Position);    aAttributes->GetAttribute(nsHTMLAtoms::width, widthValue);    if (widthValue.GetUnit() == eHTMLUnit_Pixel) {      nscoord width = widthValue.GetPixelValue();      nscoord twips = NSIntPixelsToTwips(width, p2t);      pos->mWidth.SetCoordValue(twips);    }    else if (widthValue.GetUnit() == eHTMLUnit_Percent) {      float widthPercent = widthValue.GetPercentValue();      pos->mWidth.SetPercentValue(widthPercent);    }    // height: pixel    aAttributes->GetAttribute(nsHTMLAtoms::height, value);    if (value.GetUnit() == eHTMLUnit_Pixel) {      nscoord height = value.GetPixelValue();      nscoord twips = NSIntPixelsToTwips(height, p2t);      pos->mHeight.SetCoordValue(twips);    }    // nowrap    // nowrap depends on the width attribute, so be sure to handle it after width is mapped!    aAttributes->GetAttribute(nsHTMLAtoms::nowrap, value);    if (value.GetUnit() != eHTMLUnit_Null)    {      if (widthValue.GetUnit() != eHTMLUnit_Pixel)      {        if (nsnull==textStyle)          textStyle = (nsStyleText*)aContext->GetMutableStyleData(eStyleStruct_Text);        textStyle->mWhiteSpace = NS_STYLE_WHITESPACE_NOWRAP;      }    }    nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext);    nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);  }}