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:
Matt A. Tobin 2020-04-17 05:43:18 -04:00 committed by Roy Tam
commit 32e4ad01e3
10 changed files with 32 additions and 44 deletions

View file

@ -8,6 +8,7 @@
#include "CompositionTransaction.h"
#include "mozilla/EditorBase.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/Move.h"
#include "nsGkAtoms.h"
#include "nsQueryObject.h"
@ -15,13 +16,18 @@ namespace mozilla {
using namespace dom;
PlaceholderTransaction::PlaceholderTransaction()
PlaceholderTransaction::PlaceholderTransaction(
EditorBase& aEditorBase,
nsIAtom* aName,
UniquePtr<SelectionState> aSelState)
: mAbsorb(true)
, mForwarding(nullptr)
, mCompositionTransaction(nullptr)
, mCommitted(false)
, mEditorBase(nullptr)
, mStartSel(Move(aSelState))
, mEditorBase(&aEditorBase)
{
mName = aName;
}
PlaceholderTransaction::~PlaceholderTransaction()
@ -56,19 +62,6 @@ NS_INTERFACE_MAP_END_INHERITING(EditAggregateTransaction)
NS_IMPL_ADDREF_INHERITED(PlaceholderTransaction, EditAggregateTransaction)
NS_IMPL_RELEASE_INHERITED(PlaceholderTransaction, EditAggregateTransaction)
NS_IMETHODIMP
PlaceholderTransaction::Init(nsIAtom* aName,
SelectionState* aSelState,
EditorBase* aEditorBase)
{
NS_ENSURE_TRUE(aEditorBase && aSelState, NS_ERROR_NULL_POINTER);
mName = aName;
mStartSel = aSelState;
mEditorBase = aEditorBase;
return NS_OK;
}
NS_IMETHODIMP
PlaceholderTransaction::DoTransaction()
{