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
--- 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