mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-29 07:17:05 +00:00
ported from UXP: Bug 1337698 - Use UniquePtr instead of nsAutoPtr in editor (32e4ad01)
This commit is contained in:
@@ -681,13 +681,10 @@ EditorBase::DoTransaction(nsITransaction* aTxn)
|
||||
{
|
||||
if (mPlaceHolderBatch && !mPlaceHolderTxn) {
|
||||
nsCOMPtr<nsIAbsorbingTransaction> placeholderTransaction =
|
||||
new PlaceholderTransaction();
|
||||
new PlaceholderTransaction(*this, mPlaceHolderName, Move(mSelState));
|
||||
|
||||
// Save off weak reference to placeholder transaction
|
||||
mPlaceHolderTxn = do_GetWeakReference(placeholderTransaction);
|
||||
placeholderTransaction->Init(mPlaceHolderName, mSelState, this);
|
||||
// placeholder txn took ownership of this pointer
|
||||
mSelState = nullptr;
|
||||
|
||||
// QI to an nsITransaction since that's what DoTransaction() expects
|
||||
nsCOMPtr<nsITransaction> transaction =
|
||||
@@ -937,7 +934,7 @@ EditorBase::BeginPlaceHolderTransaction(nsIAtom* aName)
|
||||
mPlaceHolderName = aName;
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
if (selection) {
|
||||
mSelState = new SelectionState();
|
||||
mSelState = MakeUnique<SelectionState>();
|
||||
mSelState->SaveSelection(selection);
|
||||
// Composition transaction can modify multiple nodes and it merges text
|
||||
// node for ime into single text node.
|
||||
@@ -1001,7 +998,6 @@ EditorBase::EndPlaceHolderTransaction()
|
||||
if (mPlaceHolderName == nsGkAtoms::IMETxnName) {
|
||||
mRangeUpdater.DropSelectionState(*mSelState);
|
||||
}
|
||||
delete mSelState;
|
||||
mSelState = nullptr;
|
||||
}
|
||||
// We might have never made a placeholder if no action took place.
|
||||
|
||||
Reference in New Issue
Block a user