--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -25,17 +25,19 @@ enum class EditSubAction : int32_t
eRedo,
// eInsertNode indicates to insert a new node into the DOM tree.
eInsertNode,
// eCreateNode indicates to create a new node and insert it into the DOM tree.
eCreateNode,
- deleteNode,
+ // eDeleteNode indicates to remove a node from the DOM tree.
+ eDeleteNode,
+
splitNode,
joinNode,
deleteText = 1003,
// Text edit commands
insertText = 2000,
insertIMEText,
--- a/editor/libeditor/HTMLTableEditor.cpp
+++ b/editor/libeditor/HTMLTableEditor.cpp
@@ -719,17 +719,17 @@ HTMLEditor::DeleteTableCell(int32_t aNum
NS_ENSURE_SUCCESS(rv, rv);
// Don't fail if we didn't find a table or cell
NS_ENSURE_TRUE(table && cell, NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND);
AutoPlaceholderBatch beginBatching(this);
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
RefPtr<Element> firstCell;
rv = GetFirstSelectedCell(nullptr, getter_AddRefs(firstCell));
NS_ENSURE_SUCCESS(rv, rv);
if (firstCell && selection->RangeCount() > 1) {
// When > 1 selected cell,
@@ -905,17 +905,17 @@ HTMLEditor::DeleteTableCellContents()
NS_ENSURE_SUCCESS(rv, rv);
// Don't fail if no cell found
NS_ENSURE_TRUE(cell, NS_SUCCESS_EDITOR_ELEMENT_NOT_FOUND);
AutoPlaceholderBatch beginBatching(this);
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
//Don't let Rules System change the selection
AutoTransactionsConserveSelection dontChangeSelection(this);
RefPtr<Element> firstCell;
rv = GetFirstSelectedCell(nullptr, getter_AddRefs(firstCell));
NS_ENSURE_SUCCESS(rv, rv);
@@ -944,17 +944,17 @@ HTMLEditor::DeleteTableCellContents()
return NS_OK;
}
nsresult
HTMLEditor::DeleteCellContents(Element* aCell)
{
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
while (nsCOMPtr<nsINode> child = aCell->GetLastChild()) {
nsresult rv = DeleteNodeWithTransaction(*child);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
@@ -986,17 +986,17 @@ HTMLEditor::DeleteTableColumn(int32_t aN
}
// Check for counts too high
aNumber = std::min(aNumber,(colCount-startColIndex));
AutoPlaceholderBatch beginBatching(this);
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
// Test if deletion is controlled by selected cells
RefPtr<Element> firstCell;
rv = GetFirstSelectedCell(nullptr, getter_AddRefs(firstCell));
NS_ENSURE_SUCCESS(rv, rv);
uint32_t rangeCount = selection->RangeCount();
@@ -1151,17 +1151,17 @@ HTMLEditor::DeleteTableRow(int32_t aNumb
// Shortcut the case of deleting all rows in table
if (!startRowIndex && aNumber >= rowCount) {
return DeleteTable2(table, selection);
}
AutoPlaceholderBatch beginBatching(this);
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
RefPtr<Element> firstCell;
rv = GetFirstSelectedCell(nullptr, getter_AddRefs(firstCell));
NS_ENSURE_SUCCESS(rv, rv);
uint32_t rangeCount = selection->RangeCount();
@@ -1232,17 +1232,17 @@ HTMLEditor::DeleteRow(Element* aTable,
RefPtr<Element> cell;
RefPtr<Element> cellInDeleteRow;
int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
bool isSelected;
int32_t colIndex = 0;
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(*
- this, EditSubAction::deleteNode,
+ this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
// The list of cells we will change rowspan in
// and the new rowspan values for each
nsTArray<RefPtr<Element> > spanCellList;
nsTArray<int32_t> newSpanList;
int32_t rowCount, colCount;
@@ -2152,17 +2152,17 @@ HTMLEditor::JoinTableCells(bool aMergeNo
}
}
}
}
// All cell contents are merged. Delete the empty cells we accumulated
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
for (uint32_t i = 0, n = deleteList.Length(); i < n; i++) {
RefPtr<Element> nodeToBeRemoved = deleteList[i];
if (nodeToBeRemoved) {
rv = DeleteNodeWithTransaction(*nodeToBeRemoved);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -2268,17 +2268,17 @@ nsresult
HTMLEditor::MergeCells(RefPtr<Element> aTargetCell,
RefPtr<Element> aCellToMerge,
bool aDeleteCellToMerge)
{
NS_ENSURE_TRUE(aTargetCell && aCellToMerge, NS_ERROR_NULL_POINTER);
// Prevent rules testing until we're done
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
- *this, EditSubAction::deleteNode,
+ *this, EditSubAction::eDeleteNode,
nsIEditor::eNext);
// Don't need to merge if cell is empty
if (!IsEmptyCell(aCellToMerge)) {
// Get index of last child in target cell
// If we fail or don't have children,
// we insert at index 0
int32_t insertIndex = 0;