From ed68b313490b6306ea4d31c926908d2ae4b13611 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Thu, 10 Nov 2016 21:10:50 +0900 Subject: [PATCH] Bug 1310912 - Part 3. The selection into PlaceholderTransaction should be updated via RangeUpdater. r=masayuki Since the selection into PlaceholderTransaction isn't updated via RangeUpdater, UndoTransaction may return error when selection/caret position is changed. Then, redo is failed. So we should add selection into PlaceholderTrancation to RangeUpdater. MozReview-Commit-ID: LcUIiUExNhx --HG-- extra : rebase_source : 9e1a71a7f497181171209ac05edcbddae227ab93 extra : histedit_source : 200dfd7957bf1b4dc92af72bb8b864cb457d62ab --- editor/libeditor/EditorBase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 826f5ca4e874..6f8d55296ab0 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -927,6 +927,7 @@ EditorBase::BeginPlaceHolderTransaction(nsIAtom* aName) if (selection) { mSelState = new SelectionState(); mSelState->SaveSelection(selection); + mRangeUpdater.RegisterSelectionState(*mSelState); } } mPlaceHolderBatch++; @@ -978,6 +979,7 @@ EditorBase::EndPlaceHolderTransaction() if (mSelState) { // we saved the selection state, but never got to hand it to placeholder // (else we ould have nulled out this pointer), so destroy it to prevent leaks. + mRangeUpdater.DropSelectionState(*mSelState); delete mSelState; mSelState = nullptr; }