Bug 1401225 - Pass the correct length when collapsing the selection in EditorBase::SetTextImpl(); r=masayuki
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 19 Sep 2017 11:31:28 -0400
changeset 431427 4d924f659b8cbc214e233bb4ea005ceaa84c42a1
parent 431426 aa3fff074f3248cb11c4552dda41b533bd8016c2
child 431428 4193c11e97aeab5a258d5499bf4a4d9177b27380
push id7784
push userryanvm@gmail.com
push dateThu, 21 Sep 2017 00:40:13 +0000
treeherdermozilla-beta@efff4f307675 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1401225
milestone57.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 1401225 - Pass the correct length when collapsing the selection in EditorBase::SetTextImpl(); r=masayuki
editor/libeditor/EditorBase.cpp
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2741,17 +2741,17 @@ EditorBase::SetTextImpl(Selection& aSele
   nsresult rv = aCharData.SetData(aString);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Only set selection to insertion point if editor gives permission
   if (GetShouldTxnSetSelection()) {
     RefPtr<Selection> selection = GetSelection();
-    DebugOnly<nsresult> rv = selection->Collapse(&aCharData, length);
+    DebugOnly<nsresult> rv = selection->Collapse(&aCharData, aString.Length());
     NS_ASSERTION(NS_SUCCEEDED(rv),
                  "Selection could not be collapsed after insert");
   }
   mRangeUpdater.SelAdjDeleteText(&aCharData, 0, length);
   mRangeUpdater.SelAdjInsertText(aCharData, 0, aString);
 
   // Let listeners know what happened
   {