if (nsIFrame::GetVerifyTreeEnable()) { rootFrame->VerifyTree();
if (nsIFrameDebug::GetVerifyTreeEnable()) { nsIFrameDebug*  frameDebug;  if (NS_SUCCEEDED(rootFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) { frameDebug->VerifyTree(); }
PresShell::InitialReflow(nscoord aWidth, nscoord aHeight){  nsIContent* root = nsnull;  StCaretHider  caretHider(this);			// stack-based class hides caret until dtor.    EnterReflowLock();  if (mPresContext) {    nsRect r(0, 0, aWidth, aHeight);    mPresContext->SetVisibleArea(r);  }  if (mDocument) {    root = mDocument->GetRootContent();  }  // Get the root frame from the frame manager  nsIFrame* rootFrame;  mFrameManager->GetRootFrame(&rootFrame);    if (nsnull != root) {    RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));    NS_RESET_AND_START_STOPWATCH(mFrameCreationWatch)    if (!rootFrame) {      // Have style sheet processor construct a frame for the      // precursors to the root content object's frame      mStyleSet->ConstructRootFrame(mPresContext, root, rootFrame);      mFrameManager->SetRootFrame(rootFrame);    }    // Have the style sheet processor construct frame for the root    // content object down    mStyleSet->ContentInserted(mPresContext, nsnull, root, 0);    NS_RELEASE(root);    VERIFY_STYLE_TREE;    RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", this));    NS_STOP_STOPWATCH(mFrameCreationWatch)  }  if (rootFrame) {    RAPTOR_STOPWATCH_DEBUGTRACE(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n", this));    NS_RESET_AND_START_STOPWATCH(mReflowWatch)    // Kick off a top-down reflow    NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,                 ("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight));#ifdef NS_DEBUG    if (nsIFrame::GetVerifyTreeEnable()) {      rootFrame->VerifyTree();    }#endif#ifdef DEBUG_kipp    nsPresShell_ReflowStackPointerTop = (char*) &aWidth;#endif    nsRect                bounds;    mPresContext->GetVisibleArea(bounds);    nsSize                maxSize(bounds.width, bounds.height);    nsHTMLReflowMetrics   desiredSize(nsnull);    nsReflowStatus        status;    nsIRenderingContext*  rcx = nsnull;    CreateRenderingContext(rootFrame, &rcx);    nsHTMLReflowState reflowState(*mPresContext, rootFrame,                                  eReflowReason_Initial, rcx, maxSize);    rootFrame->Reflow(*mPresContext, desiredSize, reflowState, status);    rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height);    mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));      #ifdef NS_DEBUG    if (nsIFrame::GetVerifyTreeEnable()) {      rootFrame->VerifyTree();    }#endif    VERIFY_STYLE_TREE;    NS_IF_RELEASE(rcx);    NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow"));    RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Reflow: PresShell::InitialReflow(), this=%p\n", this));    NS_STOP_STOPWATCH(mReflowWatch)  }  ExitReflowLock();  if (mViewManager && mCaret && !mViewEventListener) {    nsIScrollableView* scrollingView = nsnull;    mViewManager->GetRootScrollableView(&scrollingView);    if (scrollingView) {      mViewEventListener = new PresShellViewEventListener;      if (!mViewEventListener)        return NS_ERROR_OUT_OF_MEMORY;      NS_ADDREF(mViewEventListener);      mViewEventListener->SetPresShell(this);      scrollingView->AddScrollPositionListener((nsIScrollPositionListener *)mViewEventListener);      mViewManager->AddCompositeListener((nsICompositeListener *)mViewEventListener);    }  }  return NS_OK; //XXX this needs to be real. MMP}