From 435ec5d98e49dc2f024e15127a4b94c8983d9eeb Mon Sep 17 00:00:00 2001 From: Jorg K Date: Mon, 4 Apr 2016 23:54:00 +0200 Subject: [PATCH] Bug 233705 - remove mDontWrapAnyQuotes, mWrapToWindow and pref wrap_to_window_width. r=ehsan --- dom/base/nsPlainTextSerializer.cpp | 13 +------------ dom/base/nsPlainTextSerializer.h | 9 --------- editor/libeditor/nsHTMLDataTransfer.cpp | 6 ------ editor/libeditor/nsPlaintextEditor.cpp | 21 +++++---------------- editor/libeditor/nsPlaintextEditor.h | 1 - 5 files changed, 6 insertions(+), 44 deletions(-) diff --git a/dom/base/nsPlainTextSerializer.cpp b/dom/base/nsPlainTextSerializer.cpp index 1accfa2bd793..2d0226c89866 100644 --- a/dom/base/nsPlainTextSerializer.cpp +++ b/dom/base/nsPlainTextSerializer.cpp @@ -74,7 +74,6 @@ nsPlainTextSerializer::nsPlainTextSerializer() mCiteQuoteLevel = 0; mStructs = true; // will be read from prefs later mHeaderStrategy = 1 /*indent increasingly*/; // ditto - mDontWrapAnyQuotes = false; // ditto mHasWrittenCiteBlockquote = false; mSpanLevel = 0; for (int32_t i = 0; i <= 6; i++) { @@ -178,15 +177,6 @@ nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn, mHeaderStrategy = Preferences::GetInt(PREF_HEADER_STRATEGY, mHeaderStrategy); - - // DontWrapAnyQuotes is set according to whether plaintext mail - // is wrapping to window width -- see bug 134439. - // We'll only want this if we're wrapping and formatted. - if (mFlags & nsIDocumentEncoder::OutputWrap || mWrapColumn > 0) { - mDontWrapAnyQuotes = - Preferences::GetBool("mail.compose.wrap_to_window_width", - mDontWrapAnyQuotes); - } } // The pref is default inited to false in libpref, but we use true @@ -1588,8 +1578,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr) // that does normal formatted text. The one for preformatted text calls // Output directly while the other code path goes through AddToLine. if ((mPreFormattedMail && !mWrapColumn) || (IsInPre() && !mPreFormattedMail) - || ((mSpanLevel > 0 || mDontWrapAnyQuotes) - && mEmptyLines >= 0 && str.First() == char16_t('>'))) { + || (mSpanLevel > 0 && mEmptyLines >= 0 && str.First() == char16_t('>'))) { // No intelligent wrapping. // This mustn't be mixed with intelligent wrapping without clearing diff --git a/dom/base/nsPlainTextSerializer.h b/dom/base/nsPlainTextSerializer.h index acdbff5bae0d..3b45408febc1 100644 --- a/dom/base/nsPlainTextSerializer.h +++ b/dom/base/nsPlainTextSerializer.h @@ -128,15 +128,6 @@ private: 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. ">> ") - // which makes the line length longer. - // Mail can represent quotes in different ways: - // Not wrapped in any special tag (if mail.compose.wrap_to_window_width) - // or in a . - bool mDontWrapAnyQuotes; // no special quote markers - bool mStructs; // Output structs (pref) // If we've just written out a cite blockquote, we need to remember it diff --git a/editor/libeditor/nsHTMLDataTransfer.cpp b/editor/libeditor/nsHTMLDataTransfer.cpp index 3286a937394a..38a2b309fd4d 100644 --- a/editor/libeditor/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/nsHTMLDataTransfer.cpp @@ -1658,9 +1658,6 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType) NS_IMETHODIMP nsHTMLEditor::InsertTextWithQuotations(const nsAString &aStringToInsert) { - if (mWrapToWindow) - return InsertText(aStringToInsert); - // The whole operation should be undoable in one transaction: BeginTransaction(); @@ -1761,9 +1758,6 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText, bool aAddCites, nsIDOMNode **aNodeInserted) { - if (mWrapToWindow) - return nsPlaintextEditor::InsertAsQuotation(aQuotedText, aNodeInserted); - // get selection RefPtr selection = GetSelection(); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); diff --git a/editor/libeditor/nsPlaintextEditor.cpp b/editor/libeditor/nsPlaintextEditor.cpp index 2ce2b624566f..ed34587fc2b8 100644 --- a/editor/libeditor/nsPlaintextEditor.cpp +++ b/editor/libeditor/nsPlaintextEditor.cpp @@ -69,7 +69,6 @@ using namespace mozilla::dom; nsPlaintextEditor::nsPlaintextEditor() : nsEditor() , mRules(nullptr) -, mWrapToWindow(false) , mWrapColumn(0) , mMaxTextLength(-1) , mInitTriggerCounter(0) @@ -1045,27 +1044,17 @@ nsPlaintextEditor::SetWrapWidth(int32_t aWrapColumn) if (IsWrapHackEnabled() && aWrapColumn >= 0) styleValue.AppendLiteral("font-family: -moz-fixed; "); - // If "mail.compose.wrap_to_window_width" is set, and we're a mail editor, - // then remember our wrap width (for output purposes) but set the visual - // wrapping to window width. - // We may reset mWrapToWindow here, based on the pref's current value. - if (IsMailEditor()) - { - mWrapToWindow = - Preferences::GetBool("mail.compose.wrap_to_window_width", mWrapToWindow); - } - // and now we're ready to set the new whitespace/wrapping style. - if (aWrapColumn > 0 && !mWrapToWindow) // Wrap to a fixed column - { + if (aWrapColumn > 0) { + // Wrap to a fixed column. styleValue.AppendLiteral("white-space: pre-wrap; width: "); styleValue.AppendInt(aWrapColumn); styleValue.AppendLiteral("ch;"); - } - else if (mWrapToWindow || aWrapColumn == 0) + } else if (aWrapColumn == 0) { styleValue.AppendLiteral("white-space: pre-wrap;"); - else + } else { styleValue.AppendLiteral("white-space: pre;"); + } return rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::style, styleValue, true); } diff --git a/editor/libeditor/nsPlaintextEditor.h b/editor/libeditor/nsPlaintextEditor.h index 8df00eaa5e2f..6975aeedd903 100644 --- a/editor/libeditor/nsPlaintextEditor.h +++ b/editor/libeditor/nsPlaintextEditor.h @@ -218,7 +218,6 @@ protected: protected: nsCOMPtr mRules; - bool mWrapToWindow; int32_t mWrapColumn; int32_t mMaxTextLength; int32_t mInitTriggerCounter;