if (aNodeType == eHTMLTag_textarea) { nsCOMPtr<nsIDTD> dtd; mParser->GetDTD(getter_AddRefs(dtd)); NS_ENSURE_TRUE(dtd, nsnull);  PRInt32 lineNo = 0;  dtd->CollectSkippedContent(eHTMLTag_textarea, mSkippedContent, lineNo); }
HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,                                     nsHTMLTag aNodeType,                                     nsGenericHTMLElement* aForm,                                     nsIDocShell* aDocShell){  nsresult rv = NS_OK;  // Find/create atom for the tag name  nsCOMPtr<nsINodeInfo> nodeInfo;  if (aNodeType == eHTMLTag_userdefined) {    NS_ConvertUTF16toUTF8 tmp(aNode.GetText());    ToLowerCase(tmp);    nsCOMPtr<nsIAtom> name = do_GetAtom(tmp);    rv = mNodeInfoManager->GetNodeInfo(name, nsnull, kNameSpaceID_None,                                       getter_AddRefs(nodeInfo));  } else {    nsCOMPtr<nsIDTD> dtd;    rv = mParser->GetDTD(getter_AddRefs(dtd));    if (NS_SUCCEEDED(rv)) {      rv = mNodeInfoManager->GetNodeInfo(dtd->IntTagToAtom(aNodeType), nsnull,                                         kNameSpaceID_None,                                         getter_AddRefs(nodeInfo));    }  }  NS_ENSURE_SUCCESS(rv, nsnull);  // XXX if the parser treated the text in a textarea like a normal  // textnode we wouldn't need to do this.  if (aNodeType == eHTMLTag_textarea) {    nsCOMPtr<nsIDTD> dtd;    mParser->GetDTD(getter_AddRefs(dtd));    NS_ENSURE_TRUE(dtd, nsnull);    PRInt32 lineNo = 0;    dtd->CollectSkippedContent(eHTMLTag_textarea, mSkippedContent, lineNo);  }  // Make the content object  nsGenericHTMLElement* result = MakeContentObject(aNodeType, nodeInfo, aForm,                                             !!mInsideNoXXXTag, PR_TRUE).get();  if (!result) {    return nsnull;  }  if (aNodeType == eHTMLTag_textarea && !mSkippedContent.IsEmpty()) {    // XXX: if the parser treated the text in a textarea like a normal    // textnode we wouldn't need to do this.    // If the text area has some content, set it    // Strip only one leading newline if there is one (bug 40394)    nsString::const_iterator start, end;    mSkippedContent.BeginReading(start);    mSkippedContent.EndReading(end);    if (*start == nsCRT::CR) {      ++start;      if (start != end && *start == nsCRT::LF) {        ++start;      }    } else if (*start == nsCRT::LF) {      ++start;    }    nsCOMPtr<nsIDOMHTMLTextAreaElement> ta(do_QueryInterface(result));    NS_ASSERTION(ta, "Huh? text area doesn't implement "                 "nsIDOMHTMLTextAreaElement?");    ta->SetDefaultValue(Substring(start, end));    // Release whatever's in the skipped content string, no point in    // holding on to this any longer.    mSkippedContent.Truncate();  }  result->SetContentID(mDocument->GetAndIncrementContentID());  return result;}