diff --git a/mozilla/content/base/src/nsPlainTextSerializer.cpp b/mozilla/content/base/src/nsPlainTextSerializer.cpp index fa8ca88aca1..6c0f5c2690e 100644 --- a/mozilla/content/base/src/nsPlainTextSerializer.cpp +++ b/mozilla/content/base/src/nsPlainTextSerializer.cpp @@ -635,6 +635,10 @@ nsPlainTextSerializer::DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag) return NS_OK; } + // Reset this so that
doesn't affect the whitespace + // above random
s below it.
+  mHasWrittenCiteBlockquote = mHasWrittenCiteBlockquote && aTag == eHTMLTag_pre;
+
   PRBool isInCiteBlockquote = PR_FALSE;
 
   // XXX special-case 
so that we don't add additional @@ -1121,6 +1125,11 @@ nsPlainTextSerializer::DoAddLeaf(const nsIParserNode *aNode, PRInt32 aTag, if (!DoOutput()) { return NS_OK; } + + if (aTag != eHTMLTag_whitespace && aTag != eHTMLTag_newline) { + // Make sure to reset this, since it's no longer true. + mHasWrittenCiteBlockquote = PR_FALSE; + } if (mLineBreakDue) EnsureVerticalSpace(mFloatingLines); diff --git a/mozilla/parser/htmlparser/tests/outsinks/Makefile.in b/mozilla/parser/htmlparser/tests/outsinks/Makefile.in index 61fa5c2f800..79cea11ea7a 100644 --- a/mozilla/parser/htmlparser/tests/outsinks/Makefile.in +++ b/mozilla/parser/htmlparser/tests/outsinks/Makefile.in @@ -82,6 +82,8 @@ TEST_FILES = \ xifdthtml.out \ simplemail.html \ simplemail.out \ + mischtml.html \ + mischtml.out \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks.pl b/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks.pl index 974fc72b333..e5af0f82ffe 100755 --- a/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks.pl +++ b/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks.pl @@ -92,6 +92,13 @@ if ($status != 0) { $errmsg = "$errmsg mailquote.out"; } +print "Testing misc. HTML output with format=flowed ...\n"; +$status = system("./TestOutput -i text/html -o text/plain -f 2 -w 50 -c OutTestData/mischtml.out OutTestData/mischtml.html"); +if ($status != 0) { + print "Misc. HTML with format=flowed test failed.\n"; + $errmsg = "$errmsg mischtml.out"; +} + print "Testing format=flowed output ...\n"; $status = system("./TestOutput -i text/html -o text/plain -f 66 -w 50 -c OutTestData/simplemail.out OutTestData/simplemail.html"); if ($status != 0) { diff --git a/mozilla/parser/htmlparser/tests/outsinks/mischtml.html b/mozilla/parser/htmlparser/tests/outsinks/mischtml.html new file mode 100644 index 00000000000..573f701660c --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/mischtml.html @@ -0,0 +1,50 @@ + + + +
Here is some text that was cited from another source
+
+Here is some discussion of said text +
And here is some
+preformatted text
+ +
Here is some more text
+
And here is some more
+preformatted text
+ + + diff --git a/mozilla/parser/htmlparser/tests/outsinks/mischtml.out b/mozilla/parser/htmlparser/tests/outsinks/mischtml.out new file mode 100644 index 00000000000..a766ed19175 --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/mischtml.out @@ -0,0 +1,11 @@ +> Here is some text that was cited from another source + +*Here is some discussion of said text* + +And here is some +preformatted text + +> Here is some more text +And here is some more +preformatted text +