Bug 387687 - wrap quotes in plain text replies to window. r=masayuki
authorJorg K
Tue, 05 Apr 2016 00:22:00 +0200
changeset 348386 192a5ffbf501cf1699cbb1b2498bbb9c9862cbcc
parent 348385 efaed594f0fdad3825e4bbd9bc1efacc17fccf50
child 348387 85a2d1e3cf9548108ec1124f001a1abe9ace1f03
push id14828
push userpehrsons@gmail.com
push dateThu, 07 Apr 2016 12:57:27 +0000
reviewersmasayuki
bugs387687
milestone48.0a1
Bug 387687 - wrap quotes in plain text replies to window. r=masayuki
editor/libeditor/nsHTMLDataTransfer.cpp
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -1771,32 +1771,31 @@ nsHTMLEditor::InsertAsPlaintextQuotation
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
   nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel || handled) {
     return NS_OK; // rules canceled the operation
   }
 
-  // Wrap the inserted quote in a <span> so it won't be wrapped:
+  // Wrap the inserted quote in a <span> so we can distinguish it.
   nsCOMPtr<Element> newNode =
     DeleteSelectionAndCreateElement(*nsGkAtoms::span);
 
   // If this succeeded, then set selection inside the pre
   // so the inserted text will end up there.
   // If it failed, we don't care what the return value was,
   // but we'll fall through and try to insert the text anyway.
   if (newNode) {
     // Add an attribute on the pre node so we'll know it's a quotation.
-    // Do this after the insertion, so that
     newNode->SetAttr(kNameSpaceID_None, nsGkAtoms::mozquote,
                      NS_LITERAL_STRING("true"), true);
-    // turn off wrapping on spans
+    // Allow wrapping on spans so long lines get wrapped to the screen.
     newNode->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
-                     NS_LITERAL_STRING("white-space: pre;"), true);
+                     NS_LITERAL_STRING("white-space: pre-wrap;"), true);
 
     // and set the selection inside it:
     selection->Collapse(newNode, 0);
   }
 
   if (aAddCites)
     rv = nsPlaintextEditor::InsertAsQuotation(aQuotedText, aNodeInserted);
   else