From 5669e4858d8c57d6c297dac5dbba7e17d4189fb9 Mon Sep 17 00:00:00 2001 From: kipp Date: Thu, 4 Jun 1998 21:33:44 +0000 Subject: [PATCH] Create head part and insert it into the model git-svn-id: svn://10.0.0.236/trunk@3263 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 15 ++++++++++++++- .../html/document/src/nsHTMLContentSink.cpp | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index b944e3d9b84..233a8cf8f08 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -206,6 +206,7 @@ protected: nsIHTMLContent* mRoot; nsIHTMLContent* mBody; + nsIHTMLContent* mHead; PRTime mLastUpdateTime; PRTime mUpdateDelta; @@ -228,6 +229,7 @@ HTMLContentSink::HTMLContentSink() HTMLContentSink::~HTMLContentSink() { + NS_IF_RELEASE(mHead); NS_IF_RELEASE(mBody); NS_IF_RELEASE(mRoot); NS_IF_RELEASE(mDocument); @@ -291,7 +293,18 @@ PRInt32 HTMLContentSink::OpenHead(const nsIParserNode& aNode) { NOISY_SINK_TRACE("OpenHead", aNode) - mNodeStack[mStackPos++] = (eHTMLTags)aNode.GetNodeType(); + 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); + } + + mNodeStack[mStackPos] = (eHTMLTags)aNode.GetNodeType(); + mContainerStack[mStackPos] = mHead; + mStackPos++; return 0; } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index b944e3d9b84..233a8cf8f08 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -206,6 +206,7 @@ protected: nsIHTMLContent* mRoot; nsIHTMLContent* mBody; + nsIHTMLContent* mHead; PRTime mLastUpdateTime; PRTime mUpdateDelta; @@ -228,6 +229,7 @@ HTMLContentSink::HTMLContentSink() HTMLContentSink::~HTMLContentSink() { + NS_IF_RELEASE(mHead); NS_IF_RELEASE(mBody); NS_IF_RELEASE(mRoot); NS_IF_RELEASE(mDocument); @@ -291,7 +293,18 @@ PRInt32 HTMLContentSink::OpenHead(const nsIParserNode& aNode) { NOISY_SINK_TRACE("OpenHead", aNode) - mNodeStack[mStackPos++] = (eHTMLTags)aNode.GetNodeType(); + 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); + } + + mNodeStack[mStackPos] = (eHTMLTags)aNode.GetNodeType(); + mContainerStack[mStackPos] = mHead; + mStackPos++; return 0; }