From 5f8683257992cf5625cde34325608cc72d35f2cf Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Wed, 1 Sep 1999 23:36:57 +0000 Subject: [PATCH] 12085: Add meta tag to specify charset --- htmlparser/src/nsHTMLContentSinkStream.cpp | 34 ++++++++++++++----- .../src/nsHTMLContentSinkStream.cpp | 34 ++++++++++++++----- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/htmlparser/src/nsHTMLContentSinkStream.cpp b/htmlparser/src/nsHTMLContentSinkStream.cpp index 1e72e280b6e..68c98919926 100644 --- a/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -705,10 +705,12 @@ nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){ * @return PR_TRUE if successful. */ NS_IMETHODIMP -nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){ +nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode) +{ eHTMLTags tag = (eHTMLTags)aNode.GetNodeType(); if (tag == eHTMLTag_head) AddStartTag(aNode); + return NS_OK; } @@ -930,6 +932,26 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode) if (IndentChildren(tag)) mIndent++; + + if (tag == eHTMLTag_head) + { + if (mCharsetOverride.Length() > 0) + { + Write(NS_LINEBREAK); + Write(""); + Write(NS_LINEBREAK); + } + + if(mDoHeader) + { + Write(gHeaderComment); + Write(NS_LINEBREAK); + Write(gDocTypeHeader); + Write(NS_LINEBREAK); + } + } } @@ -1240,14 +1262,10 @@ nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){ * @update 5/7/98 gess */ NS_IMETHODIMP -nsHTMLContentSinkStream::WillBuildModel(void){ +nsHTMLContentSinkStream::WillBuildModel(void) +{ mTabLevel=-1; - if(mDoHeader) { - Write(gHeaderComment); - Write(NS_LINEBREAK); - Write(gDocTypeHeader); - Write(NS_LINEBREAK); - } + return NS_OK; } diff --git a/parser/htmlparser/src/nsHTMLContentSinkStream.cpp b/parser/htmlparser/src/nsHTMLContentSinkStream.cpp index 1e72e280b6e..68c98919926 100644 --- a/parser/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/parser/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -705,10 +705,12 @@ nsHTMLContentSinkStream::CloseHTML(const nsIParserNode& aNode){ * @return PR_TRUE if successful. */ NS_IMETHODIMP -nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode){ +nsHTMLContentSinkStream::OpenHead(const nsIParserNode& aNode) +{ eHTMLTags tag = (eHTMLTags)aNode.GetNodeType(); if (tag == eHTMLTag_head) AddStartTag(aNode); + return NS_OK; } @@ -930,6 +932,26 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode) if (IndentChildren(tag)) mIndent++; + + if (tag == eHTMLTag_head) + { + if (mCharsetOverride.Length() > 0) + { + Write(NS_LINEBREAK); + Write(""); + Write(NS_LINEBREAK); + } + + if(mDoHeader) + { + Write(gHeaderComment); + Write(NS_LINEBREAK); + Write(gDocTypeHeader); + Write(NS_LINEBREAK); + } + } } @@ -1240,14 +1262,10 @@ nsHTMLContentSinkStream::CloseContainer(const nsIParserNode& aNode){ * @update 5/7/98 gess */ NS_IMETHODIMP -nsHTMLContentSinkStream::WillBuildModel(void){ +nsHTMLContentSinkStream::WillBuildModel(void) +{ mTabLevel=-1; - if(mDoHeader) { - Write(gHeaderComment); - Write(NS_LINEBREAK); - Write(gDocTypeHeader); - Write(NS_LINEBREAK); - } + return NS_OK; }