author | Ryan VanderMeulen <ryanvm@gmail.com> |
Tue, 13 Jan 2015 13:50:12 -0500 | |
changeset 223617 | ff04b6d256b5af2d4015343f14c9f361a5b6a3bb |
parent 223616 | 9ddc69b3693a0aae4e5ce61a15ede535697a9009 |
child 223618 | 8c49a59be57aa5bdaac031ad3e7789b635c1ef89 |
push id | 28098 |
push user | kwierso@gmail.com |
push date | Wed, 14 Jan 2015 00:52:19 +0000 |
treeherder | mozilla-central@e978b8bc5c45 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1113238 |
milestone | 38.0a1 |
backs out | 8439a009837d4f7ecc66228f4864fa5e7ff6a52b 34b89a4f9deafb7ce540b9e2514cf9f1d78a8eb4 ce0ed9dc4d6d947df2d6b2131176ae7417468288 9dd632bab2aaa29731b941cac9ed802e81a6a9fc |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/nsDocumentEncoder.cpp +++ b/dom/base/nsDocumentEncoder.cpp @@ -1071,18 +1071,17 @@ nsDocumentEncoder::EncodeToStringWithMax NS_ENSURE_TRUE(mSerializer, NS_ERROR_NOT_IMPLEMENTED); } nsresult rv = NS_OK; 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; int32_t i, count = 0; rv = mSelection->GetRangeCount(&count); NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/nsHTMLContentSerializer.cpp +++ b/dom/base/nsHTMLContentSerializer.cpp @@ -187,17 +187,17 @@ nsHTMLContentSerializer::AppendElementSt return NS_OK; } nsIAtom *name = content->Tag(); int32_t ns = content->GetNameSpaceID(); bool lineBreakBeforeOpen = LineBreakBeforeOpen(ns, name); - if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) { + if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) { if (mColPos && lineBreakBeforeOpen) { AppendNewLineToString(aStr); } else { MaybeAddNewlineForRootNode(aStr); } if (!mColPos) { AppendIndentation(aStr); @@ -220,17 +220,17 @@ nsHTMLContentSerializer::AppendElementSt AppendToString(kLessThan, aStr); AppendToString(nsDependentAtomString(name), aStr); 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 // for the LI. if (mIsCopying && name == nsGkAtoms::ol && ns == kNameSpaceID_XHTML){ // We are copying and current node is an OL; // Store its start attribute value in olState->startVal. nsAutoString start; @@ -275,18 +275,18 @@ nsHTMLContentSerializer::AppendElementSt if (ns == kNameSpaceID_XHTML && (name == nsGkAtoms::script || name == nsGkAtoms::style || name == nsGkAtoms::noscript || name == nsGkAtoms::noframes)) { ++mDisableEntityEncoding; } - if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel() && - LineBreakAfterOpen(ns, name)) { + if ((mDoFormat || forceFormat) && !mPreLevel && + !mDoRaw && LineBreakAfterOpen(ns, name)) { AppendNewLineToString(aStr); } AfterElementStart(content, aOriginalElement, aStr); return NS_OK; } @@ -307,28 +307,28 @@ nsHTMLContentSerializer::AppendElementEn name == nsGkAtoms::noscript || name == nsGkAtoms::noframes)) { --mDisableEntityEncoding; } 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; } } else if (mIsCopying && name == nsGkAtoms::ol && ns == kNameSpaceID_XHTML) { NS_ASSERTION((!mOLStateStack.IsEmpty()), "Cannot have an empty OL Stack"); /* Though at this point we must always have an state to be deleted as all the OL opening tags are supposed to push an olState object to the stack*/ if (!mOLStateStack.IsEmpty()) { @@ -346,17 +346,17 @@ nsHTMLContentSerializer::AppendElementEn IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(name), isContainer); if (!isContainer) { return NS_OK; } } } - if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) { + if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) { bool lineBreakBeforeClose = LineBreakBeforeClose(ns, name); if (mColPos && lineBreakBeforeClose) { AppendNewLineToString(aStr); } if (!mColPos) { AppendIndentation(aStr); @@ -372,18 +372,18 @@ nsHTMLContentSerializer::AppendElementEn } AppendToString(kEndTag, aStr); AppendToString(nsDependentAtomString(name), aStr); AppendToString(kGreaterThan, aStr); MaybeLeaveFromPreContent(content); - if ((mDoFormat || forceFormat)&& !mDoRaw && !PreLevel() - && LineBreakAfterClose(ns, name)) { + if ((mDoFormat || forceFormat) && !mPreLevel + && !mDoRaw && LineBreakAfterClose(ns, name)) { AppendNewLineToString(aStr); } else { MaybeFlagNewlineForRootNode(aElement); } if (name == nsGkAtoms::body && ns == kNameSpaceID_XHTML) { --mInBody;
--- a/dom/base/nsIContentSerializer.h +++ b/dom/base/nsIContentSerializer.h @@ -14,27 +14,27 @@ class nsAString; namespace mozilla { namespace dom { class Element; } // namespace dom } // 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; NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, int32_t aStartOffset, int32_t aEndOffset, nsAString& aStr) = 0;
--- a/dom/base/nsPlainTextSerializer.cpp +++ b/dom/base/nsPlainTextSerializer.cpp @@ -17,18 +17,16 @@ #include "nsTextFragment.h" #include "nsContentUtils.h" #include "nsReadableUtils.h" #include "nsUnicharUtils.h" #include "nsCRT.h" #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; #define PREF_STRUCTS "converter.html2txt.structs" #define PREF_HEADER_STRATEGY "converter.html2txt.header_strategy" static const int32_t kTabSize=4; @@ -115,22 +113,20 @@ nsPlainTextSerializer::~nsPlainTextSeria NS_WARN_IF_FALSE(mHeadLevel == 0, "Wrong head level!"); } NS_IMPL_ISUPPORTS(nsPlainTextSerializer, nsIContentSerializer) 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) { NS_ASSERTION(aFlags & nsIDocumentEncoder::OutputFormatted, "If you want format=flowed, you must combine it with " "nsIDocumentEncoder::OutputFormatted"); } @@ -185,20 +181,16 @@ nsPlainTextSerializer::Init(nsIDocument* Preferences::GetBool("mail.compose.wrap_to_window_width", mDontWrapAnyQuotes); } } // 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; } bool nsPlainTextSerializer::GetLastBool(const nsTArray<bool>& aStack) { uint32_t size = aStack.Length(); if (size == 0) { @@ -359,17 +351,16 @@ nsPlainTextSerializer::AppendElementStar nsIAtom* id = GetIdForContent(mElement); bool isContainer = !nsContentUtils::IsHTMLVoid(id); mOutputString = &aStr; if (isContainer) { rv = DoOpenContainer(id); - mPreformatStack.push(IsElementPreformatted(mElement)); } else { rv = DoAddLeaf(id); } mElement = nullptr; mOutputString = nullptr; @@ -393,17 +384,16 @@ nsPlainTextSerializer::AppendElementEnd( bool isContainer = !nsContentUtils::IsHTMLVoid(id); mOutputString = &aStr; rv = NS_OK; if (isContainer) { rv = DoCloseContainer(id); - mPreformatStack.pop(); } mElement = nullptr; mOutputString = nullptr; if (id == nsGkAtoms::head) { NS_ASSERTION(mHeadLevel != 0, "mHeadLevel being decremented below 0"); @@ -1542,17 +1532,17 @@ nsPlainTextSerializer::Write(const nsASt // Output directly while the other code path goes through AddToLine. if ((mPreFormatted && !mWrapColumn) || IsInPre() || ((mSpanLevel > 0 || mDontWrapAnyQuotes) && mEmptyLines >= 0 && str.First() == char16_t('>'))) { // No intelligent wrapping. // 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(); } // Put the mail quote "> " chars in, if appropriate. // Have to put it in before every line. while(bol<totLen) { @@ -1760,32 +1750,38 @@ nsPlainTextSerializer::GetIdForContent(n if (!aContent->IsHTML()) { return nullptr; } nsIAtom* localName = aContent->Tag(); 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(); -} + 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; + } -bool -nsPlainTextSerializer::IsElementPreformatted(Element* aElement) -{ - nsRefPtr<nsStyleContext> styleContext = - nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr, - nullptr); - if (styleContext) { - const nsStyleText* textStyle = styleContext->StyleText(); - return textStyle->WhiteSpaceOrNewlineIsSignificant(); - } + // Not a <pre> in the whole stack return false; } /** * This method is required only to identify LI's inside OL. * Returns TRUE if we are inside an OL tag and FALSE otherwise. */ bool
--- a/dom/base/nsPlainTextSerializer.h +++ b/dom/base/nsPlainTextSerializer.h @@ -17,37 +17,35 @@ #include "nsCOMPtr.h" #include "nsIAtom.h" #include "nsIContentSerializer.h" #include "nsIDocumentEncoder.h" #include "nsILineBreaker.h" #include "nsString.h" #include "nsTArray.h" -#include <stack> - class nsIContent; namespace mozilla { namespace dom { class Element; } // namespace dom } // namespace mozilla class nsPlainTextSerializer : public nsIContentSerializer { public: nsPlainTextSerializer(); 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; NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, int32_t aStartOffset, int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE; NS_IMETHOD AppendProcessingInstruction(nsIContent* aPI, int32_t aStartOffset, @@ -109,19 +107,16 @@ protected: // Stack handling functions bool GetLastBool(const nsTArray<bool>& aStack); void SetLastBool(nsTArray<bool>& aStack, bool aValue); void PushBool(nsTArray<bool>& aStack, bool aValue); bool PopBool(nsTArray<bool>& aStack); bool ShouldReplaceContainerWithPlaceholder(nsIAtom* aTag); -private: - bool IsElementPreformatted(mozilla::dom::Element* aElement); - protected: nsString mCurrentLine; uint32_t mHeadLevel; bool mAtFirstColumn; // Handling of quoted text (for mail): // Quotes need to be wrapped differently from non-quoted text, // because quoted text has a few extra characters (e.g. ">> ") @@ -196,21 +191,16 @@ protected: nsAString* mOutputString; // The tag stack: the stack of tags we're operating on, so we can nest. // The stack only ever points to static atoms, so they don't need to be // refcounted. 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; // The stack for ordered lists int32_t *mOLStack; uint32_t mOLStackIndex; uint32_t mULCount;
--- a/dom/base/nsXHTMLContentSerializer.cpp +++ b/dom/base/nsXHTMLContentSerializer.cpp @@ -28,18 +28,16 @@ #include "nsITextToSubURI.h" #include "nsCRT.h" #include "nsIParserService.h" #include "nsContentUtils.h" #include "nsLWBrkCIID.h" #include "nsIScriptElement.h" #include "nsAttrName.h" #include "nsParserConstants.h" -#include "nsComputedDOMStyle.h" -#include "mozilla/dom/Element.h" static const int32_t kLongLineLen = 128; #define kXMLNS "xmlns" nsresult NS_NewXHTMLContentSerializer(nsIContentSerializer** aSerializer) { nsXHTMLContentSerializer* it = new nsXHTMLContentSerializer(); @@ -56,54 +54,44 @@ nsXHTMLContentSerializer::nsXHTMLContent } nsXHTMLContentSerializer::~nsXHTMLContentSerializer() { NS_ASSERTION(mOLStateStack.IsEmpty(), "Expected OL State stack to be empty"); } 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 // XXXLJ perhaps should we remove this default settings later ? if (aFlags & nsIDocumentEncoder::OutputFormatted ) { aFlags = aFlags | nsIDocumentEncoder::OutputWrap; } 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; mIsCopying = aIsCopying; mIsFirstChildOfOL = false; mInBody = 0; mDisableEntityEncoding = 0; mBodyOnly = (mFlags & nsIDocumentEncoder::OutputBodyOnly) ? true : false; // set up entity converter if we are going to need it 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; } // See if the string has any lines longer than longLineLen: // if so, we presume formatting is wonky (e.g. the node has been edited) // and we'd better rewrap the whole text node. bool @@ -138,17 +126,17 @@ nsXHTMLContentSerializer::AppendText(nsI nsAutoString data; nsresult rv; rv = AppendTextData(aText, aStartOffset, aEndOffset, data, true); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - if (mDoRaw || PreLevel() > 0) { + if (mPreLevel > 0 || mDoRaw) { AppendToStringConvertLF(data, aStr); } else if (mDoFormat) { AppendToStringFormatedWrapped(data, aStr); } else if (mDoWrap) { AppendToStringWrapped(data, aStr); } @@ -542,19 +530,18 @@ nsXHTMLContentSerializer::CheckElementSt // even if we're not in pretty printing mode aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) && aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty); nsIAtom *name = aContent->Tag(); 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; } if (name == nsGkAtoms::body) { ++mInBody; } } @@ -851,70 +838,51 @@ nsXHTMLContentSerializer::LineBreakAfter return false; } 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) { // We are copying and we are at the "first" LI node of OL in selected range. // It may not be the first LI child of OL but it's first in the selected range. // Note that we get into this condition only once per a OL. bool found = false;
--- a/dom/base/nsXHTMLContentSerializer.h +++ b/dom/base/nsXHTMLContentSerializer.h @@ -21,19 +21,19 @@ class nsIContent; class nsIAtom; class nsXHTMLContentSerializer : public nsXMLContentSerializer { public: 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, int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE; NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, nsAString& aStr) MOZ_OVERRIDE; @@ -88,20 +88,16 @@ class nsXHTMLContentSerializer : public bool IsShorthandAttr(const nsIAtom* aAttrName, const nsIAtom* aElementName); virtual void AppendAndTranslateEntities(const nsAString& aStr, nsAString& aOutputStr) MOZ_OVERRIDE; nsresult EscapeURI(nsIContent* aContent, const nsAString& aURI, nsAString& aEscapedURI); -private: - bool IsElementPreformatted(nsIContent* aNode); - -protected: nsCOMPtr<nsIEntityConverter> mEntityConverter; /* * isHTMLParser should be set to true by the HTML parser which inherits from * this class. It avoids to redefine methods just for few changes. */ bool mIsHTMLSerializer;
--- a/dom/base/nsXMLContentSerializer.cpp +++ b/dom/base/nsXMLContentSerializer.cpp @@ -69,19 +69,19 @@ nsXMLContentSerializer::nsXMLContentSeri 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; mIndentOverflow = 0; mIsIndentationAddedOnCurrentLine = false; mInAttribute = false; mAddNewlineForRootNode = false; mAddSpace = false; @@ -182,17 +182,17 @@ nsXMLContentSerializer::AppendText(nsICo nsAutoString data; nsresult rv; rv = AppendTextData(aText, aStartOffset, aEndOffset, data, true); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - if (mDoRaw || PreLevel() > 0) { + if (mPreLevel > 0 || mDoRaw) { AppendToStringConvertLF(data, aStr); } else if (mDoFormat) { AppendToStringFormatedWrapped(data, aStr); } else if (mDoWrap) { AppendToStringWrapped(data, aStr); } @@ -209,17 +209,17 @@ nsXMLContentSerializer::AppendCDATASecti int32_t aEndOffset, nsAString& aStr) { NS_ENSURE_ARG(aCDATASection); nsresult rv; NS_NAMED_LITERAL_STRING(cdata , "<![CDATA["); - if (mDoRaw || PreLevel() > 0) { + if (mPreLevel > 0 || mDoRaw) { AppendToString(cdata, aStr); } else if (mDoFormat) { AppendToStringFormatedWrapped(cdata, aStr); } else if (mDoWrap) { AppendToStringWrapped(cdata, aStr); } @@ -255,17 +255,17 @@ nsXMLContentSerializer::AppendProcessing if (NS_FAILED(rv)) return NS_ERROR_FAILURE; rv = pi->GetData(data); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; start.AppendLiteral("<?"); start.Append(target); - if (mDoRaw || PreLevel() > 0) { + if (mPreLevel > 0 || mDoRaw) { AppendToString(start, aStr); } else if (mDoFormat) { if (mAddSpace) { AppendNewLineToString(aStr); } AppendToStringFormatedWrapped(start, aStr); } @@ -313,17 +313,17 @@ nsXMLContentSerializer::AppendComment(ns } data.Assign(frag); } MaybeAddNewlineForRootNode(aStr); NS_NAMED_LITERAL_STRING(startComment, "<!--"); - if (mDoRaw || PreLevel() > 0) { + if (mPreLevel > 0 || mDoRaw) { AppendToString(startComment, aStr); } else if (mDoFormat) { if (mAddSpace) { AppendNewLineToString(aStr); } AppendToStringFormatedWrapped(startComment, aStr); } @@ -688,17 +688,17 @@ nsXMLContentSerializer::SerializeAttr(co NS_LITERAL_STRING("&")); if (bIncludesDouble && bIncludesSingle) { sValue.ReplaceSubstring(NS_LITERAL_STRING("\""), NS_LITERAL_STRING(""")); } attrString.Append(sValue); attrString.Append(cDelimiter); } - if (mDoRaw || PreLevel() > 0) { + if (mPreLevel > 0 || mDoRaw) { AppendToStringConvertLF(attrString, aStr); } else if (mDoFormat) { AppendToStringFormatedWrapped(attrString, aStr); } else if (mDoWrap) { AppendToStringWrapped(attrString, aStr); } @@ -893,17 +893,17 @@ nsXMLContentSerializer::AppendElementSta aElement->NodeInfo()->GetNamespaceURI(tagNamespaceURI); uint32_t skipAttr = ScanNamespaceDeclarations(content, aOriginalElement, tagNamespaceURI); 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); } else { MaybeAddNewlineForRootNode(aStr); } if (!mColPos) { AppendIndentation(aStr); @@ -934,28 +934,28 @@ nsXMLContentSerializer::AppendElementSta if (!tagPrefix.IsEmpty()) { AppendToString(tagPrefix, aStr); AppendToString(NS_LITERAL_STRING(":"), aStr); } AppendToString(tagLocalName, aStr); MaybeEnterInPreContent(content); - if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) { + if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) { IncrIndentation(name); } SerializeAttributes(content, aOriginalElement, tagPrefix, tagNamespaceURI, name, aStr, skipAttr, addNSAttr); 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); } AfterElementStart(content, aOriginalElement, aStr); return NS_OK; } @@ -982,17 +982,17 @@ nsXMLContentSerializer::AppendElementEnd nsIContent* content = aElement; bool forceFormat = false, outputElementEnd; outputElementEnd = CheckElementEnd(content, forceFormat, aStr); nsIAtom *name = content->Tag(); - if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) { + if ((mDoFormat || forceFormat) && !mPreLevel && !mDoRaw) { DecrIndentation(name); } if (!outputElementEnd) { PopNameSpaceDeclsFor(aElement); MaybeFlagNewlineForRootNode(aElement); return NS_OK; } @@ -1004,17 +1004,17 @@ nsXMLContentSerializer::AppendElementEnd aElement->NodeInfo()->GetNamespaceURI(tagNamespaceURI); #ifdef DEBUG bool debugNeedToPushNamespace = #endif 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); if (mColPos && lineBreakBeforeClose) { AppendNewLineToString(aStr); } if (!mColPos) { AppendIndentation(aStr); @@ -1036,18 +1036,18 @@ nsXMLContentSerializer::AppendElementEnd } AppendToString(tagLocalName, aStr); AppendToString(kGreaterThan, aStr); PopNameSpaceDeclsFor(aElement); MaybeLeaveFromPreContent(content); - if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel() - && LineBreakAfterClose(content->GetNameSpaceID(), name)) { + if ((mDoFormat || forceFormat) && !mPreLevel + && !mDoRaw && LineBreakAfterClose(content->GetNameSpaceID(), name)) { AppendNewLineToString(aStr); } else { MaybeFlagNewlineForRootNode(aElement); } AfterElementEnd(content, aStr); @@ -1212,35 +1212,33 @@ nsXMLContentSerializer::MaybeFlagNewline mAddNewlineForRootNode = parent->IsNodeOfType(nsINode::eDOCUMENT); } } 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; } } 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; } } void nsXMLContentSerializer::AppendNewLineToString(nsAString& aStr) { AppendToString(mLineBreak, aStr); mMayIgnoreLineBreakSequence = true; @@ -1439,17 +1437,17 @@ nsXMLContentSerializer::AppendWrapped_No uint32_t length, colPos; do { if (mColPos) { colPos = mColPos; } else { - if (mDoFormat && !mDoRaw && !PreLevel() && !onceAgainBecauseWeAddedBreakInFront) { + if (mDoFormat && !mPreLevel && !onceAgainBecauseWeAddedBreakInFront) { colPos = mIndent.Length(); } else colPos = 0; } foundWhitespaceInLoop = false; length = 0; // we iterate until the next whitespace character @@ -1708,15 +1706,8 @@ nsXMLContentSerializer::AppendToStringWr AppendWrapped_WhitespaceSequence(pos, end, sequenceStart, aOutputStr); } else { // any other non-whitespace char AppendWrapped_NonWhitespaceSequence(pos, end, sequenceStart, mayIgnoreStartOfLineWhitespaceSequence, sequenceStartAfterAWhitespace, aOutputStr); } } } - -bool -nsXMLContentSerializer::ShouldMaintainPreLevel() const -{ - // Only attempt to maintain the pre level for consumers who care about it. - return !mDoRaw || (mFlags & nsIDocumentEncoder::OutputNoFormattingInPre); -}
--- a/dom/base/nsXMLContentSerializer.h +++ b/dom/base/nsXMLContentSerializer.h @@ -27,19 +27,19 @@ class nsIDOMNode; class nsINode; class nsXMLContentSerializer : public nsIContentSerializer { public: nsXMLContentSerializer(); 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; NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, int32_t aStartOffset, int32_t aEndOffset, nsAString& aStr) MOZ_OVERRIDE; @@ -289,26 +289,16 @@ class nsXMLContentSerializer : public ns // the root of a document. See mAddNewlineForRootNode void MaybeAddNewlineForRootNode(nsAString& aStr); void MaybeFlagNewlineForRootNode(nsINode* aNode); // Functions to check if we enter in or leave from a preformated content 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 { nsString mPrefix; nsString mURI; nsIContent* mOwner; }; @@ -366,17 +356,16 @@ class nsXMLContentSerializer : public ns // says that if the next string to add contains a newline character at the // begining, then this newline character should be ignored, because a // such character has already been added into the output string bool mMayIgnoreLineBreakSequence; bool mBodyOnly; int32_t mInBody; -private: // number of nested elements which have preformated content int32_t mPreLevel; }; nsresult NS_NewXMLContentSerializer(nsIContentSerializer** aSerializer); #endif
--- a/dom/base/test/copypaste.js +++ b/dom/base/test/copypaste.js @@ -155,27 +155,27 @@ function testCopyPaste (isXHTML) { } else { testClipboardValue("text/html", "<div id=\"div4\">\n T<textarea>t t t</textarea>\n</div>"); testInnerHTML("div4", "\n T<textarea>t t t</textarea>\n"); } 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"); } else { 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(""); // START Disabled due to bug 564688 if (false) { testClipboardValue("text/unicode", ""); testClipboardValue("text/html", ""); }
--- a/dom/base/test/file_htmlserializer_1_bodyonly.html +++ b/dom/base/test/file_htmlserializer_1_bodyonly.html @@ -28,19 +28,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_format.html +++ b/dom/base/test/file_htmlserializer_1_format.html @@ -37,24 +37,21 @@ var d = a < b && a > c; <li> non lacus posuere aliquet.</li> <li> Sed fermentum posuere nulla</li> <li> Donec tempor.</li> </ol> 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> - 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p> </body> </html>
--- a/dom/base/test/file_htmlserializer_1_linebreak.html +++ b/dom/base/test/file_htmlserializer_1_linebreak.html @@ -32,19 +32,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_links.html +++ b/dom/base/test/file_htmlserializer_1_links.html @@ -32,19 +32,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html>
--- a/dom/base/test/file_htmlserializer_1_nested_body.html +++ b/dom/base/test/file_htmlserializer_1_nested_body.html @@ -32,19 +32,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p><body><p>this is an other body element</p></body></body></html> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_noflag.html +++ b/dom/base/test/file_htmlserializer_1_noflag.html @@ -32,19 +32,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_noformatpre.html +++ b/dom/base/test/file_htmlserializer_1_noformatpre.html @@ -29,22 +29,23 @@ var a=3, b=4, c=7; var d = a < b && a > c; </script> <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_sibling_body.html +++ b/dom/base/test/file_htmlserializer_1_sibling_body.html @@ -32,19 +32,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_sibling_body_only_body.html +++ b/dom/base/test/file_htmlserializer_1_sibling_body_only_body.html @@ -28,19 +28,16 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body> \ No newline at end of file
--- a/dom/base/test/file_htmlserializer_1_wrap.html +++ b/dom/base/test/file_htmlserializer_1_wrap.html @@ -36,20 +36,17 @@ var d = a < b && a > c; a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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> + 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> <p>Curabitur consectetuer urna a sem. Nunc & non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p></body></html> \ No newline at end of file
--- a/dom/base/test/file_xhtmlserializer_1_bodyonly.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_bodyonly.xhtml @@ -30,20 +30,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_format.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_format.xhtml @@ -40,24 +40,21 @@ var d = a < b && a > c; <li> non lacus posuere aliquet.</li> <li> Sed fermentum posuere nulla</li> <li> Donec tempor.</li> </ol> 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 /> - 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_linebreak.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_linebreak.xhtml @@ -38,20 +38,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_links.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_links.xhtml @@ -38,20 +38,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_nested_body.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_nested_body.xhtml @@ -38,20 +38,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_noflag.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_noflag.xhtml @@ -38,20 +38,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_noformatpre.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_noformatpre.xhtml @@ -35,23 +35,24 @@ var d = a < b && a > c; //]]> </script> <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 <!-- empty element: end tag should be generated for backward compatibility with HTML --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_sibling_body.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_sibling_body.xhtml @@ -38,20 +38,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml @@ -30,20 +30,17 @@ var d = a < b && a > c; <ol><li>Fusce a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti</p>
--- a/dom/base/test/file_xhtmlserializer_1_wrap.xhtml +++ b/dom/base/test/file_xhtmlserializer_1_wrap.xhtml @@ -41,20 +41,17 @@ var d = a < b && a > c; a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol> 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 /> + 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 --> <p></p> <noscript> <p>Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus</p></noscript> <p>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
--- a/dom/base/test/test_bug116083.html +++ b/dom/base/test/test_bug116083.html @@ -11,20 +11,16 @@ https://bugzilla.mozilla.org/show_bug.cg </head> <body> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=116083">Mozilla Bug 116083</a> <div id="content"> <div style="white-space: pre">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: -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=" foo bar ">foo bar</div> </div> <script type="application/javascript"> SimpleTest.waitForExplicitFinish(); SimpleTest.waitForFocus(function nextTest() { var div = document.querySelector("#content>div"); if (!div) {