Bug 739537 - No longer drop leading space from the plain text clipboard flavor when exporting both HTML and plain text to clipboard. r=smaug.
authorHenri Sivonen <hsivonen@iki.fi>
Tue, 03 Apr 2012 09:44:15 +0300
changeset 94213 7857c5bff0171c41a2242442aa1bcd232ee87cdf
parent 94212 d2f8fa7e076ccba6cc82f6ac53b1086fc5575e2f
child 94214 8d741cb2569a3309dea63e2f2ffc952a7332824a
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs739537
milestone14.0a1
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
Bug 739537 - No longer drop leading space from the plain text clipboard flavor when exporting both HTML and plain text to clipboard. r=smaug.
content/base/src/nsCopySupport.cpp
content/base/test/test_copypaste.html
--- a/content/base/src/nsCopySupport.cpp
+++ b/content/base/src/nsCopySupport.cpp
@@ -183,20 +183,16 @@ SelectionCopyHelper(nsISelection *aSel, 
     rv = docEncoder->SetSelection(aSel);
     if (NS_FAILED(rv))
       return rv;
 
     rv = docEncoder->EncodeToString(plaintextBuffer);
     if (NS_FAILED(rv))
       return rv;
 
-    // Emulate the collateral damage from bug 564737. Remove the following
-    // line to fix bug 739537.
-    plaintextBuffer.Trim(" ", true, false);
-
     // Now create the version that shows HTML context
 
     mimeType.AssignLiteral(kHTMLMime);
 
     flags = aFlags;
 
     rv = docEncoder->Init(domDoc, mimeType, flags);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/content/base/test/test_copypaste.html
+++ b/content/base/test/test_copypaste.html
@@ -127,45 +127,45 @@ function testCopyPaste () {
   testClipboardValue("text/unicode",
                      "This is a draggable bit of text.");
   testClipboardValue("text/html",
                      "<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em> bit of text.</div>");
   testPasteText("This is a draggable bit of text.");
 
   copyChildrenToClipboard("alist");
   testSelectionToString(" bla\n\n    foo\n    bar\n\n");
-  testClipboardValue("text/unicode", "bla\n\n    foo\n    bar\n\n");
+  testClipboardValue("text/unicode", " bla\n\n    foo\n    bar\n\n");
   testClipboardValue("text/html", "<div id=\"alist\">\n    bla\n    <ul>\n      <li>foo</li>\n      \n      <li>bar</li>\n    </ul>\n  </div>");
-  testPasteText("bla\n\n    foo\n    bar\n\n");
+  testPasteText(" bla\n\n    foo\n    bar\n\n");
 
   copyChildrenToClipboard("blist");
   testSelectionToString(" mozilla\n\n    foo\n    bar\n\n");
-  testClipboardValue("text/unicode", "mozilla\n\n    foo\n    bar\n\n");
+  testClipboardValue("text/unicode", " mozilla\n\n    foo\n    bar\n\n");
   testClipboardValue("text/html", "<div id=\"blist\">\n    mozilla\n    <ol>\n      <li>foo</li>\n      \n      <li>bar</li>\n    </ol>\n  </div>");
-  testPasteText("mozilla\n\n    foo\n    bar\n\n");
+  testPasteText(" mozilla\n\n    foo\n    bar\n\n");
 
   copyChildrenToClipboard("clist");
   testSelectionToString(" mzla\n\n    foo\n        bazzinga!\n    bar\n\n");
-  testClipboardValue("text/unicode", "mzla\n\n    foo\n        bazzinga!\n    bar\n\n");
+  testClipboardValue("text/unicode", " mzla\n\n    foo\n        bazzinga!\n    bar\n\n");
   testClipboardValue("text/html", "<div id=\"clist\">\n    mzla\n    <ul>\n      <li>foo<ul>\n        <li>bazzinga!</li>\n      </ul></li>\n      \n      <li>bar</li>\n    </ul>\n  </div>");
-  testPasteText("mzla\n\n    foo\n        bazzinga!\n    bar\n\n");
+  testPasteText(" mzla\n\n    foo\n        bazzinga!\n    bar\n\n");
 
   copyChildrenToClipboard("div4");
   testSelectionToString(" Tt t t ");
-  testClipboardValue("text/unicode", "Tt t t ");
+  testClipboardValue("text/unicode", " Tt t t ");
   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 ");
+  testPasteText(" Tt t t ");
 
   copyChildrenToClipboard("div5");
   testSelectionToString(" T ");
-  testClipboardValue("text/unicode", "T ");
+  testClipboardValue("text/unicode", " T ");
   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);
   testSelectionToString("");
 // START Disabled due to bug 564688
 if (false) {
   testClipboardValue("text/unicode", "");
   testClipboardValue("text/html", "");
 }