Backed out 4 changesets (bug 1113238) for mochitest-dt failures.

Backed out changeset 8439a009837d (bug 1113238)
Backed out changeset 34b89a4f9dea (bug 1113238)
Backed out changeset ce0ed9dc4d6d (bug 1113238)
Backed out changeset 9dd632bab2aa (bug 1113238)

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-01-13 13:50:12 -05:00
parent 984772aeca
commit 5c646afffd
31 changed files with 127 additions and 254 deletions

View File

@ -1076,8 +1076,7 @@ nsDocumentEncoder::EncodeToStringWithMaxLength(uint32_t aMaxLength,
nsCOMPtr<nsIAtom> charsetAtom;
bool rewriteEncodingDeclaration = !(mSelection || mRange || mNode) && !(mFlags & OutputDontRewriteEncodingDeclaration);
mSerializer->Init(mDocument, mFlags, mWrapColumn, mCharset.get(),
mIsCopying, rewriteEncodingDeclaration);
mSerializer->Init(mFlags, mWrapColumn, mCharset.get(), mIsCopying, rewriteEncodingDeclaration);
if (mSelection) {
nsCOMPtr<nsIDOMRange> range;

View File

@ -192,7 +192,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
bool lineBreakBeforeOpen = LineBreakBeforeOpen(ns, name);
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
if (mColPos && lineBreakBeforeOpen) {
AppendNewLineToString(aStr);
}
@ -225,7 +225,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
MaybeEnterInPreContent(content);
// for block elements, we increase the indentation
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel())
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw)
IncrIndentation(name);
// Need to keep track of OL and LI elements in order to get ordinal number
@ -280,8 +280,8 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
++mDisableEntityEncoding;
}
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel() &&
LineBreakAfterOpen(ns, name)) {
if ((mDoFormat || forceFormat) && !mPreLevel &&
!mDoRaw && LineBreakAfterOpen(ns, name)) {
AppendNewLineToString(aStr);
}
@ -312,18 +312,18 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
bool forceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
content->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
DecrIndentation(name);
}
if (name == nsGkAtoms::script) {
nsCOMPtr<nsIScriptElement> script = do_QueryInterface(aElement);
if (ShouldMaintainPreLevel() && script && script->IsMalformed()) {
if (script && script->IsMalformed()) {
// We're looking at a malformed script tag. This means that the end tag
// was missing in the source. Imitate that here by not serializing the end
// tag.
--PreLevel();
--mPreLevel;
return NS_OK;
}
}
@ -351,7 +351,7 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
}
}
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
bool lineBreakBeforeClose = LineBreakBeforeClose(ns, name);
@ -377,8 +377,8 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
MaybeLeaveFromPreContent(content);
if ((mDoFormat || forceFormat)&& !mDoRaw && !PreLevel()
&& LineBreakAfterClose(ns, name)) {
if ((mDoFormat || forceFormat) && !mPreLevel
&& !mDoRaw && LineBreakAfterClose(ns, name)) {
AppendNewLineToString(aStr);
}
else {

View File

@ -19,17 +19,17 @@ class Element;
} // namespace mozilla
#define NS_ICONTENTSERIALIZER_IID \
{ 0x18a66082, 0x793f, 0x47f4, \
{ 0xa1, 0xf0, 0xf0, 0xe4, 0x22, 0x9e, 0x52, 0x79 } }
{ 0xb1ee32f2, 0xb8c4, 0x49b9, \
{ 0x93, 0xdf, 0xb6, 0xfa, 0xb5, 0xd5, 0x46, 0x88 } }
class nsIContentSerializer : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID)
NS_IMETHOD Init(nsIDocument* aDoc, uint32_t flags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aIsWholeDocument) = 0;
NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aIsWholeDocument) = 0;
NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) = 0;

View File

@ -22,8 +22,6 @@
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
#include "mozilla/BinarySearch.h"
#include "nsComputedDOMStyle.h"
#include "nsIDocument.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -120,12 +118,10 @@ NS_IMPL_ISUPPORTS(nsPlainTextSerializer,
NS_IMETHODIMP
nsPlainTextSerializer::Init(nsIDocument* aDocument, uint32_t aFlags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aIsWholeDocument)
nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aIsWholeDocument)
{
MOZ_ASSERT(aDocument);
#ifdef DEBUG
// Check if the major control flags are set correctly.
if (aFlags & nsIDocumentEncoder::OutputFormatFlowed) {
@ -190,10 +186,6 @@ nsPlainTextSerializer::Init(nsIDocument* aDocument, uint32_t aFlags,
// XXX We should let the caller decide whether to do this or not
mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent;
// Flush the styles on the document to ensure that we read the correct style
// information when determining whether an element is preformatted.
aDocument->FlushPendingNotifications(Flush_Style);
return NS_OK;
}
@ -364,7 +356,6 @@ nsPlainTextSerializer::AppendElementStart(Element* aElement,
if (isContainer) {
rv = DoOpenContainer(id);
mPreformatStack.push(IsElementPreformatted(mElement));
}
else {
rv = DoAddLeaf(id);
@ -398,7 +389,6 @@ nsPlainTextSerializer::AppendElementEnd(Element* aElement,
rv = NS_OK;
if (isContainer) {
rv = DoCloseContainer(id);
mPreformatStack.pop();
}
mElement = nullptr;
@ -1547,7 +1537,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
// This mustn't be mixed with intelligent wrapping without clearing
// the mCurrentLine buffer before!!!
NS_ASSERTION(mCurrentLine.IsEmpty() || IsInPre(),
NS_ASSERTION(mCurrentLine.IsEmpty(),
"Mixed wrapping data and nonwrapping data on the same line");
if (!mCurrentLine.IsEmpty()) {
FlushLine();
@ -1765,22 +1755,28 @@ nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
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
nsPlainTextSerializer::IsInPre()
{
return !mPreformatStack.empty() && mPreformatStack.top();
}
bool
nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
{
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
int32_t i = mTagStackIndex;
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
return false;
}

View File

@ -22,8 +22,6 @@
#include "nsString.h"
#include "nsTArray.h"
#include <stack>
class nsIContent;
namespace mozilla {
@ -40,9 +38,9 @@ public:
NS_DECL_ISUPPORTS
// nsIContentSerializer
NS_IMETHOD Init(nsIDocument* aDocument, uint32_t flags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aRewriteEncodingDeclaration) MOZ_OVERRIDE;
NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aIsWholeDocument) MOZ_OVERRIDE;
NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE;
@ -114,9 +112,6 @@ protected:
bool ShouldReplaceContainerWithPlaceholder(nsIAtom* aTag);
private:
bool IsElementPreformatted(mozilla::dom::Element* aElement);
protected:
nsString mCurrentLine;
uint32_t mHeadLevel;
@ -201,11 +196,6 @@ protected:
nsIAtom** mTagStack;
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:
uint32_t mIgnoreAboveIndex;

View File

@ -33,8 +33,6 @@
#include "nsIScriptElement.h"
#include "nsAttrName.h"
#include "nsParserConstants.h"
#include "nsComputedDOMStyle.h"
#include "mozilla/dom/Element.h"
static const int32_t kLongLineLen = 128;
@ -61,12 +59,10 @@ nsXHTMLContentSerializer::~nsXHTMLContentSerializer()
}
NS_IMETHODIMP
nsXHTMLContentSerializer::Init(nsIDocument* aDocument, uint32_t aFlags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aRewriteEncodingDeclaration)
nsXHTMLContentSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aRewriteEncodingDeclaration)
{
MOZ_ASSERT(aDocument);
// The previous version of the HTML serializer did implicit wrapping
// when there is no flags, so we keep wrapping in order to keep
// compatibility with the existing calling code
@ -76,8 +72,7 @@ nsXHTMLContentSerializer::Init(nsIDocument* aDocument, uint32_t aFlags,
}
nsresult rv;
rv = nsXMLContentSerializer::Init(aDocument, aFlags, aWrapColumn, aCharSet,
aIsCopying, aRewriteEncodingDeclaration);
rv = nsXMLContentSerializer::Init(aFlags, aWrapColumn, aCharSet, aIsCopying, aRewriteEncodingDeclaration);
NS_ENSURE_SUCCESS(rv, rv);
mRewriteEncodingDeclaration = aRewriteEncodingDeclaration;
@ -92,13 +87,6 @@ nsXHTMLContentSerializer::Init(nsIDocument* aDocument, uint32_t aFlags,
if (mFlags & nsIDocumentEncoder::OutputEncodeW3CEntities) {
mEntityConverter = do_CreateInstance(NS_ENTITYCONVERTER_CONTRACTID);
}
// Flush the styles on the document to ensure that we read the correct style
// information when determining whether an element is preformatted.
if (ShouldMaintainPreLevel()) {
aDocument->FlushPendingNotifications(Flush_Style);
}
return NS_OK;
}
@ -143,7 +131,7 @@ nsXHTMLContentSerializer::AppendText(nsIContent* aText,
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (mDoRaw || PreLevel() > 0) {
if (mPreLevel > 0 || mDoRaw) {
AppendToStringConvertLF(data, aStr);
}
else if (mDoFormat) {
@ -547,9 +535,8 @@ nsXHTMLContentSerializer::CheckElementStart(nsIContent * aContent,
int32_t namespaceID = aContent->GetNameSpaceID();
if (namespaceID == kNameSpaceID_XHTML) {
if (name == nsGkAtoms::br &&
(mFlags & nsIDocumentEncoder::OutputNoFormattingInPre) &&
PreLevel() > 0) {
if (name == nsGkAtoms::br && mPreLevel > 0 &&
(mFlags & nsIDocumentEncoder::OutputNoFormattingInPre)) {
AppendNewLineToString(aStr);
return false;
}
@ -856,60 +843,41 @@ nsXHTMLContentSerializer::LineBreakAfterClose(int32_t aNamespaceID, nsIAtom* aNa
void
nsXHTMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
{
if (!ShouldMaintainPreLevel() ||
aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
if (aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
return;
}
nsIAtom *name = aNode->Tag();
if (IsElementPreformatted(aNode) ||
if (name == nsGkAtoms::pre ||
name == nsGkAtoms::script ||
name == nsGkAtoms::style ||
name == nsGkAtoms::noscript ||
name == nsGkAtoms::noframes
) {
PreLevel()++;
mPreLevel++;
}
}
void
nsXHTMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
{
if (!ShouldMaintainPreLevel() ||
aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
if (aNode->GetNameSpaceID() != kNameSpaceID_XHTML) {
return;
}
nsIAtom *name = aNode->Tag();
if (IsElementPreformatted(aNode) ||
if (name == nsGkAtoms::pre ||
name == nsGkAtoms::script ||
name == nsGkAtoms::style ||
name == nsGkAtoms::noscript ||
name == nsGkAtoms::noframes
) {
--PreLevel();
--mPreLevel;
}
}
bool
nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode)
{
MOZ_ASSERT(ShouldMaintainPreLevel(), "We should not be calling this needlessly");
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
nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement,
nsAString& aStr)

View File

@ -26,9 +26,9 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
nsXHTMLContentSerializer();
virtual ~nsXHTMLContentSerializer();
NS_IMETHOD Init(nsIDocument* aDocument, uint32_t flags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aRewriteEncodingDeclaration) MOZ_OVERRIDE;
NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aRewriteEncodingDeclaration) MOZ_OVERRIDE;
NS_IMETHOD AppendText(nsIContent* aText,
int32_t aStartOffset,
@ -93,10 +93,6 @@ class nsXHTMLContentSerializer : public nsXMLContentSerializer {
const nsAString& aURI,
nsAString& aEscapedURI);
private:
bool IsElementPreformatted(nsIContent* aNode);
protected:
nsCOMPtr<nsIEntityConverter> mEntityConverter;
/*

View File

@ -74,9 +74,9 @@ nsXMLContentSerializer::~nsXMLContentSerializer()
NS_IMPL_ISUPPORTS(nsXMLContentSerializer, nsIContentSerializer)
NS_IMETHODIMP
nsXMLContentSerializer::Init(nsIDocument* aDocument, uint32_t aFlags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aRewriteEncodingDeclaration)
nsXMLContentSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aRewriteEncodingDeclaration)
{
mPrefixIndex = 0;
mColPos = 0;
@ -187,7 +187,7 @@ nsXMLContentSerializer::AppendText(nsIContent* aText,
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (mDoRaw || PreLevel() > 0) {
if (mPreLevel > 0 || mDoRaw) {
AppendToStringConvertLF(data, aStr);
}
else if (mDoFormat) {
@ -214,7 +214,7 @@ nsXMLContentSerializer::AppendCDATASection(nsIContent* aCDATASection,
NS_NAMED_LITERAL_STRING(cdata , "<![CDATA[");
if (mDoRaw || PreLevel() > 0) {
if (mPreLevel > 0 || mDoRaw) {
AppendToString(cdata, aStr);
}
else if (mDoFormat) {
@ -260,7 +260,7 @@ nsXMLContentSerializer::AppendProcessingInstruction(nsIContent* aPI,
start.AppendLiteral("<?");
start.Append(target);
if (mDoRaw || PreLevel() > 0) {
if (mPreLevel > 0 || mDoRaw) {
AppendToString(start, aStr);
}
else if (mDoFormat) {
@ -318,7 +318,7 @@ nsXMLContentSerializer::AppendComment(nsIContent* aComment,
NS_NAMED_LITERAL_STRING(startComment, "<!--");
if (mDoRaw || PreLevel() > 0) {
if (mPreLevel > 0 || mDoRaw) {
AppendToString(startComment, aStr);
}
else if (mDoFormat) {
@ -693,7 +693,7 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
attrString.Append(sValue);
attrString.Append(cDelimiter);
}
if (mDoRaw || PreLevel() > 0) {
if (mPreLevel > 0 || mDoRaw) {
AppendToStringConvertLF(attrString, aStr);
}
else if (mDoFormat) {
@ -898,7 +898,7 @@ nsXMLContentSerializer::AppendElementStart(Element* aElement,
nsIAtom *name = content->Tag();
bool lineBreakBeforeOpen = LineBreakBeforeOpen(content->GetNameSpaceID(), name);
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
if (mColPos && lineBreakBeforeOpen) {
AppendNewLineToString(aStr);
}
@ -939,7 +939,7 @@ nsXMLContentSerializer::AppendElementStart(Element* aElement,
MaybeEnterInPreContent(content);
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
IncrIndentation(name);
}
@ -949,8 +949,8 @@ nsXMLContentSerializer::AppendElementStart(Element* aElement,
AppendEndOfElementStart(aOriginalElement, name, content->GetNameSpaceID(),
aStr);
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()
&& LineBreakAfterOpen(content->GetNameSpaceID(), name)) {
if ((mDoFormat || forceFormat) && !mPreLevel
&& !mDoRaw && LineBreakAfterOpen(content->GetNameSpaceID(), name)) {
AppendNewLineToString(aStr);
}
@ -987,7 +987,7 @@ nsXMLContentSerializer::AppendElementEnd(Element* aElement,
nsIAtom *name = content->Tag();
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
DecrIndentation(name);
}
@ -1009,7 +1009,7 @@ nsXMLContentSerializer::AppendElementEnd(Element* aElement,
ConfirmPrefix(tagPrefix, tagNamespaceURI, aElement, false);
NS_ASSERTION(!debugNeedToPushNamespace, "Can't push namespaces in closing tag!");
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) {
bool lineBreakBeforeClose = LineBreakBeforeClose(content->GetNameSpaceID(), name);
@ -1041,8 +1041,8 @@ nsXMLContentSerializer::AppendElementEnd(Element* aElement,
MaybeLeaveFromPreContent(content);
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()
&& LineBreakAfterClose(content->GetNameSpaceID(), name)) {
if ((mDoFormat || forceFormat) && !mPreLevel
&& !mDoRaw && LineBreakAfterClose(content->GetNameSpaceID(), name)) {
AppendNewLineToString(aStr);
}
else {
@ -1217,12 +1217,11 @@ void
nsXMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
{
// support of the xml:space attribute
if (ShouldMaintainPreLevel() &&
aNode->HasAttr(kNameSpaceID_XML, nsGkAtoms::space)) {
if (aNode->HasAttr(kNameSpaceID_XML, nsGkAtoms::space)) {
nsAutoString space;
aNode->GetAttr(kNameSpaceID_XML, nsGkAtoms::space, space);
if (space.EqualsLiteral("preserve"))
++PreLevel();
++mPreLevel;
}
}
@ -1230,12 +1229,11 @@ void
nsXMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
{
// support of the xml:space attribute
if (ShouldMaintainPreLevel() &&
aNode->HasAttr(kNameSpaceID_XML, nsGkAtoms::space)) {
if (aNode->HasAttr(kNameSpaceID_XML, nsGkAtoms::space)) {
nsAutoString space;
aNode->GetAttr(kNameSpaceID_XML, nsGkAtoms::space, space);
if (space.EqualsLiteral("preserve"))
--PreLevel();
--mPreLevel;
}
}
@ -1444,7 +1442,7 @@ nsXMLContentSerializer::AppendWrapped_NonWhitespaceSequence(
colPos = mColPos;
}
else {
if (mDoFormat && !mDoRaw && !PreLevel() && !onceAgainBecauseWeAddedBreakInFront) {
if (mDoFormat && !mPreLevel && !onceAgainBecauseWeAddedBreakInFront) {
colPos = mIndent.Length();
}
else
@ -1713,10 +1711,3 @@ nsXMLContentSerializer::AppendToStringWrapped(const nsASingleFragmentString& aSt
}
}
}
bool
nsXMLContentSerializer::ShouldMaintainPreLevel() const
{
// Only attempt to maintain the pre level for consumers who care about it.
return !mDoRaw || (mFlags & nsIDocumentEncoder::OutputNoFormattingInPre);
}

View File

@ -32,9 +32,9 @@ class nsXMLContentSerializer : public nsIContentSerializer {
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsIDocument* aDocument, uint32_t flags,
uint32_t aWrapColumn, const char* aCharSet,
bool aIsCopying, bool aRewriteEncodingDeclaration) MOZ_OVERRIDE;
NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
const char* aCharSet, bool aIsCopying,
bool aRewriteEncodingDeclaration) MOZ_OVERRIDE;
NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE;
@ -294,16 +294,6 @@ class nsXMLContentSerializer : public nsIContentSerializer {
virtual void MaybeEnterInPreContent(nsIContent* aNode);
virtual void MaybeLeaveFromPreContent(nsIContent* aNode);
bool ShouldMaintainPreLevel() const;
int32_t PreLevel() const {
MOZ_ASSERT(ShouldMaintainPreLevel());
return mPreLevel;
}
int32_t& PreLevel() {
MOZ_ASSERT(ShouldMaintainPreLevel());
return mPreLevel;
}
int32_t mPrefixIndex;
struct NameSpaceDecl {
@ -371,7 +361,6 @@ class nsXMLContentSerializer : public nsIContentSerializer {
bool mBodyOnly;
int32_t mInBody;
private:
// number of nested elements which have preformated content
int32_t mPreLevel;
};

View File

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

View File

@ -33,10 +33,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -42,14 +42,11 @@ var d = a < b && a > c;
<!-- test on
comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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>
lacus risus pulvinar ante.
</pre>
Cras quis<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>
lacus risus pulvinar ante.
</pre>
ut gravida eros leo ut libero
<p></p>
<noscript>

View File

@ -37,10 +37,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -37,10 +37,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -37,10 +37,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -37,10 +37,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -34,13 +34,14 @@ var d = a < b && a > c;
Donec sollicitudin tortor
<!-- test on
comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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>
<pre>lacinia <em>libero</em> ullamcorper laoreet.
Cras quis
nisi at odio
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,
lacus risus pulvinar ante.
</pre>
ut gravida eros leo ut libero

View File

@ -37,10 +37,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -33,10 +33,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -41,10 +41,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
Cras quis<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.
</pre>
ut gravida eros leo ut libero

View File

@ -35,10 +35,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -45,14 +45,11 @@ var d = a < b && a > c;
<!-- test on
comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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 />
lacus risus pulvinar ante.
</pre>
Cras quis<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 />
lacus risus pulvinar ante.
</pre>
ut gravida eros <br />
leo ut libero
<!-- empty element: end tag should be generated for backward compatibility with HTML -->

View File

@ -43,10 +43,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -43,10 +43,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -43,10 +43,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -43,10 +43,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -40,13 +40,14 @@ var d = a < b && a > c;
Donec sollicitudin tortor
<!-- test on
comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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 />
<pre>lacinia <em>libero</em> ullamcorper laoreet.
Cras quis
nisi at odio
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,
lacus risus pulvinar ante.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -43,10 +43,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -35,10 +35,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -46,10 +46,7 @@ comments -->
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br />
Cras quis<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.
</pre>
ut gravida eros <br />leo ut libero

View File

@ -16,10 +16,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=116083
<div style="white-space: pre-wrap">foo bar</div>
<div style="white-space: pre-line">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>
<script type="application/javascript">