*getter_AddRefs(nodeInfo));
getter_AddRefs(nodeInfo));
nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode){  NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_NOT_INITIALIZED);    nsresult result = NS_OK;  switch (aNode.GetTokenType()) {    case eToken_start:      {        FlushText();                // Create new leaf content object        nsCOMPtr<nsIHTMLContent> content;        nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());        nsIParserService* parserService =          nsContentUtils::GetParserServiceWeakRef();        if (!parserService)          return NS_ERROR_OUT_OF_MEMORY;        nsCOMPtr<nsINodeInfo> nodeInfo;        if (nodeType == eHTMLTag_userdefined) {           result =            mNodeInfoManager->GetNodeInfo(aNode.GetText(), nsnull,                                          kNameSpaceID_None,                                          *getter_AddRefs(nodeInfo));        } else {          const PRUnichar *name = nsnull;          result = parserService->HTMLIdToStringTag(nodeType, &name);          NS_ASSERTION(name, "This should not happen!");          result =            mNodeInfoManager->GetNodeInfo(nsDependentString(name), nsnull,                                          kNameSpaceID_None,                                          *getter_AddRefs(nodeInfo));        }        NS_ENSURE_SUCCESS(result, result);        if(NS_SUCCEEDED(result)) {          result = NS_CreateHTMLElement(getter_AddRefs(content), nodeInfo, PR_FALSE);          if (NS_OK == result) {            result = AddAttributes(aNode, content);            if (NS_OK == result) {              nsIContent *parent = GetCurrentContent();                          if (nsnull == parent) {                parent = mRoot;              }                          parent->AppendChildTo(content, PR_FALSE, PR_FALSE);            }          }          if(nodeType == eHTMLTag_plaintext ||              nodeType == eHTMLTag_script    ||             nodeType == eHTMLTag_style     ||             nodeType == eHTMLTag_textarea  ||             nodeType == eHTMLTag_xmp) {                        // Create a text node holding the content            nsCOMPtr<nsIDTD> dtd;            mParser->GetDTD(getter_AddRefs(dtd));            NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE);                nsAutoString skippedContent;            PRInt32 lineNo = 0;            dtd->CollectSkippedContent(nodeType, skippedContent, lineNo);            result=AddTextToContent(content, skippedContent);          }          else if (nodeType == eHTMLTag_img || nodeType == eHTMLTag_frame              || nodeType == eHTMLTag_input)    // elements with 'SRC='              AddBaseTagInfo(content);          else if (nodeType == eHTMLTag_base)              ProcessBaseTag(content);        }      }      break;    case eToken_text:    case eToken_whitespace:    case eToken_newline:      result = AddText(aNode.GetText());      break;          case eToken_entity:      {        nsAutoString tmp;        PRInt32 unicode = aNode.TranslateToUnicodeStr(tmp);        if (unicode < 0) {          result = AddText(aNode.GetText());        }        else {          result = AddText(tmp);        }      }      break;  }    return result;}