Bug 1113238 - Part 1: Make our plaintext and HTML serializers aware of CSS preformatted styles; r=bzbarsky

This code is super-hairy, but I think this is the minimum amount of changes
that we need.

nsPlainTextSerializer::IsInPre() before this patch is completely broken, and
I changed it to maintain a stack of bools representing whether the elements
that we saw as we were traversing the tree are preformatted or not.

nsXHTMLContentSerializer maintains this information using a counter, which is
broken in case pre and non-preformatted elements are stacked underneath each
other, but I'm not sure why this code is using a counter and I didn't want to
change it drastically, so for now I'm just making it look at the element's
style first as opposed to its tag name.

Follow-up work may include exploring whether nsXHTMLContentSerializer should
use a stack similar to nsPlainTextSerializer, and also audit this code for
more places where things are hardcoded based on tag names where we should be
really looking at the style.
This commit is contained in:
Ehsan Akhgari 2014-12-19 12:45:50 -05:00
parent 7d4e9dbdc2
commit d1cdb11577
26 changed files with 151 additions and 66 deletions

View File

@ -22,6 +22,7 @@
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/BinarySearch.h" #include "mozilla/BinarySearch.h"
#include "nsComputedDOMStyle.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
@ -356,6 +357,7 @@ nsPlainTextSerializer::AppendElementStart(Element* aElement,
if (isContainer) { if (isContainer) {
rv = DoOpenContainer(id); rv = DoOpenContainer(id);
mPreformatStack.push(IsElementPreformatted(mElement));
} }
else { else {
rv = DoAddLeaf(id); rv = DoAddLeaf(id);
@ -389,6 +391,7 @@ nsPlainTextSerializer::AppendElementEnd(Element* aElement,
rv = NS_OK; rv = NS_OK;
if (isContainer) { if (isContainer) {
rv = DoCloseContainer(id); rv = DoCloseContainer(id);
mPreformatStack.pop();
} }
mElement = nullptr; mElement = nullptr;
@ -1537,7 +1540,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
// This mustn't be mixed with intelligent wrapping without clearing // This mustn't be mixed with intelligent wrapping without clearing
// the mCurrentLine buffer before!!! // the mCurrentLine buffer before!!!
NS_ASSERTION(mCurrentLine.IsEmpty(), NS_ASSERTION(mCurrentLine.IsEmpty() || IsInPre(),
"Mixed wrapping data and nonwrapping data on the same line"); "Mixed wrapping data and nonwrapping data on the same line");
if (!mCurrentLine.IsEmpty()) { if (!mCurrentLine.IsEmpty()) {
FlushLine(); FlushLine();
@ -1755,28 +1758,22 @@ nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
return localName->IsStaticAtom() ? localName : nullptr; return localName->IsStaticAtom() ? localName : nullptr;
} }
/**
* Returns true if we currently are inside a <pre>. The check is done
* by traversing the tag stack looking for <pre> until we hit a block
* level tag which is assumed to override any <pre>:s below it in
* the stack. To do this correctly to a 100% would require access
* to style which we don't support in this converter.
*/
bool bool
nsPlainTextSerializer::IsInPre() nsPlainTextSerializer::IsInPre()
{ {
int32_t i = mTagStackIndex; return !mPreformatStack.empty() && mPreformatStack.top();
while(i > 0) { }
if (mTagStack[i - 1] == nsGkAtoms::pre)
return true;
if (nsContentUtils::IsHTMLBlock(mTagStack[i - 1])) {
// We assume that every other block overrides a <pre>
return false;
}
--i;
}
// Not a <pre> in the whole stack bool
nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
{
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
}
return false; return false;
} }

View File

@ -22,6 +22,8 @@
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
#include <stack>
class nsIContent; class nsIContent;
namespace mozilla { namespace mozilla {
@ -112,6 +114,9 @@ protected:
bool ShouldReplaceContainerWithPlaceholder(nsIAtom* aTag); bool ShouldReplaceContainerWithPlaceholder(nsIAtom* aTag);
private:
bool IsElementPreformatted(mozilla::dom::Element* aElement);
protected: protected:
nsString mCurrentLine; nsString mCurrentLine;
uint32_t mHeadLevel; uint32_t mHeadLevel;
@ -196,6 +201,11 @@ protected:
nsIAtom** mTagStack; nsIAtom** mTagStack;
uint32_t mTagStackIndex; uint32_t mTagStackIndex;
// The stack indicating whether the elements we've been operating on are
// CSS preformatted elements, so that we can tell if the text inside them
// should be formatted.
std::stack<bool> mPreformatStack;
// Content in the stack above this index should be ignored: // Content in the stack above this index should be ignored:
uint32_t mIgnoreAboveIndex; uint32_t mIgnoreAboveIndex;

View File

@ -33,6 +33,8 @@
#include "nsIScriptElement.h" #include "nsIScriptElement.h"
#include "nsAttrName.h" #include "nsAttrName.h"
#include "nsParserConstants.h" #include "nsParserConstants.h"
#include "nsComputedDOMStyle.h"
#include "mozilla/dom/Element.h"
static const int32_t kLongLineLen = 128; static const int32_t kLongLineLen = 128;
@ -850,7 +852,7 @@ nsXHTMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
nsIAtom *name = aNode->Tag(); nsIAtom *name = aNode->Tag();
if (name == nsGkAtoms::pre || if (IsElementPreformatted(aNode) ||
name == nsGkAtoms::script || name == nsGkAtoms::script ||
name == nsGkAtoms::style || name == nsGkAtoms::style ||
name == nsGkAtoms::noscript || name == nsGkAtoms::noscript ||
@ -868,7 +870,7 @@ nsXHTMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
} }
nsIAtom *name = aNode->Tag(); nsIAtom *name = aNode->Tag();
if (name == nsGkAtoms::pre || if (IsElementPreformatted(aNode) ||
name == nsGkAtoms::script || name == nsGkAtoms::script ||
name == nsGkAtoms::style || name == nsGkAtoms::style ||
name == nsGkAtoms::noscript || name == nsGkAtoms::noscript ||
@ -878,6 +880,22 @@ nsXHTMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
} }
} }
bool
nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode)
{
if (!aNode->IsElement()) {
return false;
}
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aNode->AsElement(),
nullptr, nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
}
return false;
}
void void
nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement, nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement,
nsAString& aStr) nsAString& aStr)

View File

@ -93,6 +93,10 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
const nsAString& aURI, const nsAString& aURI,
nsAString& aEscapedURI); nsAString& aEscapedURI);
private:
bool IsElementPreformatted(nsIContent* aNode);
protected:
nsCOMPtr<nsIEntityConverter> mEntityConverter; nsCOMPtr<nsIEntityConverter> mEntityConverter;
/* /*

View File

@ -160,8 +160,8 @@ function testCopyPaste (isXHTML) {
testPasteText(" Tt t t "); testPasteText(" Tt t t ");
copyChildrenToClipboard("div5"); copyChildrenToClipboard("div5");
testSelectionToString(" T "); testSelectionToString(" T ");
testClipboardValue("text/unicode", " T "); testClipboardValue("text/unicode", " T ");
if (isXHTML) { if (isXHTML) {
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n</div>"); testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n</div>");
testInnerHTML("div5", "\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n"); testInnerHTML("div5", "\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n");
@ -170,7 +170,7 @@ function testCopyPaste (isXHTML) {
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea> </textarea>\n</div>"); testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea> </textarea>\n</div>");
testInnerHTML("div5", "\n T<textarea> </textarea>\n"); testInnerHTML("div5", "\n T<textarea> </textarea>\n");
} }
testPasteText(" T "); testPasteText(" T ");
copyRangeToClipboard($("div6").childNodes[0],0, $("div6").childNodes[1],1,suppressUnicodeCheckIfHidden); copyRangeToClipboard($("div6").childNodes[0],0, $("div6").childNodes[1],1,suppressUnicodeCheckIfHidden);
testSelectionToString(""); testSelectionToString("");

View File

@ -33,7 +33,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -42,11 +42,14 @@ var d = a < b && a > c;
<!-- test on <!-- test on
comments --> comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
lacus risus pulvinar ante. urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
</pre> luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla
at pharetra rutrum, <br>
lacus risus pulvinar ante.
</pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero
<p></p> <p></p>
<noscript> <noscript>

View File

@ -37,7 +37,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -37,7 +37,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -37,7 +37,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -37,7 +37,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -34,14 +34,13 @@ var d = a < b && a > c;
Donec sollicitudin tortor Donec sollicitudin tortor
<!-- test on <!-- test on
comments --> comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet. <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br>
Cras quis nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
nisi at odio urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -37,7 +37,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -33,7 +33,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -41,7 +41,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<br> Cras quis<br>
nisi at odio<br> nisi at odio<br>
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br>
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros leo ut libero ut gravida eros leo ut libero

View File

@ -35,7 +35,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -45,11 +45,14 @@ var d = a < b && a > c;
<!-- test on <!-- test on
comments --> comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
lacus risus pulvinar ante. urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
</pre> luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla
at pharetra rutrum, <br />
lacus risus pulvinar ante.
</pre>
ut gravida eros <br /> ut gravida eros <br />
leo ut libero leo ut libero
<!-- empty element: end tag should be generated for backward compatibility with HTML --> <!-- empty element: end tag should be generated for backward compatibility with HTML -->

View File

@ -43,7 +43,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -43,7 +43,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -43,7 +43,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -43,7 +43,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -40,14 +40,13 @@ var d = a < b && a > c;
Donec sollicitudin tortor Donec sollicitudin tortor
<!-- test on <!-- test on
comments --> comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet. <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br />
Cras quis nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
nisi at odio urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -43,7 +43,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -35,7 +35,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -46,7 +46,10 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br /> <pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<br /> Cras quis<br />
nisi at odio<br /> nisi at odio<br />
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br /> consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
pharetra rutrum, <br />
lacus risus pulvinar ante. lacus risus pulvinar ante.
</pre> </pre>
ut gravida eros <br />leo ut libero ut gravida eros <br />leo ut libero

View File

@ -16,6 +16,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=116083
<div style="white-space: pre-wrap">foo bar</div> <div style="white-space: pre-wrap">foo bar</div>
<div style="white-space: pre-line">foo bar</div> <div style="white-space: pre-line">foo bar</div>
<div style="white-space: -moz-pre-space">foo bar</div> <div style="white-space: -moz-pre-space">foo bar</div>
<div data-result="bar baz"><span style="white-space: pre">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: pre-wrap">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: pre-line">bar </span>baz</div>
<div data-result="bar baz"><span style="white-space: -moz-pre-space">bar </span>baz</div>
<div data-result="&#10;foo bar&#10;">foo bar</div> <div data-result="&#10;foo bar&#10;">foo bar</div>
</div> </div>
<script type="application/javascript"> <script type="application/javascript">