Bug 1395157 - Make EditorBase::EndPlaceholderTransaction() not retrieve nor hold nsIPresShell and nsCaret r?ehsan draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 30 Aug 2017 23:24:26 +0900
changeset 655921 cb3c9e14469e3fdf9678d9ce7f18fe817248cc11
parent 655920 93080e6f531659277a704e2d74dd4c8de6f8de43
child 728948 2ccd7d9daf3fffd40833c757b1d8cd292ba9677f
push id76999
push usermasayuki@d-toybox.com
push dateWed, 30 Aug 2017 14:31:24 +0000
reviewersehsan
bugs1395157, 805697
milestone57.0a1
Bug 1395157 - Make EditorBase::EndPlaceholderTransaction() not retrieve nor hold nsIPresShell and nsCaret r?ehsan EditorBase::EndPlaceholderTransaction() has hidden caret. However, it doesn't do it anymore. However, bug 805697 didn't remove unnecessary code that retrieves and hold nsIPresShell and nsCaret. This patch removes them. MozReview-Commit-ID: Eh9pbf8p2bZ
editor/libeditor/EditorBase.cpp
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -996,34 +996,23 @@ EditorBase::EndPlaceholderTransaction()
     // allow the selection to cache a frame offset which is used by the
     // caret drawing code. We only enable this cache here; at other times,
     // we have no way to know whether reflow invalidates it
     // See bugs 35296 and 199412.
     if (selection) {
       selection->SetCanCacheFrameOffset(true);
     }
 
-    {
-      // Hide the caret here to avoid hiding it twice, once in EndUpdateViewBatch
-      // and once in ScrollSelectionIntoView.
-      RefPtr<nsCaret> caret;
-      nsCOMPtr<nsIPresShell> presShell = GetPresShell();
-
-      if (presShell) {
-        caret = presShell->GetCaret();
-      }
-
-      // time to turn off the batch
-      EndUpdateViewBatch();
-      // make sure selection is in view
-
-      // After ScrollSelectionIntoView(), the pending notifications might be
-      // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
-      ScrollSelectionIntoView(false);
-    }
+    // time to turn off the batch
+    EndUpdateViewBatch();
+    // make sure selection is in view
+
+    // After ScrollSelectionIntoView(), the pending notifications might be
+    // flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
+    ScrollSelectionIntoView(false);
 
     // cached for frame offset are Not available now
     if (selection) {
       selection->SetCanCacheFrameOffset(false);
     }
 
     if (mSelState) {
       // we saved the selection state, but never got to hand it to placeholder