mFlags |= NS_SINK_FLAG_FORM_ON_STACK;
HTMLContentSink::OpenForm(const nsIParserNode& aNode){  MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::OpenForm()\n"));  MOZ_TIMER_START(mWatch);  nsresult result = NS_OK;  nsIHTMLContent* content = nsnull;    mCurrentContext->FlushTextAndRelease();    SINK_TRACE_NODE(SINK_TRACE_CALLS,                  "HTMLContentSink::OpenForm", aNode,                   mCurrentContext->mStackPos, this);    // Close out previous form if it's there. If there is one  // around, it's probably because the last one wasn't well-formed.  NS_IF_RELEASE(mCurrentForm);    // Check if the parent is a table, tbody, thead, tfoot, tr, col or  // colgroup. If so, we fix up by making the form leaf content.  if (mCurrentContext->IsCurrentContainer(eHTMLTag_table) ||      mCurrentContext->IsCurrentContainer(eHTMLTag_tbody) ||      mCurrentContext->IsCurrentContainer(eHTMLTag_thead) ||      mCurrentContext->IsCurrentContainer(eHTMLTag_tfoot) ||      mCurrentContext->IsCurrentContainer(eHTMLTag_tr) ||      mCurrentContext->IsCurrentContainer(eHTMLTag_col) ||      mCurrentContext->IsCurrentContainer(eHTMLTag_colgroup)) {    nsCOMPtr<nsINodeInfo> nodeInfo;    result = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::form, nsnull,                                           kNameSpaceID_None,                                           *getter_AddRefs(nodeInfo));    NS_ENSURE_SUCCESS(result, result);    result = NS_NewHTMLFormElement(&content, nodeInfo);    if (NS_SUCCEEDED(result) && content) {      content->QueryInterface(NS_GET_IID(nsIDOMHTMLFormElement), (void**)&mCurrentForm);      NS_RELEASE(content);    }        result = AddLeaf(aNode);  }  else {    // Otherwise the form can be a content parent.    result = mCurrentContext->OpenContainer(aNode);    if (NS_SUCCEEDED(result)) {              content = mCurrentContext->GetCurrentContainer();      if (nsnull != content) {        result = content->QueryInterface(NS_GET_IID(nsIDOMHTMLFormElement),                                          (void**)&mCurrentForm);        NS_RELEASE(content);      }    }  }     MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenForm()\n"));  MOZ_TIMER_STOP(mWatch);  return result;}