content->Compact();     if (mNotifyLevel >= mStackPos) {    if (mStack[mStackPos].mNumFlushed < content->GetChildCount()) { #ifdef NS_DEBUG {  const char *tagStr; mStack[mStackPos].mContent->Tag()->GetUTF8String(&tagStr);  SINK_TRACE(SINK_TRACE_REFLOW, ("SinkContext::CloseContainer: reflow on notifyImmediate " "tag=%s newIndex=%d stackPos=%d", tagStr, mStack[mStackPos].mNumFlushed, mStackPos)); } #endif mSink->NotifyAppend(content, mStack[mStackPos].mNumFlushed); }   mNotifyLevel = mStackPos - 1; }  if (mSink->IsMonolithicContainer(nodeType)) { --mSink->mInMonolithicContainer; }  DidAddContent(content, PR_FALSE);   switch (nodeType) { case eHTMLTag_noembed: case eHTMLTag_noframes:  NS_ASSERTION((mSink->mInsideNoXXXTag > 0), "mInsideNoXXXTag underflow"); if (mSink->mInsideNoXXXTag > 0) { mSink->mInsideNoXXXTag--; }  break; case eHTMLTag_form: { mSink->mFlags &= ~NS_SINK_FLAG_FORM_ON_STACK;      if (aTag != nodeType) { result = CloseContainer(aTag); } }  break; case eHTMLTag_iframe: mSink->mNumOpenIFRAMES--;  break; case eHTMLTag_select: case eHTMLTag_textarea: case eHTMLTag_object: case eHTMLTag_applet: content->DoneAddingChildren();  break; default: break; }  NS_IF_RELEASE(content);  #ifdef DEBUG if (SINK_LOG_TEST(gSinkLogModuleInfo, SINK_ALWAYS_REFLOW)) { mSink->ForceReflow(); } #endif  return result;
return rv;
SinkContext::CloseContainer(const nsHTMLTag aTag){  nsresult result = NS_OK;  // Flush any collected text content. Release the last text  // node to indicate that no more should be added to it.  FlushTextAndRelease();  SINK_TRACE_NODE(SINK_TRACE_CALLS,                  "SinkContext::CloseContainer",                   aTag, mStackPos - 1, mSink);  NS_WARN_IF_FALSE(mStackPos > 0,                   "stack out of bounds. wrong context probably!");  if (mStackPos <= 0) {    return NS_OK; // Fix crash - Ref. bug 45975 or 45007  }  --mStackPos;  nsHTMLTag nodeType = mStack[mStackPos].mType;  nsGenericHTMLElement* content = mStack[mStackPos].mContent;  content->Compact();  // If we're in a state where we do append notifications as  // we go up the tree, and we're at the level where the next  // notification needs to be done, do the notification.  if (mNotifyLevel >= mStackPos) {    // Check to see if new content has been added after our last    // notification    if (mStack[mStackPos].mNumFlushed < content->GetChildCount()) {#ifdef NS_DEBUG      {        // Tracing code        const char *tagStr;        mStack[mStackPos].mContent->Tag()->GetUTF8String(&tagStr);        SINK_TRACE(SINK_TRACE_REFLOW,                   ("SinkContext::CloseContainer: reflow on notifyImmediate "                    "tag=%s newIndex=%d stackPos=%d",                    tagStr,                    mStack[mStackPos].mNumFlushed, mStackPos));      }#endif      mSink->NotifyAppend(content, mStack[mStackPos].mNumFlushed);    }    // Indicate that notification has now happened at this level    mNotifyLevel = mStackPos - 1;  }  if (mSink->IsMonolithicContainer(nodeType)) {    --mSink->mInMonolithicContainer;  }  DidAddContent(content, PR_FALSE);  // Special handling for certain tags  switch (nodeType) {  case eHTMLTag_noembed:  case eHTMLTag_noframes:    // Fix bug 40216    NS_ASSERTION((mSink->mInsideNoXXXTag > 0), "mInsideNoXXXTag underflow");    if (mSink->mInsideNoXXXTag > 0) {      mSink->mInsideNoXXXTag--;    }    break;  case eHTMLTag_form:    {      mSink->mFlags &= ~NS_SINK_FLAG_FORM_ON_STACK;      // If there's a FORM on the stack, but this close tag doesn't      // close the form, then close out the form *and* close out the      // next container up. This is since the parser doesn't do fix up      // of invalid form nesting. When the end FORM tag comes through,      // we'll ignore it.      if (aTag != nodeType) {        result = CloseContainer(aTag);      }    }    break;  case eHTMLTag_iframe:    mSink->mNumOpenIFRAMES--;    break;  case eHTMLTag_select:  case eHTMLTag_textarea:  case eHTMLTag_object:  case eHTMLTag_applet:    content->DoneAddingChildren();    break;  default:    break;  }  NS_IF_RELEASE(content);#ifdef DEBUG  if (SINK_LOG_TEST(gSinkLogModuleInfo, SINK_ALWAYS_REFLOW)) {    mSink->ForceReflow();  }#endif  return result;}