From 383539d22b2c26a781f5f689e98f8eb7813e250b Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Thu, 7 Sep 2000 18:40:14 +0000 Subject: [PATCH] 50821: don't force a bogus 3.2 doctype, and eliminate OutputNoDoctype flag. r=cmanske git-svn-id: svn://10.0.0.236/trunk@78401 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/public/nsIDocumentEncoder.h | 4 ++-- .../html/content/src/nsGenericHTMLElement.cpp | 3 +-- .../ui/composer/content/EditorCommandsDebug.js | 7 +++++++ mozilla/editor/ui/composer/content/editor.js | 4 ++-- .../editor/ui/composer/content/editorOverlay.xul | 2 ++ .../htmlparser/src/nsHTMLContentSinkStream.cpp | 16 ---------------- mozilla/htmlparser/src/nsHTMLContentSinkStream.h | 1 - mozilla/layout/base/public/nsIDocumentEncoder.h | 4 ++-- .../html/content/src/nsGenericHTMLElement.cpp | 3 +-- .../html/forms/src/nsGfxTextControlFrame.cpp | 2 +- .../html/forms/src/nsGfxTextControlFrame2.cpp | 2 +- .../htmlparser/src/nsHTMLContentSinkStream.cpp | 16 ---------------- .../htmlparser/src/nsHTMLContentSinkStream.h | 1 - 13 files changed, 19 insertions(+), 46 deletions(-) diff --git a/mozilla/content/base/public/nsIDocumentEncoder.h b/mozilla/content/base/public/nsIDocumentEncoder.h index e9904a4b273..593875d5e6c 100644 --- a/mozilla/content/base/public/nsIDocumentEncoder.h +++ b/mozilla/content/base/public/nsIDocumentEncoder.h @@ -74,8 +74,8 @@ public: // (Probably not well tested for HTML output.) OutputFormatted = 2, - // Don't output the html doctype and gecko output system comment headers - OutputNoDoctype = 4, + // OutputNoDoctype is obsolete, flag 4 available for other uses + //OutputNoDoctype = 4, // No html head tags OutputBodyOnly = 8, diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 3ac81e954c0..7f1a7d3391a 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -857,8 +857,7 @@ nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML) NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr sink; - rv = NS_New_HTML_ContentSinkStream(getter_AddRefs(sink), &aInnerHTML, - nsIDocumentEncoder::OutputNoDoctype); + rv = NS_New_HTML_ContentSinkStream(getter_AddRefs(sink), &aInnerHTML, 0); NS_ENSURE_SUCCESS(rv, rv); parser->SetContentSink(sink); diff --git a/mozilla/editor/ui/composer/content/EditorCommandsDebug.js b/mozilla/editor/ui/composer/content/EditorCommandsDebug.js index 6ae6ea6e7fb..9abb09618a4 100644 --- a/mozilla/editor/ui/composer/content/EditorCommandsDebug.js +++ b/mozilla/editor/ui/composer/content/EditorCommandsDebug.js @@ -24,6 +24,13 @@ // --------------------------- Output --------------------------- + +function EditorSerialize() +{ + var s = new XMLSerializer(); + dump(s.serializeToString(editorShell.editorDocument) + "\n"); +} + function EditorGetText() { if (editorShell) { diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js index 9470ac5c8cb..3cee88d97c8 100644 --- a/mozilla/editor/ui/composer/content/editor.js +++ b/mozilla/editor/ui/composer/content/editor.js @@ -50,7 +50,7 @@ var gEditModeBar; // Bummer! Can't get at enums from nsIDocumentEncoder.h var gOutputSelectionOnly = 1; var gOutputFormatted = 2; -var gOutputNoDoctype = 4; +//var gOutputNoDoctype = 4; // OutputNoDoctype has been obsoleted var gOutputBodyOnly = 8; var gOutputPreformatted = 16; var gOutputWrap = 32; @@ -895,7 +895,7 @@ function SetEditMode(mode) { // Get the entire document's source string - var flags = gOutputNoDoctype | gOutputEncodeEntities; + var flags = gOutputEncodeEntities; // var prettyPrint = gPrefs.GetBoolPref("editor.prettyprint"); if (prettyPrint) diff --git a/mozilla/editor/ui/composer/content/editorOverlay.xul b/mozilla/editor/ui/composer/content/editorOverlay.xul index 09bc4ad2103..706948f7b36 100644 --- a/mozilla/editor/ui/composer/content/editorOverlay.xul +++ b/mozilla/editor/ui/composer/content/editorOverlay.xul @@ -790,6 +790,8 @@ oncommand="EditorGetHTML()"/> + "; const int gTabSize=2; static const nsString gMozDirty = NS_ConvertToString("_moz_dirty"); @@ -134,9 +132,6 @@ nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream, mBodyOnly = (aFlags & nsIDocumentEncoder::OutputBodyOnly) ? PR_TRUE : PR_FALSE; - mDoHeader = (!mBodyOnly) && (mDoFormat) && - ((aFlags & nsIDocumentEncoder::OutputNoDoctype) ? PR_FALSE - : PR_TRUE); mMaxColumn = 72; mFlags = aFlags; @@ -716,17 +711,6 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode) if (IndentChildren(tag)) mIndent++; - - if (tag == eHTMLTag_head) - { - if(mDoHeader) - { - Write(gHeaderComment); - Write(mLineBreak); - Write(gDocTypeHeader); - Write(mLineBreak); - } - } } void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode) diff --git a/mozilla/htmlparser/src/nsHTMLContentSinkStream.h b/mozilla/htmlparser/src/nsHTMLContentSinkStream.h index f39cecc8f5a..90d0945cd65 100644 --- a/mozilla/htmlparser/src/nsHTMLContentSinkStream.h +++ b/mozilla/htmlparser/src/nsHTMLContentSinkStream.h @@ -198,7 +198,6 @@ protected: nsCOMPtr mURI; PRBool mDoFormat; - PRBool mDoHeader; PRBool mBodyOnly; PRBool mHasOpenHtmlTag; PRInt32 mPreLevel; diff --git a/mozilla/layout/base/public/nsIDocumentEncoder.h b/mozilla/layout/base/public/nsIDocumentEncoder.h index e9904a4b273..593875d5e6c 100644 --- a/mozilla/layout/base/public/nsIDocumentEncoder.h +++ b/mozilla/layout/base/public/nsIDocumentEncoder.h @@ -74,8 +74,8 @@ public: // (Probably not well tested for HTML output.) OutputFormatted = 2, - // Don't output the html doctype and gecko output system comment headers - OutputNoDoctype = 4, + // OutputNoDoctype is obsolete, flag 4 available for other uses + //OutputNoDoctype = 4, // No html head tags OutputBodyOnly = 8, diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index 3ac81e954c0..7f1a7d3391a 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -857,8 +857,7 @@ nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML) NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr sink; - rv = NS_New_HTML_ContentSinkStream(getter_AddRefs(sink), &aInnerHTML, - nsIDocumentEncoder::OutputNoDoctype); + rv = NS_New_HTML_ContentSinkStream(getter_AddRefs(sink), &aInnerHTML, 0); NS_ENSURE_SUCCESS(rv, rv); parser->SetContentSink(sink); diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp index 6d41444b91f..ec677b836d7 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -1664,7 +1664,7 @@ void nsGfxTextControlFrame::GetTextControlFrameState(nsString& aValue) PRUint32 flags = 0; if (PR_TRUE==IsPlainTextControl()) { - flags |= nsIDocumentEncoder::OutputBodyOnly; // OutputNoDoctype if head info needed + flags |= nsIDocumentEncoder::OutputBodyOnly; } nsFormControlHelper::nsHTMLTextWrap wrapProp; diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 58f9cc7b98c..522fcfc3604 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -2892,7 +2892,7 @@ void nsGfxTextControlFrame2::GetTextControlFrameState(nsAWritableString& aValue) PRUint32 flags = nsIDocumentEncoder::OutputLFLineBreak;; if (PR_TRUE==IsPlainTextControl()) { - flags |= nsIDocumentEncoder::OutputBodyOnly; // OutputNoDoctype if head info needed + flags |= nsIDocumentEncoder::OutputBodyOnly; } nsFormControlHelper::nsHTMLTextWrap wrapProp; diff --git a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp index 6fae533856a..559a830dc3d 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -54,8 +54,6 @@ static NS_DEFINE_CID(kEntityConverterCID, NS_ENTITYCONVERTER_CID); static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID); static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID); -static char* gHeaderComment = ""; -static char* gDocTypeHeader = ""; const int gTabSize=2; static const nsString gMozDirty = NS_ConvertToString("_moz_dirty"); @@ -134,9 +132,6 @@ nsHTMLContentSinkStream::Initialize(nsIOutputStream* aOutStream, mBodyOnly = (aFlags & nsIDocumentEncoder::OutputBodyOnly) ? PR_TRUE : PR_FALSE; - mDoHeader = (!mBodyOnly) && (mDoFormat) && - ((aFlags & nsIDocumentEncoder::OutputNoDoctype) ? PR_FALSE - : PR_TRUE); mMaxColumn = 72; mFlags = aFlags; @@ -716,17 +711,6 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode) if (IndentChildren(tag)) mIndent++; - - if (tag == eHTMLTag_head) - { - if(mDoHeader) - { - Write(gHeaderComment); - Write(mLineBreak); - Write(gDocTypeHeader); - Write(mLineBreak); - } - } } void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode) diff --git a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.h b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.h index f39cecc8f5a..90d0945cd65 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.h +++ b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.h @@ -198,7 +198,6 @@ protected: nsCOMPtr mURI; PRBool mDoFormat; - PRBool mDoHeader; PRBool mBodyOnly; PRBool mHasOpenHtmlTag; PRInt32 mPreLevel;