Bug 1463985 - part 4: Rename EditSubAction::insertNode and EditSubAction::createNode to EditSubAction::eInsertNode and EditSubAction::eCreateNode r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 21:16:44 +0900
changeset 477308 fba1566eb6a061dfa0c486e62c14ebd5b78400be
parent 477307 14054ff180108dd6338a4ac67a3f122685cc5631
child 477309 1e428fda3c71f4d0201411fc6b13f466f275284c
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1463985
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1463985 - part 4: Rename EditSubAction::insertNode and EditSubAction::createNode to EditSubAction::eInsertNode and EditSubAction::eCreateNode r=m_kato Although, there might be no reason to have those edit sub-actions separately. MozReview-Commit-ID: BaaNCqfk4V4
editor/libeditor/EditAction.h
editor/libeditor/EditorBase.cpp
editor/libeditor/HTMLTableEditor.cpp
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -19,18 +19,22 @@ enum class EditSubAction : int32_t
   // eNone indicates not edit sub-action is being handled.  This is useful
   // of initial value of member variables.
   eNone = 0,
 
   // eUndo and eRedo indicate entire actions of undo/redo operation.
   eUndo,
   eRedo,
 
-  insertNode,
-  createNode,
+  // 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,
   splitNode,
   joinNode,
 
   deleteText = 1003,
 
   // Text edit commands
   insertText = 2000,
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -1352,17 +1352,17 @@ EditorBase::CreateNodeWithTransaction(
   MOZ_ASSERT(aPointToInsert.IsSetAndValid());
 
   // XXX We need offset at new node for mRangeUpdater.  Therefore, we need
   //     to compute the offset now but this is expensive.  So, if it's possible,
   //     we need to redesign mRangeUpdater as avoiding using indices.
   Unused << aPointToInsert.Offset();
 
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::createNode,
+                                      *this, EditSubAction::eCreateNode,
                                       nsIEditor::eNext);
 
   RefPtr<Element> newElement;
 
   RefPtr<CreateElementTransaction> transaction =
     CreateElementTransaction::Create(*this, aTagName, aPointToInsert);
   nsresult rv = DoTransaction(transaction);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -1430,17 +1430,17 @@ EditorBase::InsertNodeWithTransaction(
               const EditorDOMPointBase<PT, CT>& aPointToInsert)
 {
   if (NS_WARN_IF(!aPointToInsert.IsSet())) {
     return NS_ERROR_INVALID_ARG;
   }
   MOZ_ASSERT(aPointToInsert.IsSetAndValid());
 
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertNode,
+                                      *this, EditSubAction::eInsertNode,
                                       nsIEditor::eNext);
 
   RefPtr<InsertNodeTransaction> transaction =
     InsertNodeTransaction::Create(*this, aContentToInsert, aPointToInsert);
   nsresult rv = DoTransaction(transaction);
 
   mRangeUpdater.SelAdjInsertNode(aPointToInsert);
 
@@ -1630,17 +1630,17 @@ EditorBase::DeleteNode(nsINode* aNode)
   }
   return DeleteNodeWithTransaction(*aNode);
 }
 
 nsresult
 EditorBase::DeleteNodeWithTransaction(nsINode& aNode)
 {
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::createNode,
+                                      *this, EditSubAction::eCreateNode,
                                       nsIEditor::ePrevious);
 
   if (mRules && mRules->AsHTMLEditRules()) {
     Selection* selection = GetSelection();
     if (selection) {
       RefPtr<HTMLEditRules> htmlEditRules = mRules->AsHTMLEditRules();
       htmlEditRules->WillDeleteNode(*selection, aNode);
     } else {
--- a/editor/libeditor/HTMLTableEditor.cpp
+++ b/editor/libeditor/HTMLTableEditor.cpp
@@ -371,17 +371,17 @@ HTMLEditor::InsertTableColumn(int32_t aN
                      &rowSpan, &colSpan,
                      &actualRowSpan, &actualColSpan, &isSelected);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(curCell, NS_ERROR_FAILURE);
 
   AutoPlaceholderBatch beginBatching(this);
   // Prevent auto insertion of BR in new cell until we're done
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertNode,
+                                      *this, EditSubAction::eInsertNode,
                                       nsIEditor::eNext);
 
   // Use column after current cell if requested
   if (aAfter) {
     startColIndex += actualColSpan;
     //Detect when user is adding after a COLSPAN=0 case
     // Assume they want to stop the "0" behavior and
     // really add a new column. Thus we set the
@@ -506,17 +506,17 @@ HTMLEditor::InsertTableRow(int32_t aNumb
 
   int32_t rowCount, colCount;
   rv = GetTableSize(table, &rowCount, &colCount);
   NS_ENSURE_SUCCESS(rv, rv);
 
   AutoPlaceholderBatch beginBatching(this);
   // Prevent auto insertion of BR in new cell until we're done
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertNode,
+                                      *this, EditSubAction::eInsertNode,
                                       nsIEditor::eNext);
 
   if (aAfter) {
     // Use row after current cell
     startRowIndex += actualRowSpan;
 
     //Detect when user is adding after a ROWSPAN=0 case
     // Assume they want to stop the "0" behavior and
@@ -1674,17 +1674,17 @@ HTMLEditor::SplitTableCell()
   // Must have some span to split
   if (actualRowSpan <= 1 && actualColSpan <= 1) {
     return NS_OK;
   }
 
   AutoPlaceholderBatch beginBatching(this);
   // Prevent auto insertion of BR in new cell until we're done
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertNode,
+                                      *this, EditSubAction::eInsertNode,
                                       nsIEditor::eNext);
 
   // We reset selection
   AutoSelectionSetterAfterTableEdit setCaret(*this, table, startRowIndex,
                                              startColIndex, ePreviousColumn,
                                              false);
   //...so suppress Rules System selection munging
   AutoTransactionsConserveSelection dontChangeSelection(this);
@@ -1909,17 +1909,17 @@ HTMLEditor::SwitchTableCellHeaderType(El
   if (NS_WARN_IF(!aSourceCell)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   AutoPlaceholderBatch beginBatching(this);
   // Prevent auto insertion of BR in new cell created by
   // ReplaceContainerAndCloneAttributesWithTransaction().
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertNode,
+                                      *this, EditSubAction::eInsertNode,
                                       nsIEditor::eNext);
 
   // Save current selection to restore when done.
   // This is needed so ReplaceContainerAndCloneAttributesWithTransaction()
   // can monitor selection when replacing nodes.
   RefPtr<Selection> selection = GetSelection();
   if (NS_WARN_IF(!selection)) {
     return NS_ERROR_FAILURE;
@@ -2479,17 +2479,17 @@ HTMLEditor::NormalizeTable(Element* aTab
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Save current selection
   AutoSelectionRestorer selectionRestorer(selection, this);
 
   AutoPlaceholderBatch beginBatching(this);
   // Prevent auto insertion of BR in new cell until we're done
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertNode,
+                                      *this, EditSubAction::eInsertNode,
                                       nsIEditor::eNext);
 
   RefPtr<Element> cell;
   int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
   bool    isSelected;
 
   // Scan all cells in each row to detect bad rowspan values
   for (rowIndex = 0; rowIndex < rowCount; rowIndex++) {