aMetrics.height = bbox.height;
aMetrics.height = bbox.height + rs.mBorderPadding.top + rs.mBorderPadding.bottom;
nsInlineFrame::ReflowInlineFrames(ReflowState& rs,                                  nsHTMLReflowMetrics& aMetrics,                                  nsReflowStatus& aStatus){  nsresult rv = NS_OK;  aStatus = NS_FRAME_COMPLETE;  nsInlineReflow ir(*rs.lineLayout, rs, this, PR_FALSE);  rs.inlineReflow = &ir;  rs.lineLayout->PushInline(&ir);  // Compute available area  nscoord x = rs.mBorderPadding.left;  nscoord availableWidth = rs.availableWidth;  if (NS_UNCONSTRAINEDSIZE != availableWidth) {    if (nsnull != mPrevInFlow) {      x = 0;      availableWidth -= rs.mBorderPadding.right;    }    else {      availableWidth -= rs.mBorderPadding.left + rs.mBorderPadding.right;    }  }  nscoord y = rs.mBorderPadding.top;  nscoord availableHeight = rs.availableHeight;  if (NS_UNCONSTRAINEDSIZE != rs.availableHeight) {    availableHeight -= rs.mBorderPadding.top + rs.mBorderPadding.right;  }  ir.Init(x, y, availableWidth, availableHeight);  // First reflow our current children  nsIFrame* frame = mFrames.FirstChild();  PRBool done = PR_FALSE;  while (nsnull != frame) {    rv = ReflowInlineFrame(rs, frame, aStatus);    if (NS_FAILED(rv) || (NS_FRAME_COMPLETE != aStatus)) {      done = PR_TRUE;      break;    }    rs.prevFrame = frame;    frame->GetNextSibling(&frame);  }  // Attempt to pull frames from our next-in-flow until we can't  if (!done && (nsnull != mNextInFlow)) {    while (!done) {      PRBool isComplete;      frame = PullInlineFrame(rs, &isComplete);      if (nsnull == frame) {        if (!isComplete) {          aStatus = NS_FRAME_NOT_COMPLETE;        }        break;      }      rv = ReflowInlineFrame(rs, frame, aStatus);      if (NS_FAILED(rv) || (NS_FRAME_COMPLETE != aStatus)) {        done = PR_TRUE;        break;      }      rs.prevFrame = frame;    }  }  // Compute final metrics  if (NS_SUCCEEDED(rv)) {#ifdef NS_DEBUG    if (NS_FRAME_COMPLETE == aStatus) {      NS_ASSERTION(mOverflowFrames.IsEmpty(), "whoops");    }#endif    nsInlineReflow* ir = rs.inlineReflow;    nsRect bbox;    ir->VerticalAlignFrames(bbox, aMetrics.ascent, aMetrics.descent);    // XXX what about our border/padding and the combined area?    ir->RelativePositionFrames(aMetrics.mCombinedArea);    aMetrics.width = bbox.width;    if (NS_FRAME_IS_COMPLETE(aStatus)) {      aMetrics.width += rs.mBorderPadding.right;    }    aMetrics.height = bbox.height;    aMetrics.mCarriedOutTopMargin = 0;    aMetrics.mCarriedOutBottomMargin = 0;    if (nsnull != aMetrics.maxElementSize) {      *aMetrics.maxElementSize = ir->GetMaxElementSize();    }  }  rs.lineLayout->PopInline();  return rv;}