--- a/editor/libeditor/ChangeAttributeTransaction.cpp
+++ b/editor/libeditor/ChangeAttributeTransaction.cpp
@@ -12,37 +12,38 @@
namespace mozilla {
using namespace dom;
ChangeAttributeTransaction::ChangeAttributeTransaction(Element& aElement,
nsIAtom& aAttribute,
const nsAString* aValue)
- : EditTxn()
+ : EditTransactionBase()
, mElement(&aElement)
, mAttribute(&aAttribute)
, mValue(aValue ? *aValue : EmptyString())
, mRemoveAttribute(!aValue)
, mAttributeWasSet(false)
, mUndoValue()
{
}
ChangeAttributeTransaction::~ChangeAttributeTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(ChangeAttributeTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(ChangeAttributeTransaction,
+ EditTransactionBase,
mElement)
-NS_IMPL_ADDREF_INHERITED(ChangeAttributeTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(ChangeAttributeTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(ChangeAttributeTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(ChangeAttributeTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ChangeAttributeTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
ChangeAttributeTransaction::DoTransaction()
{
// Need to get the current value of the attribute and save it, and set
// mAttributeWasSet
mAttributeWasSet = mElement->GetAttr(kNameSpaceID_None, mAttribute,
mUndoValue);
--- a/editor/libeditor/ChangeAttributeTransaction.h
+++ b/editor/libeditor/ChangeAttributeTransaction.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ChangeAttributeTransaction_h
#define ChangeAttributeTransaction_h
-#include "EditTxn.h" // base class
+#include "EditTransactionBase.h" // base class
#include "mozilla/Attributes.h" // override
#include "nsCOMPtr.h" // nsCOMPtr members
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED
#include "nsISupportsImpl.h" // NS_DECL_ISUPPORTS_INHERITED
#include "nsString.h" // nsString members
class nsIAtom;
@@ -20,32 +20,33 @@ namespace mozilla {
namespace dom {
class Element;
} // namespace dom
/**
* A transaction that changes an attribute of a content node. This transaction
* covers add, remove, and change attribute.
*/
-class ChangeAttributeTransaction final : public EditTxn
+class ChangeAttributeTransaction final : public EditTransactionBase
{
public:
/**
* @param aElement the element whose attribute will be changed
* @param aAttribute the name of the attribute to change
* @param aValue the new value for aAttribute, or null to remove
*/
ChangeAttributeTransaction(dom::Element& aElement,
nsIAtom& aAttribute,
const nsAString* aValue);
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ChangeAttributeTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ChangeAttributeTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
private:
virtual ~ChangeAttributeTransaction();
// The element to operate upon
nsCOMPtr<dom::Element> mElement;
--- a/editor/libeditor/ChangeStyleTransaction.cpp
+++ b/editor/libeditor/ChangeStyleTransaction.cpp
@@ -19,23 +19,24 @@
#include "nsUnicharUtils.h" // for nsCaseInsensitiveStringComparator
namespace mozilla {
using namespace dom;
#define kNullCh (char16_t('\0'))
-NS_IMPL_CYCLE_COLLECTION_INHERITED(ChangeStyleTransaction, EditTxn, mElement)
+NS_IMPL_CYCLE_COLLECTION_INHERITED(ChangeStyleTransaction, EditTransactionBase,
+ mElement)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ChangeStyleTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
-NS_IMPL_ADDREF_INHERITED(ChangeStyleTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(ChangeStyleTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(ChangeStyleTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(ChangeStyleTransaction, EditTransactionBase)
ChangeStyleTransaction::~ChangeStyleTransaction()
{
}
// Answers true if aValue is in the string list of white-space separated values
// aValueList.
bool
@@ -117,17 +118,17 @@ ChangeStyleTransaction::RemoveValueFromL
}
aValues.Assign(outString);
}
ChangeStyleTransaction::ChangeStyleTransaction(Element& aElement,
nsIAtom& aProperty,
const nsAString& aValue,
EChangeType aChangeType)
- : EditTxn()
+ : EditTransactionBase()
, mElement(&aElement)
, mProperty(&aProperty)
, mValue(aValue)
, mRemoveProperty(aChangeType == eRemove)
, mUndoValue()
, mRedoValue()
, mUndoAttributeWasSet(false)
, mRedoAttributeWasSet(false)
--- a/editor/libeditor/ChangeStyleTransaction.h
+++ b/editor/libeditor/ChangeStyleTransaction.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ChangeStyleTransaction_h
#define ChangeStyleTransaction_h
-#include "EditTxn.h" // base class
+#include "EditTransactionBase.h" // base class
#include "nsCOMPtr.h" // nsCOMPtr members
#include "nsCycleCollectionParticipant.h" // various macros
#include "nsString.h" // nsString members
class nsAString;
class nsIAtom;
namespace mozilla {
@@ -19,24 +19,25 @@ namespace mozilla {
namespace dom {
class Element;
} // namespace dom
/**
* A transaction that changes the value of a CSS inline style of a content
* node. This transaction covers add, remove, and change a property's value.
*/
-class ChangeStyleTransaction final : public EditTxn
+class ChangeStyleTransaction final : public EditTransactionBase
{
public:
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ChangeStyleTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ChangeStyleTransaction,
+ EditTransactionBase)
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
enum EChangeType { eSet, eRemove };
/**
* @param aNode [IN] the node whose style attribute will be changed
* @param aProperty [IN] the name of the property to change
--- a/editor/libeditor/CompositionTransaction.cpp
+++ b/editor/libeditor/CompositionTransaction.cpp
@@ -35,28 +35,28 @@ CompositionTransaction::CompositionTrans
, mFixed(false)
{
}
CompositionTransaction::~CompositionTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(CompositionTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(CompositionTransaction, EditTransactionBase,
mTextNode)
// mRangeList can't lead to cycles
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CompositionTransaction)
if (aIID.Equals(NS_GET_IID(CompositionTransaction))) {
foundInterface = static_cast<nsITransaction*>(this);
} else
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
-NS_IMPL_ADDREF_INHERITED(CompositionTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(CompositionTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(CompositionTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(CompositionTransaction, EditTransactionBase)
NS_IMETHODIMP
CompositionTransaction::DoTransaction()
{
// Fail before making any changes if there's no selection controller
nsCOMPtr<nsISelectionController> selCon;
mEditor.GetSelectionController(getter_AddRefs(selCon));
NS_ENSURE_TRUE(selCon, NS_ERROR_NOT_INITIALIZED);
--- a/editor/libeditor/CompositionTransaction.h
+++ b/editor/libeditor/CompositionTransaction.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CompositionTransaction_h
#define CompositionTransaction_h
-#include "EditTxn.h" // base class
+#include "EditTransactionBase.h" // base class
#include "nsCycleCollectionParticipant.h" // various macros
#include "nsString.h" // mStringToInsert
class nsEditor;
#define NS_IMETEXTTXN_IID \
{ 0xb391355d, 0x346c, 0x43d1, \
{ 0x85, 0xed, 0x9e, 0x65, 0xbe, 0xe7, 0x7e, 0x48 } }
@@ -25,17 +25,17 @@ class Text;
} // namespace dom
/**
* CompositionTransaction stores all edit for a composition, i.e.,
* from compositionstart event to compositionend event. E.g., inserting a
* composition string, modifying the composition string or its IME selection
* ranges and commit or cancel the composition.
*/
-class CompositionTransaction final : public EditTxn
+class CompositionTransaction final : public EditTransactionBase
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMETEXTTXN_IID)
/**
* @param aTextNode The text content node.
* @param aOffset The location in aTextNode to do the insertion.
* @param aReplaceLength The length of text to replace. 0 means not
@@ -46,21 +46,22 @@ public:
* @param aEditor Used to get and set the selection.
*/
CompositionTransaction(dom::Text& aTextNode,
uint32_t aOffset, uint32_t aReplaceLength,
TextRangeArray* aTextRangeArray,
const nsAString& aString,
nsEditor& aEditor);
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CompositionTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CompositionTransaction,
+ EditTransactionBase)
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
void MarkFixed();
static nsresult SetIMESelection(nsEditor& aEditor,
dom::Text* aTextNode,
uint32_t aOffsetInNode,
--- a/editor/libeditor/CreateElementTransaction.cpp
+++ b/editor/libeditor/CreateElementTransaction.cpp
@@ -31,37 +31,38 @@
namespace mozilla {
using namespace dom;
CreateElementTransaction::CreateElementTransaction(nsEditor& aEditor,
nsIAtom& aTag,
nsINode& aParent,
int32_t aOffsetInParent)
- : EditTxn()
+ : EditTransactionBase()
, mEditor(&aEditor)
, mTag(&aTag)
, mParent(&aParent)
, mOffsetInParent(aOffsetInParent)
{
}
CreateElementTransaction::~CreateElementTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(CreateElementTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(CreateElementTransaction,
+ EditTransactionBase,
mParent,
mNewNode,
mRefNode)
-NS_IMPL_ADDREF_INHERITED(CreateElementTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(CreateElementTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(CreateElementTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(CreateElementTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CreateElementTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
CreateElementTransaction::DoTransaction()
{
MOZ_ASSERT(mEditor && mTag && mParent);
mNewNode = mEditor->CreateHTMLContent(mTag);
--- a/editor/libeditor/CreateElementTransaction.h
+++ b/editor/libeditor/CreateElementTransaction.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CreateElementTransaction_h
#define CreateElementTransaction_h
-#include "EditTxn.h"
+#include "EditTransactionBase.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"
class nsEditor;
class nsIAtom;
class nsIContent;
class nsINode;
@@ -20,17 +20,17 @@ class nsINode;
* A transaction that creates a new node in the content tree.
*/
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
-class CreateElementTransaction final : public EditTxn
+class CreateElementTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aEditor The provider of basic editing functionality.
* @param aTag The tag (P, HR, TABLE, etc.) for the new element.
* @param aParent The node into which the new element will be
* inserted.
@@ -39,19 +39,20 @@ public:
* child.
*/
CreateElementTransaction(nsEditor& aEditor,
nsIAtom& aTag,
nsINode& aParent,
int32_t aOffsetInParent);
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
already_AddRefed<dom::Element> GetNewNode();
protected:
virtual ~CreateElementTransaction();
--- a/editor/libeditor/DeleteNodeTransaction.cpp
+++ b/editor/libeditor/DeleteNodeTransaction.cpp
@@ -17,25 +17,25 @@ DeleteNodeTransaction::DeleteNodeTransac
, mRangeUpdater(nullptr)
{
}
DeleteNodeTransaction::~DeleteNodeTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(DeleteNodeTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(DeleteNodeTransaction, EditTransactionBase,
mNode,
mParent,
mRefNode)
-NS_IMPL_ADDREF_INHERITED(DeleteNodeTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(DeleteNodeTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(DeleteNodeTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(DeleteNodeTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DeleteNodeTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
nsresult
DeleteNodeTransaction::Init(nsEditor* aEditor,
nsINode* aNode,
nsRangeUpdater* aRangeUpdater)
{
NS_ENSURE_TRUE(aEditor && aNode, NS_ERROR_NULL_POINTER);
mEditor = aEditor;
--- a/editor/libeditor/DeleteNodeTransaction.h
+++ b/editor/libeditor/DeleteNodeTransaction.h
@@ -1,48 +1,49 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DeleteNodeTransaction_h
#define DeleteNodeTransaction_h
-#include "EditTxn.h"
+#include "EditTransactionBase.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h"
#include "nsINode.h"
#include "nsISupportsImpl.h"
#include "nscore.h"
class nsEditor;
class nsRangeUpdater;
namespace mozilla {
/**
* A transaction that deletes a single element
*/
-class DeleteNodeTransaction final : public EditTxn
+class DeleteNodeTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aElement The node to delete.
*/
nsresult Init(nsEditor* aEditor, nsINode* aNode,
nsRangeUpdater* aRangeUpdater);
DeleteNodeTransaction();
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
protected:
virtual ~DeleteNodeTransaction();
// The element to delete.
nsCOMPtr<nsINode> mNode;
--- a/editor/libeditor/DeleteRangeTransaction.h
+++ b/editor/libeditor/DeleteRangeTransaction.h
@@ -2,17 +2,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DeleteRangeTransaction_h
#define DeleteRangeTransaction_h
#include "EditAggregateTransaction.h"
-#include "EditTxn.h"
#include "nsCycleCollectionParticipant.h"
#include "nsID.h"
#include "nsIEditor.h"
#include "nsISupportsImpl.h"
#include "nsRange.h"
#include "nscore.h"
class nsEditor;
@@ -37,17 +36,17 @@ public:
nsRangeUpdater* aRangeUpdater);
DeleteRangeTransaction();
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTransaction,
EditAggregateTransaction)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
virtual void LastRelease() override
{
mRange = nullptr;
EditAggregateTransaction::LastRelease();
}
--- a/editor/libeditor/DeleteTextTransaction.cpp
+++ b/editor/libeditor/DeleteTextTransaction.cpp
@@ -29,21 +29,21 @@ DeleteTextTransaction::DeleteTextTransac
, mOffset(aOffset)
, mNumCharsToDelete(aNumCharsToDelete)
, mRangeUpdater(aRangeUpdater)
{
NS_ASSERTION(mCharData->Length() >= aOffset + aNumCharsToDelete,
"Trying to delete more characters than in node");
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(DeleteTextTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(DeleteTextTransaction, EditTransactionBase,
mCharData)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DeleteTextTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
nsresult
DeleteTextTransaction::Init()
{
// Do nothing if the node is read-only
if (!mEditor.IsModifiableNode(mCharData)) {
return NS_ERROR_FAILURE;
}
--- a/editor/libeditor/DeleteTextTransaction.h
+++ b/editor/libeditor/DeleteTextTransaction.h
@@ -1,33 +1,33 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DeleteTextTransaction_h
#define DeleteTextTransaction_h
-#include "EditTxn.h"
+#include "EditTransactionBase.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsGenericDOMDataNode.h"
#include "nsID.h"
#include "nsString.h"
#include "nscore.h"
class nsEditor;
class nsRangeUpdater;
namespace mozilla {
/**
* A transaction that removes text from a content node.
*/
-class DeleteTextTransaction final : public EditTxn
+class DeleteTextTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aEditor The provider of basic editing operations.
* @param aElement The content node to remove text from.
* @param aOffset The location in aElement to begin the deletion.
* @param aNumCharsToDelete The number of characters to delete. Not the
@@ -36,20 +36,21 @@ public:
DeleteTextTransaction(nsEditor& aEditor,
nsGenericDOMDataNode& aCharData,
uint32_t aOffset,
uint32_t aNumCharsToDelete,
nsRangeUpdater* aRangeUpdater);
nsresult Init();
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTransaction,
+ EditTransactionBase)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
uint32_t GetOffset() { return mOffset; }
uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; }
protected:
// The provider of basic editing operations.
nsEditor& mEditor;
--- a/editor/libeditor/EditAggregateTransaction.cpp
+++ b/editor/libeditor/EditAggregateTransaction.cpp
@@ -16,23 +16,24 @@ namespace mozilla {
EditAggregateTransaction::EditAggregateTransaction()
{
}
EditAggregateTransaction::~EditAggregateTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(EditAggregateTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(EditAggregateTransaction,
+ EditTransactionBase,
mChildren)
-NS_IMPL_ADDREF_INHERITED(EditAggregateTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(EditAggregateTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(EditAggregateTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(EditAggregateTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EditAggregateTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
EditAggregateTransaction::DoTransaction()
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
for (uint32_t i = 0, length = mChildren.Length(); i < length; ++i)
{
nsITransaction *txn = mChildren[i];
@@ -104,23 +105,23 @@ EditAggregateTransaction::GetTxnDescript
mName->ToString(name);
aString += name;
}
return NS_OK;
}
NS_IMETHODIMP
-EditAggregateTransaction::AppendChild(EditTxn* aTransaction)
+EditAggregateTransaction::AppendChild(EditTransactionBase* aTransaction)
{
if (!aTransaction) {
return NS_ERROR_NULL_POINTER;
}
- RefPtr<EditTxn> *slot = mChildren.AppendElement();
+ RefPtr<EditTransactionBase>* slot = mChildren.AppendElement();
if (!slot) {
return NS_ERROR_OUT_OF_MEMORY;
}
*slot = aTransaction;
return NS_OK;
}
--- a/editor/libeditor/EditAggregateTransaction.h
+++ b/editor/libeditor/EditAggregateTransaction.h
@@ -1,57 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef EditAggregateTransaction_h
#define EditAggregateTransaction_h
-#include "EditTxn.h"
+#include "EditTransactionBase.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIAtom.h"
#include "nsISupportsImpl.h"
#include "nsTArray.h"
#include "nscore.h"
class nsITransaction;
namespace mozilla {
/**
* base class for all document editing transactions that require aggregation.
* provides a list of child transactions.
*/
-class EditAggregateTransaction : public EditTxn
+class EditAggregateTransaction : public EditTransactionBase
{
public:
EditAggregateTransaction();
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
/**
* Append a transaction to this aggregate.
*/
- NS_IMETHOD AppendChild(EditTxn* aTxn);
+ NS_IMETHOD AppendChild(EditTransactionBase* aTransaction);
/**
* Get the name assigned to this transaction.
*/
NS_IMETHOD GetName(nsIAtom** aName);
protected:
virtual ~EditAggregateTransaction();
- nsTArray<RefPtr<EditTxn>> mChildren;
+ nsTArray<RefPtr<EditTransactionBase>> mChildren;
nsCOMPtr<nsIAtom> mName;
};
} // namespace mozilla
#endif // #ifndef EditAggregateTransaction_h
rename from editor/libeditor/EditTxn.cpp
rename to editor/libeditor/EditTransactionBase.cpp
--- a/editor/libeditor/EditTxn.cpp
+++ b/editor/libeditor/EditTransactionBase.cpp
@@ -1,50 +1,55 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "EditTxn.h"
+#include "EditTransactionBase.h"
#include "nsError.h"
#include "nsISupportsBase.h"
-NS_IMPL_CYCLE_COLLECTION_CLASS(EditTxn)
+namespace mozilla {
-NS_IMPL_CYCLE_COLLECTION_UNLINK_0(EditTxn)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EditTxn)
+NS_IMPL_CYCLE_COLLECTION_CLASS(EditTransactionBase)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_0(EditTransactionBase)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EditTransactionBase)
// We don't have anything to traverse, but some of our subclasses do.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EditTxn)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(EditTransactionBase)
NS_INTERFACE_MAP_ENTRY(nsITransaction)
NS_INTERFACE_MAP_ENTRY(nsPIEditorTransaction)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITransaction)
NS_INTERFACE_MAP_END
-NS_IMPL_CYCLE_COLLECTING_ADDREF(EditTxn)
-NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(EditTxn, LastRelease())
+NS_IMPL_CYCLE_COLLECTING_ADDREF(EditTransactionBase)
+NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(EditTransactionBase,
+ LastRelease())
-EditTxn::~EditTxn()
+EditTransactionBase::~EditTransactionBase()
{
}
NS_IMETHODIMP
-EditTxn::RedoTransaction(void)
+EditTransactionBase::RedoTransaction()
{
return DoTransaction();
}
NS_IMETHODIMP
-EditTxn::GetIsTransient(bool *aIsTransient)
+EditTransactionBase::GetIsTransient(bool* aIsTransient)
{
*aIsTransient = false;
return NS_OK;
}
NS_IMETHODIMP
-EditTxn::Merge(nsITransaction *aTransaction, bool *aDidMerge)
+EditTransactionBase::Merge(nsITransaction* aTransaction, bool* aDidMerge)
{
*aDidMerge = false;
return NS_OK;
}
+
+} // namespace mozilla
rename from editor/libeditor/EditTxn.h
rename to editor/libeditor/EditTransactionBase.h
--- a/editor/libeditor/EditTxn.h
+++ b/editor/libeditor/EditTransactionBase.h
@@ -1,40 +1,44 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef EditTxn_h__
-#define EditTxn_h__
+#ifndef EditTransactionBase_h
+#define EditTransactionBase_h
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"
#include "nsITransaction.h"
#include "nsPIEditorTransaction.h"
#include "nscore.h"
+namespace mozilla {
+
/**
* Base class for all document editing transactions.
*/
-class EditTxn : public nsITransaction,
- public nsPIEditorTransaction
+class EditTransactionBase : public nsITransaction
+ , public nsPIEditorTransaction
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(EditTxn, nsITransaction)
+ NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(EditTransactionBase, nsITransaction)
virtual void LastRelease() {}
NS_IMETHOD RedoTransaction(void) override;
- NS_IMETHOD GetIsTransient(bool *aIsTransient) override;
- NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge) override;
+ NS_IMETHOD GetIsTransient(bool* aIsTransient) override;
+ NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
protected:
- virtual ~EditTxn();
+ virtual ~EditTransactionBase();
};
-#define NS_DECL_EDITTXN \
+} // namespace mozilla
+
+#define NS_DECL_EDITTRANSACTIONBASE \
NS_IMETHOD DoTransaction() override; \
NS_IMETHOD UndoTransaction() override; \
- NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription) override;
+ NS_IMETHOD GetTxnDescription(nsAString& aTransactionDescription) override;
-#endif
+#endif // #ifndef EditTransactionBase_h
--- a/editor/libeditor/InsertNodeTransaction.cpp
+++ b/editor/libeditor/InsertNodeTransaction.cpp
@@ -30,24 +30,24 @@ InsertNodeTransaction::InsertNodeTransac
, mEditor(aEditor)
{
}
InsertNodeTransaction::~InsertNodeTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertNodeTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertNodeTransaction, EditTransactionBase,
mNode,
mParent)
-NS_IMPL_ADDREF_INHERITED(InsertNodeTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(InsertNodeTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(InsertNodeTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(InsertNodeTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(InsertNodeTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
InsertNodeTransaction::DoTransaction()
{
MOZ_ASSERT(mNode && mParent);
uint32_t count = mParent->GetChildCount();
if (mOffset > static_cast<int32_t>(count) || mOffset == -1) {
--- a/editor/libeditor/InsertNodeTransaction.h
+++ b/editor/libeditor/InsertNodeTransaction.h
@@ -1,45 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef InsertNodeTransaction_h
#define InsertNodeTransaction_h
-#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
+#include "EditTransactionBase.h" // for EditTransactionBase, etc
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h" // for nsIContent
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
class nsEditor;
namespace mozilla {
/**
* A transaction that inserts a single element
*/
-class InsertNodeTransaction final : public EditTxn
+class InsertNodeTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aNode The node to insert.
* @param aParent The node to insert into.
* @param aOffset The offset in aParent to insert aNode.
*/
InsertNodeTransaction(nsIContent& aNode, nsINode& aParent, int32_t aOffset,
nsEditor& aEditor);
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertNodeTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertNodeTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
protected:
virtual ~InsertNodeTransaction();
// The element to insert.
nsCOMPtr<nsIContent> mNode;
// The node into which the new node will be inserted.
--- a/editor/libeditor/InsertTextTransaction.cpp
+++ b/editor/libeditor/InsertTextTransaction.cpp
@@ -27,26 +27,26 @@ InsertTextTransaction::InsertTextTransac
, mEditor(aEditor)
{
}
InsertTextTransaction::~InsertTextTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertTextTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertTextTransaction, EditTransactionBase,
mTextNode)
-NS_IMPL_ADDREF_INHERITED(InsertTextTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(InsertTextTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(InsertTextTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(InsertTextTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(InsertTextTransaction)
if (aIID.Equals(NS_GET_IID(InsertTextTransaction))) {
foundInterface = static_cast<nsITransaction*>(this);
} else
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
InsertTextTransaction::DoTransaction()
{
nsresult res = mTextNode->InsertData(mOffset, mStringToInsert);
NS_ENSURE_SUCCESS(res, res);
--- a/editor/libeditor/InsertTextTransaction.h
+++ b/editor/libeditor/InsertTextTransaction.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef InsertTextTransaction_h
#define InsertTextTransaction_h
-#include "EditTxn.h" // base class
+#include "EditTransactionBase.h" // base class
#include "nsCycleCollectionParticipant.h" // various macros
#include "nsID.h" // NS_DECLARE_STATIC_IID_ACCESSOR
#include "nsISupportsImpl.h" // NS_DECL_ISUPPORTS_INHERITED
#include "nsString.h" // nsString members
#include "nscore.h" // NS_IMETHOD, nsAString
class nsEditor;
class nsITransaction;
@@ -24,34 +24,35 @@ namespace mozilla {
namespace dom {
class Text;
} // namespace dom
/**
* A transaction that inserts text into a content node.
*/
-class InsertTextTransaction final : public EditTxn
+class InsertTextTransaction final : public EditTransactionBase
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INSERTTEXTTXN_IID)
/**
* @param aElement The text content node.
* @param aOffset The location in aElement to do the insertion.
* @param aString The new text to insert.
* @param aPresShell Used to get and set the selection.
*/
InsertTextTransaction(dom::Text& aTextNode, uint32_t aOffset,
const nsAString& aString, nsEditor& aEditor);
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertTextTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertTextTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
/**
* Return the string data associated with this transaction.
*/
void GetData(nsString& aResult);
--- a/editor/libeditor/JoinNodeTransaction.cpp
+++ b/editor/libeditor/JoinNodeTransaction.cpp
@@ -6,39 +6,39 @@
#include "JoinNodeTransaction.h"
#include "nsAString.h"
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsEditor.h" // for nsEditor
#include "nsError.h" // for NS_ERROR_NULL_POINTER, etc
#include "nsIContent.h" // for nsIContent
#include "nsIDOMCharacterData.h" // for nsIDOMCharacterData
#include "nsIEditor.h" // for nsEditor::IsModifiableNode
-#include "nsISupportsImpl.h" // for EditTxn::QueryInterface, etc
+#include "nsISupportsImpl.h" // for QueryInterface, etc
namespace mozilla {
using namespace dom;
JoinNodeTransaction::JoinNodeTransaction(nsEditor& aEditor,
nsINode& aLeftNode,
nsINode& aRightNode)
: mEditor(aEditor)
, mLeftNode(&aLeftNode)
, mRightNode(&aRightNode)
, mOffset(0)
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(JoinNodeTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(JoinNodeTransaction, EditTransactionBase,
mLeftNode,
mRightNode,
mParent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JoinNodeTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
nsresult
JoinNodeTransaction::CheckValidity()
{
if (!mEditor.IsModifiableNode(mLeftNode->GetParentNode())) {
return NS_ERROR_FAILURE;
}
return NS_OK;
--- a/editor/libeditor/JoinNodeTransaction.h
+++ b/editor/libeditor/JoinNodeTransaction.h
@@ -1,53 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef JoinNodeTransaction_h
#define JoinNodeTransaction_h
-#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
+#include "EditTransactionBase.h" // for EditTransactionBase, etc
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsID.h" // for REFNSIID
#include "nscore.h" // for NS_IMETHOD
class nsEditor;
class nsINode;
namespace mozilla {
/**
* A transaction that joins two nodes E1 (left node) and E2 (right node) into a
* single node E. The children of E are the children of E1 followed by the
* children of E2. After DoTransaction() and RedoTransaction(), E1 is removed
* from the content tree and E2 remains.
*/
-class JoinNodeTransaction final : public EditTxn
+class JoinNodeTransaction final : public EditTransactionBase
{
public:
/**
* @param aEditor The provider of core editing operations.
* @param aLeftNode The first of two nodes to join.
* @param aRightNode The second of two nodes to join.
*/
JoinNodeTransaction(nsEditor& aEditor,
nsINode& aLeftNode, nsINode& aRightNode);
/**
* Call this after constructing to ensure the inputs are correct.
*/
nsresult CheckValidity();
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JoinNodeTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JoinNodeTransaction,
+ EditTransactionBase)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
protected:
nsEditor& mEditor;
// The nodes to operate upon. After the merge, mRightNode remains and
// mLeftNode is removed from the content tree.
nsCOMPtr<nsINode> mLeftNode;
nsCOMPtr<nsINode> mRightNode;
--- a/editor/libeditor/PlaceholderTransaction.cpp
+++ b/editor/libeditor/PlaceholderTransaction.cpp
@@ -120,76 +120,72 @@ PlaceholderTransaction::Merge(nsITransac
// check to see if aTransaction is one of the editor's
// private transactions. If not, we want to avoid merging
// the foreign transaction into our placeholder since we
// don't know what it does.
nsCOMPtr<nsPIEditorTransaction> pTxn = do_QueryInterface(aTransaction);
NS_ENSURE_TRUE(pTxn, NS_OK); // it's foreign so just bail!
- EditTxn *editTxn = (EditTxn*)aTransaction; //XXX: hack, not safe! need nsIEditTransaction!
+ // XXX: hack, not safe! need nsIEditTransaction!
+ EditTransactionBase* editTransactionBase = (EditTransactionBase*)aTransaction;
// determine if this incoming txn is a placeholder txn
- nsCOMPtr<nsIAbsorbingTransaction> plcTxn = do_QueryObject(editTxn);
+ nsCOMPtr<nsIAbsorbingTransaction> absorbingTransaction =
+ do_QueryObject(editTransactionBase);
- // we are absorbing all txn's if mAbsorb is lit.
- if (mAbsorb)
- {
+ // We are absorbing all transactions if mAbsorb is lit.
+ if (mAbsorb) {
RefPtr<CompositionTransaction> otherTransaction =
do_QueryObject(aTransaction);
if (otherTransaction) {
// special handling for CompositionTransaction's: they need to merge with
// any previous CompositionTransaction in this placeholder, if possible.
if (!mCompositionTransaction) {
// this is the first IME txn in the placeholder
mCompositionTransaction = otherTransaction;
- AppendChild(editTxn);
+ AppendChild(editTransactionBase);
} else {
bool didMerge;
mCompositionTransaction->Merge(otherTransaction, &didMerge);
if (!didMerge) {
// it wouldn't merge. Earlier IME txn is already committed and will
// not absorb further IME txns. So just stack this one after it
// and remember it as a candidate for further merges.
mCompositionTransaction = otherTransaction;
- AppendChild(editTxn);
+ AppendChild(editTransactionBase);
}
}
- } else if (!plcTxn) {
+ } else if (!absorbingTransaction) {
// See bug 171243: just drop incoming placeholders on the floor.
// Their children will be swallowed by this preexisting one.
- AppendChild(editTxn);
+ AppendChild(editTransactionBase);
}
*aDidMerge = true;
// RememberEndingSelection();
// efficiency hack: no need to remember selection here, as we haven't yet
// finished the initial batch and we know we will be told when the batch ends.
// we can remeber the selection then.
- }
- else
- { // merge typing or IME or deletion transactions if the selection matches
+ } else {
+ // merge typing or IME or deletion transactions if the selection matches
if (((mName.get() == nsGkAtoms::TypingTxnName) ||
(mName.get() == nsGkAtoms::IMETxnName) ||
(mName.get() == nsGkAtoms::DeleteTxnName))
- && !mCommitted )
- {
- nsCOMPtr<nsIAbsorbingTransaction> plcTxn = do_QueryObject(editTxn);
- if (plcTxn) {
+ && !mCommitted) {
+ if (absorbingTransaction) {
nsCOMPtr<nsIAtom> atom;
- plcTxn->GetTxnName(getter_AddRefs(atom));
- if (atom && (atom == mName))
- {
+ absorbingTransaction->GetTxnName(getter_AddRefs(atom));
+ if (atom && atom == mName) {
// check if start selection of next placeholder matches
// end selection of this placeholder
bool isSame;
- plcTxn->StartSelectionEquals(&mEndSel, &isSame);
- if (isSame)
- {
+ absorbingTransaction->StartSelectionEquals(&mEndSel, &isSame);
+ if (isSame) {
mAbsorb = true; // we need to start absorbing again
- plcTxn->ForwardEndBatchTo(this);
- // AppendChild(editTxn);
+ absorbingTransaction->ForwardEndBatchTo(this);
+ // AppendChild(editTransactionBase);
// see bug 171243: we don't need to merge placeholders
// into placeholders. We just reactivate merging in the pre-existing
// placeholder and drop the new one on the floor. The EndPlaceHolderBatch()
// call on the new placeholder will be forwarded to this older one.
RememberEndingSelection();
*aDidMerge = true;
}
}
--- a/editor/libeditor/PlaceholderTransaction.h
+++ b/editor/libeditor/PlaceholderTransaction.h
@@ -34,17 +34,17 @@ public:
NS_DECL_ISUPPORTS_INHERITED
PlaceholderTransaction();
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PlaceholderTransaction,
EditAggregateTransaction)
// ------------ EditAggregateTransaction -----------------------
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
// ------------ nsIAbsorbingTransaction -----------------------
NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
nsEditor* aEditor) override;
--- a/editor/libeditor/SetDocumentTitleTransaction.h
+++ b/editor/libeditor/SetDocumentTitleTransaction.h
@@ -1,46 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef SetDocumentTitleTransaction_h
#define SetDocumentTitleTransaction_h
-#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
+#include "EditTransactionBase.h" // for EditTransactionBase, etc
#include "nsString.h" // for nsString
#include "nscore.h" // for NS_IMETHOD, nsAString, etc
class nsIHTMLEditor;
namespace mozilla {
/**
* A transaction that changes the document's title,
* which is a text node under the <title> tag in a page's <head> section
* provides default concrete behavior for all nsITransaction methods.
*/
-class SetDocumentTitleTransaction final : public EditTxn
+class SetDocumentTitleTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aEditor The object providing core editing operations.
* @param aValue The new value for document title.
*/
NS_IMETHOD Init(nsIHTMLEditor* aEditor,
const nsAString* aValue);
SetDocumentTitleTransaction();
private:
nsresult SetDomTitle(const nsAString& aTitle);
public:
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
NS_IMETHOD GetIsTransient(bool *aIsTransient) override;
protected:
// The editor that created this transaction.
nsIHTMLEditor* mEditor;
--- a/editor/libeditor/SplitNodeTransaction.cpp
+++ b/editor/libeditor/SplitNodeTransaction.cpp
@@ -24,24 +24,24 @@ SplitNodeTransaction::SplitNodeTransacti
, mOffset(aOffset)
{
}
SplitNodeTransaction::~SplitNodeTransaction()
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(SplitNodeTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(SplitNodeTransaction, EditTransactionBase,
mParent,
mNewLeftNode)
-NS_IMPL_ADDREF_INHERITED(SplitNodeTransaction, EditTxn)
-NS_IMPL_RELEASE_INHERITED(SplitNodeTransaction, EditTxn)
+NS_IMPL_ADDREF_INHERITED(SplitNodeTransaction, EditTransactionBase)
+NS_IMPL_RELEASE_INHERITED(SplitNodeTransaction, EditTransactionBase)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SplitNodeTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
SplitNodeTransaction::DoTransaction()
{
// Create a new node
ErrorResult rv;
// Don't use .downcast directly because AsContent has an assertion we want
nsCOMPtr<nsINode> clone = mExistingRightNode->CloneNode(false, rv);
--- a/editor/libeditor/SplitNodeTransaction.h
+++ b/editor/libeditor/SplitNodeTransaction.h
@@ -1,48 +1,49 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef SplitNodeTransaction_h
#define SplitNodeTransaction_h
-#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
+#include "EditTransactionBase.h" // for EditTxn, etc
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
#include "nscore.h" // for NS_IMETHOD
class nsEditor;
class nsIContent;
class nsINode;
namespace mozilla {
/**
* A transaction that splits a node into two identical nodes, with the children
* divided between the new nodes.
*/
-class SplitNodeTransaction final : public EditTxn
+class SplitNodeTransaction final : public EditTransactionBase
{
public:
/**
* @param aEditor The provider of core editing operations
* @param aNode The node to split
* @param aOffset The location within aNode to do the split. aOffset may
* refer to children of aNode, or content of aNode. The left
* node will have child|content 0..aOffset-1.
*/
SplitNodeTransaction(nsEditor& aEditor, nsIContent& aNode, int32_t aOffset);
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SplitNodeTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SplitNodeTransaction,
+ EditTransactionBase)
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
NS_IMETHOD RedoTransaction() override;
nsIContent* GetNewNode();
protected:
virtual ~SplitNodeTransaction();
--- a/editor/libeditor/StyleSheetTransactions.cpp
+++ b/editor/libeditor/StyleSheetTransactions.cpp
@@ -50,21 +50,22 @@ RemoveStyleSheet(nsIEditor* aEditor, Sty
* AddStyleSheetTransaction
******************************************************************************/
AddStyleSheetTransaction::AddStyleSheetTransaction()
: mEditor(nullptr)
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(AddStyleSheetTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(AddStyleSheetTransaction,
+ EditTransactionBase,
mSheet)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AddStyleSheetTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
AddStyleSheetTransaction::Init(nsIEditor* aEditor,
StyleSheetHandle aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);
mEditor = aEditor;
@@ -103,21 +104,22 @@ AddStyleSheetTransaction::GetTxnDescript
* RemoveStyleSheetTransaction
******************************************************************************/
RemoveStyleSheetTransaction::RemoveStyleSheetTransaction()
: mEditor(nullptr)
{
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(RemoveStyleSheetTransaction, EditTxn,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(RemoveStyleSheetTransaction,
+ EditTransactionBase,
mSheet)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RemoveStyleSheetTransaction)
-NS_INTERFACE_MAP_END_INHERITING(EditTxn)
+NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
RemoveStyleSheetTransaction::Init(nsIEditor* aEditor,
StyleSheetHandle aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);
mEditor = aEditor;
--- a/editor/libeditor/StyleSheetTransactions.h
+++ b/editor/libeditor/StyleSheetTransactions.h
@@ -1,67 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef StylesheetTransactions_h
#define StylesheetTransactions_h
-#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
+#include "EditTransactionBase.h" // for EditTransactionBase, etc
#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle
#include "nsCycleCollectionParticipant.h"
#include "nsID.h" // for REFNSIID
#include "nscore.h" // for NS_IMETHOD
class nsIEditor;
namespace mozilla {
-class AddStyleSheetTransaction final : public EditTxn
+class AddStyleSheetTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aEditor The object providing core editing operations
* @param aSheet The stylesheet to add
*/
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet);
AddStyleSheetTransaction();
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddStyleSheetTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddStyleSheetTransaction,
+ EditTransactionBase)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
protected:
// The editor that created this transaction.
nsIEditor* mEditor;
// The style sheet to add.
mozilla::StyleSheetHandle::RefPtr mSheet;
};
-class RemoveStyleSheetTransaction final : public EditTxn
+class RemoveStyleSheetTransaction final : public EditTransactionBase
{
public:
/**
* Initialize the transaction.
* @param aEditor The object providing core editing operations.
* @param aSheet The stylesheet to remove.
*/
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet);
RemoveStyleSheetTransaction();
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoveStyleSheetTransaction, EditTxn)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoveStyleSheetTransaction,
+ EditTransactionBase)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
- NS_DECL_EDITTXN
+ NS_DECL_EDITTRANSACTIONBASE
protected:
// The editor that created this transaction.
nsIEditor* mEditor;
// The style sheet to remove.
StyleSheetHandle::RefPtr mSheet;
};
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -18,17 +18,17 @@ UNIFIED_SOURCES += [
'ChangeStyleTransaction.cpp',
'CompositionTransaction.cpp',
'CreateElementTransaction.cpp',
'DeleteNodeTransaction.cpp',
'DeleteRangeTransaction.cpp',
'DeleteTextTransaction.cpp',
'EditAggregateTransaction.cpp',
'EditorUtils.cpp',
- 'EditTxn.cpp',
+ 'EditTransactionBase.cpp',
'HTMLEditUtils.cpp',
'InsertNodeTransaction.cpp',
'InsertTextTransaction.cpp',
'JoinNodeTransaction.cpp',
'nsEditor.cpp',
'nsEditorCommands.cpp',
'nsEditorController.cpp',
'nsEditorEventListener.cpp',
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -13,17 +13,17 @@
#include "ChangeAttributeTransaction.h" // for ChangeAttributeTransaction
#include "CompositionTransaction.h" // for CompositionTransaction
#include "CreateElementTransaction.h" // for CreateElementTransaction
#include "DeleteNodeTransaction.h" // for DeleteNodeTransaction
#include "DeleteRangeTransaction.h" // for DeleteRangeTransaction
#include "DeleteTextTransaction.h" // for DeleteTextTransaction
#include "EditAggregateTransaction.h" // for EditAggregateTransaction
#include "EditorUtils.h" // for AutoRules, etc
-#include "EditTxn.h" // for EditTxn
+#include "EditTransactionBase.h" // for EditTransactionBase
#include "InsertNodeTransaction.h" // for InsertNodeTransaction
#include "InsertTextTransaction.h" // for InsertTextTransaction
#include "JoinNodeTransaction.h" // for JoinNodeTransaction
#include "PlaceholderTransaction.h" // for PlaceholderTransaction
#include "SplitNodeTransaction.h" // for SplitNodeTransaction
#include "StyleSheetTransactions.h" // for AddStyleSheetTransaction, etc
#include "TextEditUtils.h" // for TextEditUtils
#include "mozFlushType.h" // for mozFlushType::Flush_Frames
@@ -2403,17 +2403,17 @@ nsEditor::InsertTextImpl(const nsAString
}
nsresult
nsEditor::InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert,
Text& aTextNode,
int32_t aOffset, bool aSuppressIME)
{
- RefPtr<EditTxn> txn;
+ RefPtr<EditTransactionBase> transaction;
bool isIMETransaction = false;
int32_t replacedOffset = 0;
int32_t replacedLength = 0;
// aSuppressIME is used when editor must insert text, yet this text is not
// part of the current IME operation. Example: adjusting whitespace around an
// IME insertion.
if (ShouldHandleIMEComposition() && !aSuppressIME) {
if (!mIMETextNode) {
@@ -2431,53 +2431,53 @@ nsEditor::InsertTextIntoTextNodeImpl(con
if (!mPhonetic) {
mPhonetic = new nsString();
}
nsAutoString stringToInsert(aStringToInsert);
stringToInsert.Mid(*mPhonetic,
textRange.mStartOffset, textRange.Length());
}
- txn = CreateTxnForComposition(aStringToInsert);
+ transaction = CreateTxnForComposition(aStringToInsert);
isIMETransaction = true;
// All characters of the composition string will be replaced with
// aStringToInsert. So, we need to emulate to remove the composition
// string.
replacedOffset = mIMETextOffset;
replacedLength = mIMETextLength;
mIMETextLength = aStringToInsert.Length();
} else {
- txn = CreateTxnForInsertText(aStringToInsert, aTextNode, aOffset);
+ transaction = CreateTxnForInsertText(aStringToInsert, aTextNode, aOffset);
}
// Let listeners know what's up
for (auto& listener : mActionListeners) {
listener->WillInsertText(
static_cast<nsIDOMCharacterData*>(aTextNode.AsDOMNode()), aOffset,
aStringToInsert);
}
// XXX We may not need these view batches anymore. This is handled at a
// higher level now I believe.
BeginUpdateViewBatch();
- nsresult res = DoTransaction(txn);
+ nsresult rv = DoTransaction(transaction);
EndUpdateViewBatch();
if (replacedLength) {
mRangeUpdater.SelAdjDeleteText(
static_cast<nsIDOMCharacterData*>(aTextNode.AsDOMNode()),
replacedOffset, replacedLength);
}
mRangeUpdater.SelAdjInsertText(aTextNode, aOffset, aStringToInsert);
// let listeners know what happened
for (auto& listener : mActionListeners) {
listener->DidInsertText(
static_cast<nsIDOMCharacterData*>(aTextNode.AsDOMNode()),
- aOffset, aStringToInsert, res);
+ aOffset, aStringToInsert, rv);
}
// Added some cruft here for bug 43366. Layout was crashing because we left
// an empty text node lying around in the document. So I delete empty text
// nodes caused by IME. I have to mark the IME transaction as "fixed", which
// means that furure IME txns won't merge with it. This is because we don't
// want future IME txns trying to put their text into a node that is no
// longer in the document. This does not break undo/redo, because all these
@@ -2485,21 +2485,21 @@ nsEditor::InsertTextIntoTextNodeImpl(con
// already savvy to having multiple ime txns inside them.
// Delete empty IME text node if there is one
if (isIMETransaction && mIMETextNode) {
uint32_t len = mIMETextNode->Length();
if (!len) {
DeleteNode(mIMETextNode);
mIMETextNode = nullptr;
- static_cast<CompositionTransaction*>(txn.get())->MarkFixed();
+ static_cast<CompositionTransaction*>(transaction.get())->MarkFixed();
}
}
- return res;
+ return rv;
}
nsresult
nsEditor::SelectEntireDocument(Selection* aSelection)
{
if (!aSelection) { return NS_ERROR_NULL_POINTER; }
--- a/editor/libeditor/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/nsHTMLCSSUtils.cpp
@@ -1,17 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHTMLCSSUtils.h"
#include "ChangeStyleTransaction.h"
-#include "EditTxn.h"
#include "mozilla/Assertions.h"
#include "mozilla/Preferences.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
#include "nsCOMPtr.h"