Bug 1385525 - Part 1: Speed up EditorBase::SetTextImpl() by actually bypassing all of the editor transaction management machinery; r=masayuki
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 28 Jul 2017 22:47:10 -0400
changeset 420842 df5e7bd8b6735c863c9f34c04be49089c478535f
parent 420841 26e332a412c740da5803576bb30e665fc13d7143
child 420843 dfb4439aa194de33421b2ebfc0b71238b975c2d5
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1385525
milestone56.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 1385525 - Part 1: Speed up EditorBase::SetTextImpl() by actually bypassing all of the editor transaction management machinery; r=masayuki
editor/libeditor/EditorBase.cpp
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2746,17 +2746,20 @@ EditorBase::SetTextImpl(Selection& aSele
       if (!aString.IsEmpty()) {
         listener->WillInsertText(
           static_cast<nsIDOMCharacterData*>(aCharData.AsDOMNode()), 0,
           aString);
       }
     }
   }
 
-  nsresult rv = DoTransaction(&aSelection, transaction);
+  // We don't support undo here, so we don't really need all of the transaction
+  // machinery, therefore we can run our transaction directly, breaking all of
+  // the rules!
+  nsresult rv = transaction->DoTransaction();
 
   // Let listeners know what happened
   {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
       if (length) {
         listener->DidDeleteText(
           static_cast<nsIDOMCharacterData*>(aCharData.AsDOMNode()), 0,