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
This commit is contained in:
Makoto Kato 2016-11-10 21:10:50 +09:00
parent c962bbc74c
commit ed68b31349

View File

@ -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;
}