Bug 1463985 - part 21: Rename EditSubAction::insertElement to EditSubAction::eInsertElement r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 23:13:41 +0900
changeset 801991 cab068c347e8dee9ab60962de78f793b44e1f808
parent 801990 f7ca5372858e98f43952e14865df95f5df6b81ec
child 801992 173ca882a661140a0de6850d546fd515a1c23d4f
push id111796
push usermasayuki@d-toybox.com
push dateThu, 31 May 2018 06:40:56 +0000
reviewersm_kato
bugs1463985
milestone62.0a1
Bug 1463985 - part 21: Rename EditSubAction::insertElement to EditSubAction::eInsertElement r?m_kato MozReview-Commit-ID: 6nrm1zJ968f
editor/libeditor/EditAction.h
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/HTMLStyleEditor.cpp
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditor.cpp
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -88,17 +88,19 @@ enum class EditSubAction : int32_t
 
   // eRemoveList removes specific type of list but keep its content.
   eRemoveList,
 
   // eCreateOrChangeDefinitionList indicates to create new definition list or
   // change existing list to a definition list.
   eCreateOrChangeDefinitionList,
 
-  insertElement,
+  // eInsertElement indicates to insert an element.
+  eInsertElement,
+
   insertQuotation,
 
   htmlPaste = 3012,
   loadHTML,
   resetTextProperties,
   setAbsolutePosition,
   removeAbsolutePosition,
   decreaseZIndex,
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -88,17 +88,17 @@ IsStyleCachePreservingSubAction(EditSubA
          aEditSubAction == EditSubAction::eInsertParagraphSeparator ||
          aEditSubAction == EditSubAction::eCreateOrChangeList ||
          aEditSubAction == EditSubAction::eIndent ||
          aEditSubAction == EditSubAction::eOutdent ||
          aEditSubAction == EditSubAction::eSetOrClearAlignment ||
          aEditSubAction == EditSubAction::eCreateOrRemoveBlock ||
          aEditSubAction == EditSubAction::eRemoveList ||
          aEditSubAction == EditSubAction::eCreateOrChangeDefinitionList ||
-         aEditSubAction == EditSubAction::insertElement ||
+         aEditSubAction == EditSubAction::eInsertElement ||
          aEditSubAction == EditSubAction::insertQuotation;
 }
 
 static nsAtom&
 ParagraphSeparatorElement(ParagraphSeparator separator)
 {
   switch (separator) {
     default:
@@ -719,17 +719,17 @@ HTMLEditRules::WillDoAction(Selection* a
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
       return NS_OK;
     }
     case EditSubAction::eCreateOrChangeDefinitionList:
       return WillMakeDefListItem(aInfo.blockType,
                                  aInfo.entireList, aCancel, aHandled);
-    case EditSubAction::insertElement: {
+    case EditSubAction::eInsertElement: {
       nsresult rv = WillInsert(aCancel);
       if (NS_WARN_IF(rv == NS_ERROR_EDITOR_DESTROYED)) {
         return NS_ERROR_EDITOR_DESTROYED;
       }
       NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "WillInsert() failed");
       return NS_OK;
     }
     case EditSubAction::decreaseZIndex:
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -1559,27 +1559,27 @@ HTMLEditor::InsertElementAtSelection(Ele
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
 
   NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
 
   CommitComposition();
   AutoPlaceholderBatch beginBatching(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertElement,
+                                      *this, EditSubAction::eInsertElement,
                                       nsIEditor::eNext);
 
   RefPtr<Selection> selection = GetSelection();
   if (!selection) {
     return NS_ERROR_FAILURE;
   }
 
   // hand off to the rules system, see if it has anything to say about this
   bool cancel, handled;
-  EditSubActionInfo subActionInfo(EditSubAction::insertElement);
+  EditSubActionInfo subActionInfo(EditSubAction::eInsertElement);
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (cancel || NS_FAILED(rv)) {
     return rv;
   }
 
   if (!handled) {
     if (aDeleteSelection) {
@@ -4370,17 +4370,17 @@ HTMLEditor::SetCSSBackgroundColorWithTra
 
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_STATE(selection);
 
   bool isCollapsed = selection->IsCollapsed();
 
   AutoPlaceholderBatch batchIt(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertElement,
+                                      *this, EditSubAction::eInsertElement,
                                       nsIEditor::eNext);
   AutoSelectionRestorer selectionRestorer(selection, this);
   AutoTransactionsConserveSelection dontChangeMySelection(this);
 
   // XXX Although, this method may set background color of ancestor block
   //     element, using EditSubAction::eSetTextProperty.
   bool cancel, handled;
   EditSubActionInfo subActionInfo(EditSubAction::eSetTextProperty);
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -335,17 +335,17 @@ HTMLEditor::DoInsertHTMLWithContext(cons
       rv = DeleteTableCell(1);
       NS_ENSURE_SUCCESS(rv, rv);
     }
     // collapse selection to beginning of deleted table content
     selection->CollapseToStart(IgnoreErrors());
   }
 
   // give rules a chance to handle or cancel
-  EditSubActionInfo subActionInfo(EditSubAction::insertElement);
+  EditSubActionInfo subActionInfo(EditSubAction::eInsertElement);
   bool cancel, handled;
   rv = rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel) {
     return NS_OK; // rules canceled the operation
   }
 
   if (!handled) {
@@ -1593,17 +1593,17 @@ HTMLEditor::PasteAsCitedQuotation(const 
                                       *this, EditSubAction::insertQuotation,
                                       nsIEditor::eNext);
 
   // get selection
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   // give rules a chance to handle or cancel
-  EditSubActionInfo subActionInfo(EditSubAction::insertElement);
+  EditSubActionInfo subActionInfo(EditSubAction::eInsertElement);
   bool cancel, handled;
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -1799,17 +1799,17 @@ HTMLEditor::InsertAsPlaintextQuotation(c
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   AutoPlaceholderBatch beginBatching(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
                                       *this, EditSubAction::insertQuotation,
                                       nsIEditor::eNext);
 
   // give rules a chance to handle or cancel
-  EditSubActionInfo subActionInfo(EditSubAction::insertElement);
+  EditSubActionInfo subActionInfo(EditSubAction::eInsertElement);
   bool cancel, handled;
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -1906,17 +1906,17 @@ HTMLEditor::InsertAsCitedQuotation(const
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   AutoPlaceholderBatch beginBatching(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
                                       *this, EditSubAction::insertQuotation,
                                       nsIEditor::eNext);
 
   // give rules a chance to handle or cancel
-  EditSubActionInfo subActionInfo(EditSubAction::insertElement);
+  EditSubActionInfo subActionInfo(EditSubAction::eInsertElement);
   bool cancel, handled;
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -81,17 +81,17 @@ HTMLEditor::SetInlineProperty(nsAtom* aP
     // Manipulating text attributes on a collapsed selection only sets state
     // for the next text insertion
     mTypeInState->SetProp(aProperty, aAttribute, aValue);
     return NS_OK;
   }
 
   AutoPlaceholderBatch batchIt(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::insertElement,
+                                      *this, EditSubAction::eInsertElement,
                                       nsIEditor::eNext);
   AutoSelectionRestorer selectionRestorer(selection, this);
   AutoTransactionsConserveSelection dontChangeMySelection(this);
 
   bool cancel, handled;
   EditSubActionInfo subActionInfo(EditSubAction::eSetTextProperty);
   // Protect the edit rules object from dying
   nsresult rv =
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -348,17 +348,17 @@ TextEditRules::WillDoAction(Selection* a
       return WillRedo(aCancel, aHandled);
     case EditSubAction::eSetTextProperty:
       return WillSetTextProperty(aCancel, aHandled);
     case EditSubAction::eRemoveTextProperty:
       return WillRemoveTextProperty(aCancel, aHandled);
     case EditSubAction::eComputeTextToOutput:
       return WillOutputText(aInfo.outputFormat, aInfo.outString, aInfo.flags,
                             aCancel, aHandled);
-    case EditSubAction::insertElement:
+    case EditSubAction::eInsertElement:
       // i had thought this would be html rules only.  but we put pre elements
       // into plaintext mail when doing quoting for reply!  doh!
       return WillInsert(aCancel);
     default:
       return NS_ERROR_FAILURE;
   }
 }
 
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -1869,17 +1869,17 @@ TextEditor::InsertAsQuotation(const nsAS
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   AutoPlaceholderBatch beginBatching(this);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
                                       *this, EditSubAction::eInsertText,
                                       nsIEditor::eNext);
 
   // give rules a chance to handle or cancel
-  EditSubActionInfo subActionInfo(EditSubAction::insertElement);
+  EditSubActionInfo subActionInfo(EditSubAction::eInsertElement);
   bool cancel, handled;
   rv = rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   if (cancel) {
     return NS_OK; // Rules canceled the operation.
   }