PRBool calcHeight = PR_FALSE;  if (aFrame) { calcHeight = PR_TRUE;
nsRect rect; GetAbsoluteFrameRect(aFrame, rect);
nsComputedDOMStyle::GetHeight(nsIFrame *aFrame,                              nsIDOMCSSValue** aValue){  nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();  NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);  PRBool calcHeight = PR_FALSE;    if (aFrame) {    calcHeight = PR_TRUE;    FlushPendingReflows();      const nsStyleDisplay* displayData = nsnull;    GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData,                 aFrame);    if (displayData && displayData->mDisplay == NS_STYLE_DISPLAY_INLINE        && !(aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)) {      calcHeight = PR_FALSE;    }  }  if (calcHeight) {    nsMargin padding;    nsMargin border;    nsSize size = aFrame->GetSize();    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.height - padding.top - padding.bottom -                  border.top - border.bottom);  } else {    // Just return the value in the style context    const nsStylePosition* positionData = nsnull;    GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,                 aFrame);    if (positionData) {      switch (positionData->mHeight.GetUnit()) {        case eStyleUnit_Coord:          val->SetTwips(positionData->mHeight.GetCoordValue());          break;        case eStyleUnit_Percent:          val->SetPercent(positionData->mHeight.GetPercentValue());          break;        case eStyleUnit_Auto:          val->SetIdent(nsLayoutAtoms::autoAtom);          break;        default:          NS_WARNING("Double check the unit");          val->SetTwips(0);          break;      }    }  }    return CallQueryInterface(val, aValue);}