From 15b7d9237fe1812b73a4aa94375d36cb21f31d5c Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 7 Jul 2016 16:59:55 +0900 Subject: [PATCH] Bug 1260651 part.29 Rename mozilla::dom::SplitNodeTxn to mozilla::SplitNodeTransaction (and their files too) r=mccr8 MozReview-Commit-ID: 5guZsO9XGLY --HG-- rename : editor/libeditor/SplitNodeTxn.cpp => editor/libeditor/SplitNodeTransaction.cpp rename : editor/libeditor/SplitNodeTxn.h => editor/libeditor/SplitNodeTransaction.h --- ...itNodeTxn.cpp => SplitNodeTransaction.cpp} | 42 +++++++++---------- ...{SplitNodeTxn.h => SplitNodeTransaction.h} | 42 +++++++++---------- editor/libeditor/moz.build | 2 +- editor/libeditor/nsEditor.cpp | 16 +++---- editor/libeditor/nsEditor.h | 4 +- 5 files changed, 53 insertions(+), 53 deletions(-) rename editor/libeditor/{SplitNodeTxn.cpp => SplitNodeTransaction.cpp} (78%) rename editor/libeditor/{SplitNodeTxn.h => SplitNodeTransaction.h} (52%) diff --git a/editor/libeditor/SplitNodeTxn.cpp b/editor/libeditor/SplitNodeTransaction.cpp similarity index 78% rename from editor/libeditor/SplitNodeTxn.cpp rename to editor/libeditor/SplitNodeTransaction.cpp index b44b6439706a..0ad5bfe7ef68 100644 --- a/editor/libeditor/SplitNodeTxn.cpp +++ b/editor/libeditor/SplitNodeTransaction.cpp @@ -3,7 +3,7 @@ * 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 "SplitNodeTxn.h" +#include "SplitNodeTransaction.h" #include "mozilla/dom/Selection.h" #include "nsAString.h" @@ -12,36 +12,34 @@ #include "nsError.h" // for NS_ERROR_NOT_INITIALIZED, etc #include "nsIContent.h" // for nsIContent -using namespace mozilla; -using namespace mozilla::dom; +namespace mozilla { -// note that aEditor is not refcounted -SplitNodeTxn::SplitNodeTxn(nsEditor& aEditor, nsIContent& aNode, - int32_t aOffset) - : EditTxn() - , mEditor(aEditor) +using namespace dom; + +SplitNodeTransaction::SplitNodeTransaction(nsEditor& aEditor, + nsIContent& aNode, + int32_t aOffset) + : mEditor(aEditor) , mExistingRightNode(&aNode) , mOffset(aOffset) - , mNewLeftNode(nullptr) - , mParent(nullptr) { } -SplitNodeTxn::~SplitNodeTxn() +SplitNodeTransaction::~SplitNodeTransaction() { } -NS_IMPL_CYCLE_COLLECTION_INHERITED(SplitNodeTxn, EditTxn, +NS_IMPL_CYCLE_COLLECTION_INHERITED(SplitNodeTransaction, EditTxn, mParent, mNewLeftNode) -NS_IMPL_ADDREF_INHERITED(SplitNodeTxn, EditTxn) -NS_IMPL_RELEASE_INHERITED(SplitNodeTxn, EditTxn) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SplitNodeTxn) +NS_IMPL_ADDREF_INHERITED(SplitNodeTransaction, EditTxn) +NS_IMPL_RELEASE_INHERITED(SplitNodeTransaction, EditTxn) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SplitNodeTransaction) NS_INTERFACE_MAP_END_INHERITING(EditTxn) NS_IMETHODIMP -SplitNodeTxn::DoTransaction() +SplitNodeTransaction::DoTransaction() { // Create a new node ErrorResult rv; @@ -67,7 +65,7 @@ SplitNodeTxn::DoTransaction() } NS_IMETHODIMP -SplitNodeTxn::UndoTransaction() +SplitNodeTransaction::UndoTransaction() { MOZ_ASSERT(mNewLeftNode && mParent); @@ -80,7 +78,7 @@ SplitNodeTxn::UndoTransaction() * state. */ NS_IMETHODIMP -SplitNodeTxn::RedoTransaction() +SplitNodeTransaction::RedoTransaction() { MOZ_ASSERT(mNewLeftNode && mParent); @@ -114,14 +112,16 @@ SplitNodeTxn::RedoTransaction() NS_IMETHODIMP -SplitNodeTxn::GetTxnDescription(nsAString& aString) +SplitNodeTransaction::GetTxnDescription(nsAString& aString) { - aString.AssignLiteral("SplitNodeTxn"); + aString.AssignLiteral("SplitNodeTransaction"); return NS_OK; } nsIContent* -SplitNodeTxn::GetNewNode() +SplitNodeTransaction::GetNewNode() { return mNewLeftNode; } + +} // namespace mozilla diff --git a/editor/libeditor/SplitNodeTxn.h b/editor/libeditor/SplitNodeTransaction.h similarity index 52% rename from editor/libeditor/SplitNodeTxn.h rename to editor/libeditor/SplitNodeTransaction.h index c2e83026bc9e..6812252f5412 100644 --- a/editor/libeditor/SplitNodeTxn.h +++ b/editor/libeditor/SplitNodeTransaction.h @@ -3,8 +3,8 @@ * 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 SplitNodeTxn_h__ -#define SplitNodeTxn_h__ +#ifndef SplitNodeTransaction_h +#define SplitNodeTransaction_h #include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN #include "nsCOMPtr.h" // for nsCOMPtr @@ -17,25 +17,25 @@ class nsIContent; class nsINode; namespace mozilla { -namespace dom { /** * A transaction that splits a node into two identical nodes, with the children * divided between the new nodes. */ -class SplitNodeTxn : public EditTxn +class SplitNodeTransaction final : public EditTxn { 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. - */ - SplitNodeTxn(nsEditor& aEditor, nsIContent& aNode, int32_t aOffset); + /** + * @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(SplitNodeTxn, EditTxn) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SplitNodeTransaction, EditTxn) NS_DECL_EDITTXN @@ -44,27 +44,25 @@ public: nsIContent* GetNewNode(); protected: - virtual ~SplitNodeTxn(); + virtual ~SplitNodeTransaction(); nsEditor& mEditor; - /** The node to operate upon */ + // The node to operate upon. nsCOMPtr mExistingRightNode; - /** The offset into mExistingRightNode where its children are split. mOffset - * is the index of the first child in the right node. -1 means the new node - * gets no children. - */ + // The offset into mExistingRightNode where its children are split. mOffset + // is the index of the first child in the right node. -1 means the new node + // gets no children. int32_t mOffset; - /** The node we create when splitting mExistingRightNode */ + // The node we create when splitting mExistingRightNode. nsCOMPtr mNewLeftNode; - /** The parent shared by mExistingRightNode and mNewLeftNode */ + // The parent shared by mExistingRightNode and mNewLeftNode. nsCOMPtr mParent; }; -} // namespace dom } // namespace mozilla -#endif +#endif // #ifndef SplitNodeTransaction_h diff --git a/editor/libeditor/moz.build b/editor/libeditor/moz.build index 06315e51c089..fc326f55e51e 100644 --- a/editor/libeditor/moz.build +++ b/editor/libeditor/moz.build @@ -54,7 +54,7 @@ UNIFIED_SOURCES += [ 'nsWSRunObject.cpp', 'PlaceholderTransaction.cpp', 'SetDocumentTitleTransaction.cpp', - 'SplitNodeTxn.cpp', + 'SplitNodeTransaction.cpp', 'TextEditorTest.cpp', 'TextEditUtils.cpp', 'TypeInState.cpp', diff --git a/editor/libeditor/nsEditor.cpp b/editor/libeditor/nsEditor.cpp index 7b81d139dc3a..73123d45b11b 100644 --- a/editor/libeditor/nsEditor.cpp +++ b/editor/libeditor/nsEditor.cpp @@ -23,7 +23,7 @@ #include "InsertTextTransaction.h" // for InsertTextTransaction #include "JoinNodeTransaction.h" // for JoinNodeTransaction #include "PlaceholderTransaction.h" // for PlaceholderTransaction -#include "SplitNodeTxn.h" // for SplitNodeTxn +#include "SplitNodeTransaction.h" // for SplitNodeTransaction #include "TextEditUtils.h" // for TextEditUtils #include "mozFlushType.h" // for mozFlushType::Flush_Frames #include "mozInlineSpellChecker.h" // for mozInlineSpellChecker @@ -1432,11 +1432,12 @@ nsEditor::SplitNode(nsIContent& aNode, int32_t aOffset, ErrorResult& aResult) listener->WillSplitNode(aNode.AsDOMNode(), aOffset); } - RefPtr txn = CreateTxnForSplitNode(aNode, aOffset); - aResult = DoTransaction(txn); + RefPtr transaction = + CreateTxnForSplitNode(aNode, aOffset); + aResult = DoTransaction(transaction); nsCOMPtr newNode = aResult.Failed() ? nullptr - : txn->GetNewNode(); + : transaction->GetNewNode(); mRangeUpdater.SelAdjSplitNode(aNode, aOffset, newNode); @@ -2632,11 +2633,12 @@ nsEditor::CreateTxnForDeleteText(nsGenericDOMDataNode& aCharData, return transaction.forget(); } -already_AddRefed +already_AddRefed nsEditor::CreateTxnForSplitNode(nsIContent& aNode, uint32_t aOffset) { - RefPtr txn = new SplitNodeTxn(*this, aNode, aOffset); - return txn.forget(); + RefPtr transaction = + new SplitNodeTransaction(*this, aNode, aOffset); + return transaction.forget(); } already_AddRefed diff --git a/editor/libeditor/nsEditor.h b/editor/libeditor/nsEditor.h index da7ceff0906f..a53559965bdd 100644 --- a/editor/libeditor/nsEditor.h +++ b/editor/libeditor/nsEditor.h @@ -65,6 +65,7 @@ class ErrorResult; class InsertNodeTransaction; class InsertTextTransaction; class JoinNodeTransaction; +class SplitNodeTransaction; class TextComposition; struct EditorDOMPoint; @@ -73,7 +74,6 @@ class DataTransfer; class Element; class EventTarget; class Selection; -class SplitNodeTxn; class Text; } // namespace dom } // namespace mozilla @@ -335,7 +335,7 @@ protected: CreateTxnForDeleteCharacter(nsGenericDOMDataNode& aData, uint32_t aOffset, EDirection aDirection); - already_AddRefed + already_AddRefed CreateTxnForSplitNode(nsIContent& aNode, uint32_t aOffset); already_AddRefed