mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 14:28:39 +09:00
Bug 1337698 - Use UniquePtr instead of nsAutoPtr in editor
* PlaceholderTransaction should use UniquePtr * HTMLEditor should use UniquePtr * TypeInState should use UniquePtr Tag #1375
This commit is contained in:
parent
6aa436b588
commit
32e4ad01e3
10 changed files with 32 additions and 44 deletions
|
|
@ -688,13 +688,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 =
|
||||
|
|
@ -944,7 +941,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.
|
||||
|
|
@ -1008,7 +1005,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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue