const nsStyleMargin* margin=nsnull; GetStyleData(eStyleStruct_Margin, (const nsStyleStruct*&)margin, aFrame);
nscoord width = GetMarginWidthCoordFor(aSide, aFrame); val->SetTwips(width);
nsComputedDOMStyle::GetMarginWidthFor(PRUint8 aSide,                                      nsIFrame *aFrame,                                      nsIDOMCSSPrimitiveValue*& aValue){  nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();  NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);  const nsStyleMargin* margin=nsnull;  GetStyleData(eStyleStruct_Margin, (const nsStyleStruct*&)margin, aFrame);  if(margin) {    nsStyleCoord coord;    switch(aSide) {      case NS_SIDE_TOP    :        margin->mMargin.GetTop(coord);    break;      case NS_SIDE_BOTTOM :        margin->mMargin.GetBottom(coord); break;      case NS_SIDE_LEFT   :        margin->mMargin.GetLeft(coord);   break;      case NS_SIDE_RIGHT  :        margin->mMargin.GetRight(coord);  break;      default:        NS_WARNING("double check the side");        break;    }    switch(coord.GetUnit()) {      case eStyleUnit_Coord:        val->SetTwips(coord.GetCoordValue()); break;      case eStyleUnit_Percent:        {          nsIFrame* parent=nsnull;          aFrame->GetParent(&parent);          if(parent) {            nsRect rect;            parent->GetRect(rect);            val->SetTwips(nscoord(coord.GetPercentValue() * rect.width));            break; // intentionally breaking here...          }        }      default:        NS_WARNING("double check the unit");        break;    }  }  return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),                             (void **)&aValue);}