NS_ASSERTION(mStackPos > 0, "leaf w/o container"); if (mStackPos <= 0) { return NS_ERROR_FAILURE; } nsIHTMLContent* parent = mStack[mStackPos-1].mContent;   if (mStack[mStackPos-1].mInsertionPoint != -1) { parent->InsertChildAt(aContent, mStack[mStackPos-1].mInsertionPoint++, PR_FALSE, PR_FALSE); } else { parent->AppendChildTo(aContent, PR_FALSE, PR_FALSE);
MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddLeaf()\n")); MOZ_TIMER_START(mWatch); nsresult rv;  nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType()); switch (nodeType) { case eHTMLTag_area: rv = ProcessAREATag(aNode); break;  case eHTMLTag_base: mCurrentContext->FlushTextAndRelease(); rv = ProcessBASETag(aNode); break;  case eHTMLTag_link: mCurrentContext->FlushTextAndRelease(); rv = ProcessLINKTag(aNode); break;  case eHTMLTag_meta: mCurrentContext->FlushTextAndRelease(); rv = ProcessMETATag(aNode); break;  case eHTMLTag_style: mCurrentContext->FlushTextAndRelease(); rv = ProcessSTYLETag(aNode); break;  case eHTMLTag_script: mCurrentContext->FlushTextAndRelease(); rv = ProcessSCRIPTTag(aNode); break;  default: rv = mCurrentContext->AddLeaf(aNode); break;
SinkContext::AddLeaf(nsIHTMLContent* aContent){  NS_ASSERTION(mStackPos > 0, "leaf w/o container");  if (mStackPos <= 0) {    return NS_ERROR_FAILURE;  }  nsIHTMLContent* parent = mStack[mStackPos-1].mContent;  // If the parent has an insertion point, insert rather than  // append.  if (mStack[mStackPos-1].mInsertionPoint != -1) {    parent->InsertChildAt(aContent,                           mStack[mStackPos-1].mInsertionPoint++,                           PR_FALSE, PR_FALSE);  }  else {    parent->AppendChildTo(aContent, PR_FALSE, PR_FALSE);  }  DidAddContent(aContent, PR_FALSE);#ifdef DEBUG  if (mPreAppend &&       SINK_LOG_TEST(gSinkLogModuleInfo,SINK_ALWAYS_REFLOW)) {    mSink->ForceReflow();  }#endif  return NS_OK;}