return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), (void **)&aValue);
if (aFrame) { calcWidth = PR_TRUE;  FlushPendingReflows();  const nsStyleDisplay *displayData = nsnull; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData, aFrame); if (displayData && displayData->mDisplay == NS_STYLE_DISPLAY_INLINE) { nsFrameState frameState; aFrame->GetFrameState(&frameState); if (!(frameState & NS_FRAME_REPLACED_ELEMENT)) { calcWidth = PR_FALSE; } } }  if (calcWidth) { nsSize size; nsMargin padding; nsMargin border; aFrame->GetSize(size); const nsStylePadding *paddingData = nsnull; GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingData, aFrame); if (paddingData) { paddingData->CalcPaddingFor(aFrame, padding); } const nsStyleBorder *borderData = nsnull; GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData, aFrame); if (borderData) { borderData->CalcBorderFor(aFrame, border); } val->SetTwips(size.width - padding.left - padding.right - border.left - border.right); } else {  const nsStylePosition *positionData = nsnull; GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData, aFrame); if (positionData) { switch (positionData->mWidth.GetUnit()) { case eStyleUnit_Coord: val->SetTwips(positionData->mWidth.GetCoordValue()); break; case eStyleUnit_Percent: val->SetPercent(positionData->mWidth.GetPercentValue()); break; case eStyleUnit_Auto: val->SetIdent(NS_LITERAL_STRING("auto")); break; case eStyleUnit_Inherit: val->SetIdent(NS_LITERAL_STRING("inherit")); break; default: NS_WARNING("Double check the unit"); val->SetTwips(0); break; } } else { val->SetTwips(0); } }  return CallQueryInterface(val, aValue);
nsComputedDOMStyle::GetWidth(nsIFrame *aFrame,                             nsIDOMCSSPrimitiveValue*& aValue){  nsISupports *tmp = NS_STATIC_CAST(nsIComputedDOMStyle *, this);  nsRect rect;  GetAbsoluteFrameRect(aFrame, rect);  nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue(tmp, mT2P);  NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);  val->SetTwips(rect.width);  return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),                             (void **)&aValue);}