bug 296284: <blockquote type=cite> can cause the plaintext serializer to delete extra newlines before inlines after blocks. r=peterv sr=jst a=asa
git-svn-id: svn://10.0.0.236/trunk@174711 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -635,6 +635,10 @@ nsPlainTextSerializer::DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Reset this so that <blockquote type=cite> doesn't affect the whitespace
|
||||
// above random <pre>s below it.
|
||||
mHasWrittenCiteBlockquote = mHasWrittenCiteBlockquote && aTag == eHTMLTag_pre;
|
||||
|
||||
PRBool isInCiteBlockquote = PR_FALSE;
|
||||
|
||||
// XXX special-case <blockquote type=cite> 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);
|
||||
|
||||
@@ -82,6 +82,8 @@ TEST_FILES = \
|
||||
xifdthtml.out \
|
||||
simplemail.html \
|
||||
simplemail.out \
|
||||
mischtml.html \
|
||||
mischtml.out \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -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) {
|
||||
|
||||
50
mozilla/parser/htmlparser/tests/outsinks/mischtml.html
Normal file
50
mozilla/parser/htmlparser/tests/outsinks/mischtml.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla Communicator client code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- The Mozilla Foundation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Blake Kaplan <mrbkap@gmail.com> (original author)
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
<html>
|
||||
<body>
|
||||
<blockquote type="cite">Here is some text that was cited from another source</blockquote>
|
||||
<br>
|
||||
<strong>Here is some discussion of said text</strong>
|
||||
<pre>And here is some
|
||||
preformatted text</pre>
|
||||
|
||||
<blockquote type="cite">Here is some more text</blockquote>
|
||||
<pre>And here is some more
|
||||
preformatted text</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
11
mozilla/parser/htmlparser/tests/outsinks/mischtml.out
Normal file
11
mozilla/parser/htmlparser/tests/outsinks/mischtml.out
Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user