mRoot->List(stdout, 0);
HTMLContentSink::CloseContainer(const nsIParserNode& aNode){  FlushText();  SINK_TRACE_NODE(SINK_TRACE_CALLS,                  "HTMLContentSink::CloseContainer", aNode);  switch (aNode.GetNodeType()) {  case eHTMLTag_map:    NS_NOTREACHED("bad parser: map's in CloseContainer");    NS_IF_RELEASE(mCurrentMap);    return NS_OK;  case eHTMLTag_body:  case eHTMLTag_html:  case eHTMLTag_head:    NS_NOTREACHED("bad parser: calling CloseContainer for bad tag");    return NS_OK;  }  // XXX we could assert things about the top tag name  if (0 == mStackPos) {    // Can't pop empty stack    return NS_OK;  }  --mStackPos;  nsIHTMLContent* container = mContainerStack[mStackPos];  mNodeStack[mStackPos] = eHTMLTag_unknown;  mContainerStack[mStackPos] = nsnull;  nsIHTMLContent* parent = nsnull;  switch (aNode.GetNodeType()) {  case eHTMLTag_option:    ProcessCloseOPTIONTag(aNode);    break;  case eHTMLTag_select:    ProcessCloseSELECTTag(aNode); // add fall through    break;  case eHTMLTag_table:    mInMonolithicContainer--;    break;  }  if (nsnull != container) {    // Now that this container is complete, append it to it's parent    eHTMLTags parentType;    parent = GetCurrentContainer(&parentType);    container->Compact();    // don't append the top level frameset to its parent, this was done in OpenFrameset    // XXX this is necessary because the parser is calling OpenContainer, CloseContainer    // on framesets. It should be calling OpenFrameset.    if (container == mFrameset) {      return CloseFrameset(aNode);    }    if (nsnull != parent) {      PRBool allowReflow = parent == GetBodyOrFrameset();#ifdef NS_DEBUG      if (allowReflow) {        SINK_TRACE(SINK_TRACE_REFLOW,                   ("HTMLContentSink::CloseContainer: reflow after append"));      }#endif            AppendToCorrectParent(parentType, parent,                            (nsHTMLTag) aNode.GetNodeType(), container,                            allowReflow);#ifdef NS_DEBUG      if (allowReflow && (((PRInt32)gSinkLogModuleInfo->level) > 127)) {        PRInt32 i, ns = mDocument->GetNumberOfShells();        for (i = 0; i < ns; i++) {          nsIPresShell* shell = mDocument->GetShellAt(i);          if (nsnull != shell) {            nsIViewManager* vm = shell->GetViewManager();            if(vm) {              nsIView* rootView = vm->GetRootView();              nsRect rect;              rootView->GetBounds(rect);              rect.x = 0;              rect.y = 0;              vm->UpdateView(rootView, rect, NS_VMREFRESH_IMMEDIATE);              NS_RELEASE(rootView);            }            NS_RELEASE(vm);            NS_RELEASE(shell);          }        }        printf("tick...\n");        PR_Sleep(PR_SecondsToInterval(3));      }#endif#if XXX      if (parent == GetBodyOrFrameset()) {        // We just closed a child of the body off. Trigger a        // content-appended reflow if enough time has elapsed        PRTime now = PR_Now();        /* XXX this expression doesn't compile on the Mac           kipp said it had to do with a type issue.           if (now - mLastUpdateTime >= mUpdateDelta) {           mLastUpdateTime = now;           mUpdateDelta += mUpdateDelta;           ReflowNewContent();           }*/      }#endif    }NS_ASSERTION(container != mBody, "whoops");    NS_RELEASE(container);  }  return NS_OK;}