mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 233705 - remove mDontWrapAnyQuotes, mWrapToWindow and pref wrap_to_window_width. r=ehsan
This commit is contained in:
parent
01cfd1d6c6
commit
435ec5d98e
@ -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
|
||||
|
@ -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 <span>.
|
||||
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
|
||||
|
@ -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> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -218,7 +218,6 @@ protected:
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIEditRules> mRules;
|
||||
bool mWrapToWindow;
|
||||
int32_t mWrapColumn;
|
||||
int32_t mMaxTextLength;
|
||||
int32_t mInitTriggerCounter;
|
||||
|
Loading…
Reference in New Issue
Block a user