nsresult rv; if (mFrames.IsEmpty()) { #ifdef HAVE_ANONYMOUS_BLOCK NS_ASSERTION(!HaveAnonymousBlock(), "bad state");
nsMargin borderPadding; styleSpacing->CalcBorderPaddingFor(this, borderPadding); nsInlineState state(aPresContext, this, styleFont, borderPadding, aReflowState.maxSize, aDesiredSize.maxElementSize); InitializeState(aPresContext, state); state.SetNumAscents(mContent->ChildCount() - mFirstContentOffset);  if (eReflowReason_Incremental == aReflowState.reason) { NS_ASSERTION(nsnull != aReflowState.reflowCommand, "null reflow command"); if (aReflowState.reflowCommand->GetTarget() == this) { switch (aReflowState.reflowCommand->GetType()) { case nsReflowCommand::FrameAppended:  RecoverState(aPresContext, state, nsnull); aStatus = ReflowUnmappedChildren(aPresContext, state); break;  default: NS_NOTYETIMPLEMENTED("unexpected reflow command"); break; }  } else {  nsIFrame*       kidFrame = aReflowState.reflowCommand->GetNext(); nsReflowMetrics kidSize(aDesiredSize.maxElementSize); nsReflowState   kidReflowState(aReflowState.reflowCommand, state.availSize);   PRInt32 kidIndex = RecoverState(aPresContext, state, kidFrame);   aStatus = ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState);   if (!DidFitChild(aPresContext, state, kidFrame, kidSize)) { nsIFrame* prevFrame;    PrevChild(kidFrame, prevFrame); PushChildren(kidFrame, prevFrame, mLastContentIsComplete); SetLastContentOffset(prevFrame); mChildCount = kidIndex - 1; aStatus = NS_FRAME_NOT_COMPLETE;  } else {  PlaceChild(kidFrame, kidIndex, state, kidSize, nsnull);  nsIFrame* kidNextInFlow; kidFrame->GetNextInFlow(kidNextInFlow);   if (NS_FRAME_IS_COMPLETE(aStatus)) {  if (nsnull != kidNextInFlow) {  DeleteChildsNextInFlow(kidFrame); }   aStatus = IncrementalReflowAfter(aPresContext, state, kidFrame, kidIndex);  } else { nsIFrame* nextSibling;   if (nsnull == kidNextInFlow) {   nsIFrame* continuingFrame;  nsIStyleContextPtr kidSC; kidFrame->GetStyleContext(aPresContext, kidSC.AssignRef()); kidFrame->CreateContinuingFrame(aPresContext, this, kidSC, continuingFrame);   kidFrame->GetNextSibling(nextSibling); continuingFrame->SetNextSibling(nextSibling); kidFrame->SetNextSibling(continuingFrame); }    kidFrame->GetNextSibling(nextSibling); if (nsnull != nextSibling) { PushChildren(nextSibling, kidFrame, mLastContentIsComplete); }  SetLastContentOffset(kidFrame); mChildCount = kidIndex; } } }  } else {  if (nsnull != mFirstChild) { reflowMappedOK = ReflowMappedChildrenFrom(aPresContext, state, mFirstChild, 0);  if (PR_FALSE == reflowMappedOK) {  aStatus = NS_FRAME_NOT_COMPLETE; } }   if (PR_TRUE == reflowMappedOK) { #if XXX  if (state.availSize.width <= 0) {  if (NextChildOffset() < mContent->ChildCount()) {  aStatus = NS_FRAME_NOT_COMPLETE; } } else
nsInlineFrame::Reflow(nsIPresContext&          aPresContext,                      nsHTMLReflowMetrics&     aMetrics,                      const nsHTMLReflowState& aReflowState,                      nsReflowStatus&          aStatus){  DrainOverflow();  ReflowState rs(aPresContext, aReflowState, aMetrics,                 (nsInlineFrame*) mNextInFlow);  // Peel off the next frame in the path if this is an incremental  // reflow aimed at one of the children.  if (eReflowReason_Incremental == aReflowState.reason) {    nsIFrame* target;    rs.reflowCommand->GetTarget(target);    if (this != target) {      rs.reflowCommand->GetNext(rs.mNextRCFrame);    }  }  nsresult rv;  if (mFrames.IsEmpty()) {#ifdef HAVE_ANONYMOUS_BLOCK    NS_ASSERTION(!HaveAnonymousBlock(), "bad state");#endif    // Try to pull over one frame before starting so that we know what    // state the HAVE_ANONYMOUS_BLOCK flag should be in.    nsIFrame* frame = PullAnyFrame(rs);    if (nsnull != frame) {#ifdef HAVE_ANONYMOUS_BLOCK      if (nsLineLayout::TreatFrameAsBlock(frame)) {        mState |= HAVE_ANONYMOUS_BLOCK;      }#endif    }    else {      aStatus = NS_FRAME_COMPLETE;      aMetrics.width = 0;      aMetrics.height = 0;      aMetrics.ascent = 0;      aMetrics.descent = 0;      aMetrics.mCarriedOutTopMargin = 0;      aMetrics.mCarriedOutBottomMargin = 0;      aMetrics.mCombinedArea.SetRect(0, 0, 0, 0);      if (nsnull != aMetrics.maxElementSize) {        aMetrics.maxElementSize->SizeTo(0, 0);      }      return NS_OK;    }  }  if (HaveAnonymousBlock()) {    rv = ReflowBlockFrame(rs, aMetrics, aStatus);  }  else {    rv = ReflowInlineFrames(rs, aMetrics, aStatus);  }  if (NS_SUCCEEDED(rv)) {    // If the combined area of our children exceeds our bounding box    // then set the NS_FRAME_OUTSIDE_CHILDREN flag, otherwise clear it.    if ((aMetrics.mCombinedArea.x < 0) ||        (aMetrics.mCombinedArea.y < 0) ||        (aMetrics.mCombinedArea.XMost() > aMetrics.width) ||        (aMetrics.mCombinedArea.YMost() > aMetrics.height)) {      mState |= NS_FRAME_OUTSIDE_CHILDREN;    }    else {      mState &= ~NS_FRAME_OUTSIDE_CHILDREN;    }  }  return rv;}