Bug 1463985 - part 15: Rename EditSubAction::makeList to EditSubAction::eCreateOrChangeList r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 22:36:19 +0900
changeset 801985 337f10811060b586fc64afa45cf3da92e5d084c6
parent 801984 aaeea4c1d7bd25fdf2cbbed7c9b29db34c397269
child 801986 17f4bdcf8825a5dbf26078939749847ee6620feb
push id111796
push usermasayuki@d-toybox.com
push dateThu, 31 May 2018 06:40:56 +0000
reviewersm_kato
bugs1463985
milestone62.0a1
Bug 1463985 - part 15: Rename EditSubAction::makeList to EditSubAction::eCreateOrChangeList r?m_kato MozReview-Commit-ID: 4Mkh3Mfm6fY
editor/libeditor/EditAction.h
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/TextEditRules.h
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -64,17 +64,20 @@ enum class EditSubAction : int32_t
 
   // eSetText indicates to set editor value to new value.
   eSetText,
 
   // eInsertParagraphSeparator indicates to insert paragraph separator, <br> or
   // \n at least to break current line.
   eInsertParagraphSeparator,
 
-  makeList,
+  // eCreateOrChangeList indicates to create new list or change existing list
+  // type.
+  eCreateOrChangeList,
+
   indent,
   outdent,
   align,
   makeBasicBlock,
   removeList,
   makeDefListItem,
   insertElement,
   insertQuotation,
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -81,17 +81,17 @@ enum
  *  first some helpful functors we will use
  ********************************************************/
 
 static bool
 IsStyleCachePreservingSubAction(EditSubAction aEditSubAction)
 {
   return aEditSubAction == EditSubAction::eDeleteSelectedContent ||
          aEditSubAction == EditSubAction::eInsertParagraphSeparator ||
-         aEditSubAction == EditSubAction::makeList ||
+         aEditSubAction == EditSubAction::eCreateOrChangeList ||
          aEditSubAction == EditSubAction::indent ||
          aEditSubAction == EditSubAction::outdent ||
          aEditSubAction == EditSubAction::align ||
          aEditSubAction == EditSubAction::makeBasicBlock ||
          aEditSubAction == EditSubAction::removeList ||
          aEditSubAction == EditSubAction::makeDefListItem ||
          aEditSubAction == EditSubAction::insertElement ||
          aEditSubAction == EditSubAction::insertQuotation;
@@ -690,17 +690,17 @@ HTMLEditRules::WillDoAction(Selection* a
     case EditSubAction::loadHTML:
       return WillLoadHTML();
     case EditSubAction::eInsertParagraphSeparator:
       UndefineCaretBidiLevel();
       return WillInsertBreak(aCancel, aHandled);
     case EditSubAction::eDeleteSelectedContent:
       return WillDeleteSelection(aInfo.collapsedAction, aInfo.stripWrappers,
                                  aCancel, aHandled);
-    case EditSubAction::makeList:
+    case EditSubAction::eCreateOrChangeList:
       return WillMakeList(aInfo.blockType, aInfo.entireList,
                           aInfo.bulletType, aCancel, aHandled);
     case EditSubAction::indent:
       return WillIndent(aCancel, aHandled);
     case EditSubAction::outdent:
       return WillOutdent(aCancel, aHandled);
     case EditSubAction::setAbsolutePosition:
       return WillAbsolutePosition(aCancel, aHandled);
@@ -3797,18 +3797,18 @@ HTMLEditRules::MoveBlock(Element& aLeftB
                          int32_t aLeftOffset,
                          int32_t aRightOffset)
 {
   MOZ_ASSERT(IsEditorDataAvailable());
 
   nsTArray<OwningNonNull<nsINode>> arrayOfNodes;
   // GetNodesFromPoint is the workhorse that figures out what we wnat to move.
   nsresult rv = GetNodesFromPoint(EditorDOMPoint(&aRightBlock, aRightOffset),
-                                  EditSubAction::makeList, arrayOfNodes,
-                                  TouchContent::yes);
+                                  EditSubAction::eCreateOrChangeList,
+                                  arrayOfNodes, TouchContent::yes);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return EditActionIgnored(rv);
   }
 
   EditActionResult ret(NS_OK);
   for (uint32_t i = 0; i < arrayOfNodes.Length(); i++) {
     // get the node to act on
     if (IsBlockNode(arrayOfNodes[i])) {
@@ -4501,17 +4501,17 @@ HTMLEditRules::WillRemoveList(bool* aCan
   nsresult rv = NormalizeSelection();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   AutoSelectionRestorer selectionRestorer(&SelectionRef(), &HTMLEditorRef());
 
   nsTArray<RefPtr<nsRange>> arrayOfRanges;
-  GetPromotedRanges(arrayOfRanges, EditSubAction::makeList);
+  GetPromotedRanges(arrayOfRanges, EditSubAction::eCreateOrChangeList);
 
   // use these ranges to contruct a list of nodes to act on.
   nsTArray<OwningNonNull<nsINode>> arrayOfNodes;
   rv = GetListActionNodes(arrayOfNodes, EntireList::no, TouchContent::yes);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
@@ -7577,17 +7577,17 @@ HTMLEditRules::GetNodesForOperation(
       }
     }
   }
 
 
   // Post-process the list to break up inline containers that contain br's, but
   // only for operations that might care, like making lists or paragraphs
   if (aEditSubAction == EditSubAction::makeBasicBlock ||
-      aEditSubAction == EditSubAction::makeList ||
+      aEditSubAction == EditSubAction::eCreateOrChangeList ||
       aEditSubAction == EditSubAction::align ||
       aEditSubAction == EditSubAction::setAbsolutePosition ||
       aEditSubAction == EditSubAction::indent ||
       aEditSubAction == EditSubAction::outdent) {
     for (int32_t i = aOutArrayOfNodes.Length() - 1; i >= 0; i--) {
       OwningNonNull<nsINode> node = aOutArrayOfNodes[i];
       // XXX Why do we run this loop even when aTouchContent is "no"?
       if (aTouchContent == TouchContent::yes && IsInlineNode(node) &&
@@ -7647,17 +7647,17 @@ HTMLEditRules::GetListActionNodes(
     }
   }
 
   {
     // We don't like other people messing with our selection!
     AutoTransactionsConserveSelection dontChangeMySelection(&HTMLEditorRef());
 
     // contruct a list of nodes to act on.
-    nsresult rv = GetNodesFromSelection(EditSubAction::makeList,
+    nsresult rv = GetNodesFromSelection(EditSubAction::eCreateOrChangeList,
                                         aOutArrayOfNodes, aTouchContent);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   // Pre-process our list of nodes
   for (int32_t i = aOutArrayOfNodes.Length() - 1; i >= 0; i--) {
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -2017,24 +2017,24 @@ HTMLEditor::MakeOrChangeList(const nsASt
 
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
 
   bool cancel, handled;
 
   AutoPlaceholderBatch beginBatching(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::makeList,
+                                      *this, EditSubAction::eCreateOrChangeList,
                                       nsIEditor::eNext);
 
   // pre-process
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
-  EditSubActionInfo subActionInfo(EditSubAction::makeList);
+  EditSubActionInfo subActionInfo(EditSubAction::eCreateOrChangeList);
   subActionInfo.blockType = &aListType;
   subActionInfo.entireList = entireList;
   subActionInfo.bulletType = &aBulletType;
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (cancel || NS_FAILED(rv)) {
     return rv;
   }
--- a/editor/libeditor/TextEditRules.h
+++ b/editor/libeditor/TextEditRules.h
@@ -546,17 +546,17 @@ public:
 
   // EditSubAction::eDeleteSelectedContent
   nsIEditor::EDirection collapsedAction;
   nsIEditor::EStripWrappers stripWrappers;
 
   // EditSubAction::removeList
   bool bOrdered;
 
-  // EditSubAction::makeList
+  // EditSubAction::eCreateOrChangeList
   bool entireList;
   const nsAString* bulletType;
 
   // EditSubAction::align
   const nsAString* alignType;
 
   // EditSubAction::makeBasicBlock
   const nsAString* blockType;