From 866b1583c9e97b5f4feccd19775c17ff5f644dd3 Mon Sep 17 00:00:00 2001 From: kipp Date: Fri, 26 Jun 1998 16:12:51 +0000 Subject: [PATCH] Make a title object that's a child of the head when we get a title git-svn-id: svn://10.0.0.236/trunk@4580 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 17 +++++++++++++++++ .../html/document/src/nsHTMLContentSink.cpp | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index a7d4468c574..2432cac056d 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -341,6 +341,23 @@ PRInt32 HTMLContentSink::SetTitle(const nsString& aValue) } mTitle->CompressWhitespace(PR_TRUE, PR_TRUE); ((nsHTMLDocument*)mDocument)->SetTitle(*mTitle); + + if (nsnull == mHead) { + nsIAtom* atom = NS_NewAtom("HEAD"); + nsresult rv = NS_NewHTMLHead(&mHead, atom); + if (NS_OK == rv) { + mRoot->InsertChildAt(mHead, 0, PR_FALSE); + } + NS_RELEASE(atom); + } + + nsIAtom* atom = NS_NewAtom("TITLE"); + nsIHTMLContent* it = nsnull; + nsresult rv = NS_NewHTMLTitle(&it, atom, aValue); + if (NS_OK == rv) { + mHead->AppendChild(it, PR_FALSE); + } + NS_RELEASE(atom); return 0; } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index a7d4468c574..2432cac056d 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -341,6 +341,23 @@ PRInt32 HTMLContentSink::SetTitle(const nsString& aValue) } mTitle->CompressWhitespace(PR_TRUE, PR_TRUE); ((nsHTMLDocument*)mDocument)->SetTitle(*mTitle); + + if (nsnull == mHead) { + nsIAtom* atom = NS_NewAtom("HEAD"); + nsresult rv = NS_NewHTMLHead(&mHead, atom); + if (NS_OK == rv) { + mRoot->InsertChildAt(mHead, 0, PR_FALSE); + } + NS_RELEASE(atom); + } + + nsIAtom* atom = NS_NewAtom("TITLE"); + nsIHTMLContent* it = nsnull; + nsresult rv = NS_NewHTMLTitle(&it, atom, aValue); + if (NS_OK == rv) { + mHead->AppendChild(it, PR_FALSE); + } + NS_RELEASE(atom); return 0; }