NS_ASSERTION(nsnull == mOverflowLines, "bad overflow list");
nsCSSBlockFrame::Reflow(nsIPresContext&      aPresContext,                        nsISpaceManager*     aSpaceManager,                        nsReflowMetrics&     aMetrics,                        const nsReflowState& aReflowState,                        nsRect&              aDesiredRect,                        nsReflowStatus&      aStatus){  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("enter nsCSSBlockFrame::Reflow: maxSize=%d,%d reason=%d [%d,%d,%c]",      aReflowState.maxSize.width,      aReflowState.maxSize.height,      aReflowState.reason,      GetFirstContentOffset(), GetLastContentOffset(),      GetLastContentIsComplete()?'T':'F'));  // If this is the initial reflow, generate any synthetic content  // that needs generating.  if (eReflowReason_Initial == aReflowState.reason) {    NS_ASSERTION(0 != (NS_FRAME_FIRST_REFLOW & mState), "bad mState");  }  else {    NS_ASSERTION(0 == (NS_FRAME_FIRST_REFLOW & mState), "bad mState");  }  // Replace parent provided reflow state with our own significantly  // more extensive version.  nsCSSBlockReflowState state(&aPresContext, aSpaceManager,                              this, mStyleContext,                              aReflowState, aMetrics,                              PRBool(nsnull != aMetrics.maxElementSize));  nsresult rv = NS_OK;  if (eReflowReason_Initial == state.reason) {    if (!DrainOverflowLines()) {      rv = InitialReflow(state);    }    else {      rv = ResizeReflow(state);    }    mState &= ~NS_FRAME_FIRST_REFLOW;  }  else if (eReflowReason_Incremental == state.reason) {    NS_ASSERTION(nsnull == mOverflowLines, "bad overflow list");    nsIFrame* target;    state.reflowCommand->GetTarget(target);    if (this == target) {      nsIReflowCommand::ReflowType type;      state.reflowCommand->GetType(type);      switch (type) {      case nsIReflowCommand::FrameAppended:        rv = FrameAppendedReflow(state);        break;      case nsIReflowCommand::FrameInserted:        rv = FrameInsertedReflow(state);        break;      case nsIReflowCommand::FrameDeleted:        rv = FrameDeletedReflow(state);        break;      default:        NS_NOTYETIMPLEMENTED("XXX");      }    }    else {      // Get next frame in reflow command chain      state.reflowCommand->GetNext(state.mInlineLayout.mNextRCFrame);      // Now do the reflow      rv = ChildIncrementalReflow(state);    }  }  else if (eReflowReason_Resize == state.reason) {    DrainOverflowLines();    rv = ResizeReflow(state);  }#ifdef DTPF  // Update content offsets; we don't track them normally but we do  // need them because we are a pseudo-frame  if (nsnull != mLines) {    nsIFrame* firstChild = mLines->mFirstChild;    if (nsnull != firstChild) {      firstChild->GetContentIndex(mFirstContentOffset);    }    LineData* line = mLines;    while (nsnull != line->mNext) {      NS_ASSERTION(line->mChildCount > 0, "empty line left on list");      line = line->mNext;    }    line->LastChild()->GetContentIndex(mLastContentOffset);    mLastContentIsComplete = line->GetLastContentIsComplete();  }  if (state.mBlockIsPseudo) {    // Tell our parent to update it's offsets because our offsets have    // changed.    nsContainerFrame* parent = (nsContainerFrame*) mGeometricParent;    parent->PropagateContentOffsets(this, mFirstContentOffset,                                    mLastContentOffset,                                    mLastContentIsComplete);  }#endif  // Compute our final size  ComputeFinalSize(state, aMetrics, aDesiredRect);#ifdef NS_DEBUG  if (GetVerifyTreeEnable()) {    VerifyChildCount(mLines);    VerifyLines(mLines);  }#endif  aStatus = rv;  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("exit nsCSSBlockFrame::Reflow: size=%d,%d rv=%x [%d,%d,%c]",      aMetrics.width, aMetrics.height, rv,      GetFirstContentOffset(), GetLastContentOffset(),      GetLastContentIsComplete()?'T':'F'));  return NS_OK;}