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
This commit is contained in:
Masayuki Nakano 2016-07-07 16:59:55 +09:00
Родитель 12a3eb5576
Коммит 15b7d9237f
5 изменённых файлов: 53 добавлений и 53 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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<nsIContent> 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<nsIContent> mNewLeftNode;
/** The parent shared by mExistingRightNode and mNewLeftNode */
// The parent shared by mExistingRightNode and mNewLeftNode.
nsCOMPtr<nsINode> mParent;
};
} // namespace dom
} // namespace mozilla
#endif
#endif // #ifndef SplitNodeTransaction_h

Просмотреть файл

@ -54,7 +54,7 @@ UNIFIED_SOURCES += [
'nsWSRunObject.cpp',
'PlaceholderTransaction.cpp',
'SetDocumentTitleTransaction.cpp',
'SplitNodeTxn.cpp',
'SplitNodeTransaction.cpp',
'TextEditorTest.cpp',
'TextEditUtils.cpp',
'TypeInState.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<SplitNodeTxn> txn = CreateTxnForSplitNode(aNode, aOffset);
aResult = DoTransaction(txn);
RefPtr<SplitNodeTransaction> transaction =
CreateTxnForSplitNode(aNode, aOffset);
aResult = DoTransaction(transaction);
nsCOMPtr<nsIContent> 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<SplitNodeTxn>
already_AddRefed<SplitNodeTransaction>
nsEditor::CreateTxnForSplitNode(nsIContent& aNode, uint32_t aOffset)
{
RefPtr<SplitNodeTxn> txn = new SplitNodeTxn(*this, aNode, aOffset);
return txn.forget();
RefPtr<SplitNodeTransaction> transaction =
new SplitNodeTransaction(*this, aNode, aOffset);
return transaction.forget();
}
already_AddRefed<JoinNodeTransaction>

Просмотреть файл

@ -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<mozilla::dom::SplitNodeTxn>
already_AddRefed<mozilla::SplitNodeTransaction>
CreateTxnForSplitNode(nsIContent& aNode, uint32_t aOffset);
already_AddRefed<mozilla::JoinNodeTransaction>