mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1345690 part.4 Rename JoinNodeTransaction::CheckValidity() to JoinNodeTransaction::CanDoIt() for consistency with other transaction classes r=m_kato
MozReview-Commit-ID: 3a5QXiofEL2 --HG-- extra : rebase_source : 40425f274eb69deea3e65cf1cdd35d2630fe4011
This commit is contained in:
parent
566c4af32a
commit
63c152d62f
@ -2742,12 +2742,14 @@ already_AddRefed<JoinNodeTransaction>
|
||||
EditorBase::CreateTxnForJoinNode(nsINode& aLeftNode,
|
||||
nsINode& aRightNode)
|
||||
{
|
||||
RefPtr<JoinNodeTransaction> transaction =
|
||||
RefPtr<JoinNodeTransaction> joinNodeTransaction =
|
||||
new JoinNodeTransaction(*this, aLeftNode, aRightNode);
|
||||
|
||||
NS_ENSURE_SUCCESS(transaction->CheckValidity(), nullptr);
|
||||
|
||||
return transaction.forget();
|
||||
// If it's not editable, the transaction shouldn't be recorded since it
|
||||
// should never be undone/redone.
|
||||
if (NS_WARN_IF(!joinNodeTransaction->CanDoIt())) {
|
||||
return nullptr;
|
||||
}
|
||||
return joinNodeTransaction.forget();
|
||||
}
|
||||
|
||||
struct SavedRange final
|
||||
|
@ -36,13 +36,15 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(JoinNodeTransaction, EditTransactionBase,
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JoinNodeTransaction)
|
||||
NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
|
||||
|
||||
nsresult
|
||||
JoinNodeTransaction::CheckValidity()
|
||||
bool
|
||||
JoinNodeTransaction::CanDoIt() const
|
||||
{
|
||||
if (!mEditorBase.IsModifiableNode(mLeftNode->GetParentNode())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_WARN_IF(!mLeftNode) ||
|
||||
NS_WARN_IF(!mRightNode) ||
|
||||
!mLeftNode->GetParentNode()) {
|
||||
return false;
|
||||
}
|
||||
return NS_OK;
|
||||
return mEditorBase.IsModifiableNode(mLeftNode->GetParentNode());
|
||||
}
|
||||
|
||||
// After DoTransaction() and RedoTransaction(), the left node is removed from
|
||||
|
@ -36,9 +36,10 @@ public:
|
||||
nsINode& aLeftNode, nsINode& aRightNode);
|
||||
|
||||
/**
|
||||
* Call this after constructing to ensure the inputs are correct.
|
||||
* CanDoIt() returns true if there are enough members and can join or
|
||||
* restore the nodes. Otherwise, false.
|
||||
*/
|
||||
nsresult CheckValidity();
|
||||
bool CanDoIt() const;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JoinNodeTransaction,
|
||||
EditTransactionBase)
|
||||
|
Loading…
Reference in New Issue
Block a user