Bug 1463985 - part 3: Rename EditSubAction::undo and EditSubAction::redo to EditSubAction::eUndo and EditSubAction::eRedo r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 20:36:06 +0900
changeset 801973 6224d9e226c6c872885066a5917e635224832da6
parent 801972 48faf65656467282814b015b4761f3a0ca5b720c
child 801974 08e5dc807c3036ace1d11a5943ef269e09400434
push id111796
push usermasayuki@d-toybox.com
push dateThu, 31 May 2018 06:40:56 +0000
reviewersm_kato
bugs1463985
milestone62.0a1
Bug 1463985 - part 3: Rename EditSubAction::undo and EditSubAction::redo to EditSubAction::eUndo and EditSubAction::eRedo r?m_kato MozReview-Commit-ID: 3eNlmFimFlu
editor/libeditor/EditAction.h
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditor.cpp
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -14,18 +14,21 @@ namespace mozilla {
 //       still have some meaning.
 enum class EditSubAction : int32_t
 {
   ignore = -1,
 
   // eNone indicates not edit sub-action is being handled.  This is useful
   // of initial value of member variables.
   eNone = 0,
-  undo,
-  redo,
+
+  // eUndo and eRedo indicate entire actions of undo/redo operation.
+  eUndo,
+  eRedo,
+
   insertNode,
   createNode,
   deleteNode,
   splitNode,
   joinNode,
 
   deleteText = 1003,
 
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -481,18 +481,18 @@ HTMLEditRules::AfterEditInner(EditSubAct
     rangeEndContainer = mDocChangeRange->GetEndContainer();
     rangeStartOffset = mDocChangeRange->StartOffset();
     rangeEndOffset = mDocChangeRange->EndOffset();
     if (rangeStartContainer && rangeEndContainer) {
       bDamagedRange = true;
     }
   }
 
-  if (bDamagedRange && !((aEditSubAction == EditSubAction::undo) ||
-                         (aEditSubAction == EditSubAction::redo))) {
+  if (bDamagedRange && !((aEditSubAction == EditSubAction::eUndo) ||
+                         (aEditSubAction == EditSubAction::eRedo))) {
     // don't let any txns in here move the selection around behind our back.
     // Note that this won't prevent explicit selection setting from working.
     AutoTransactionsConserveSelection dontChangeMySelection(&HTMLEditorRef());
 
     // expand the "changed doc range" as needed
     PromoteRange(*mDocChangeRange, aEditSubAction);
 
     // if we did a ranged deletion or handling backspace key, make sure we have
@@ -639,18 +639,18 @@ HTMLEditRules::WillDoAction(Selection* a
   MOZ_ASSERT(aHandled);
 
   *aCancel = false;
   *aHandled = false;
 
   // Deal with actions for which we don't need to check whether the selection is
   // editable.
   if (aInfo.mEditSubAction == EditSubAction::outputText ||
-      aInfo.mEditSubAction == EditSubAction::undo ||
-      aInfo.mEditSubAction == EditSubAction::redo) {
+      aInfo.mEditSubAction == EditSubAction::eUndo ||
+      aInfo.mEditSubAction == EditSubAction::eRedo) {
     return TextEditRules::WillDoAction(aSelection, aInfo, aCancel, aHandled);
   }
 
   AutoSafeEditorData setData(*this, *mHTMLEditor, *aSelection);
 
   // Nothing to do if there's no selection to act on
   if (NS_WARN_IF(!SelectionRef().RangeCount())) {
     return NS_OK;
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -337,19 +337,19 @@ TextEditRules::WillDoAction(Selection* a
                             aInfo.inString, aInfo.outString,
                             aInfo.maxLength);
     case EditSubAction::setText:
       UndefineCaretBidiLevel();
       return WillSetText(aCancel, aHandled, aInfo.inString,
                          aInfo.maxLength);
     case EditSubAction::deleteSelection:
       return WillDeleteSelection(aInfo.collapsedAction, aCancel, aHandled);
-    case EditSubAction::undo:
+    case EditSubAction::eUndo:
       return WillUndo(aCancel, aHandled);
-    case EditSubAction::redo:
+    case EditSubAction::eRedo:
       return WillRedo(aCancel, aHandled);
     case EditSubAction::setTextProperty:
       return WillSetTextProperty(aCancel, aHandled);
     case EditSubAction::removeTextProperty:
       return WillRemoveTextProperty(aCancel, aHandled);
     case EditSubAction::outputText:
       return WillOutputText(aInfo.outputFormat, aInfo.outString, aInfo.flags,
                             aCancel, aHandled);
@@ -378,19 +378,19 @@ TextEditRules::DidDoAction(Selection* aS
 
   // don't let any txns in here move the selection around behind our back.
   // Note that this won't prevent explicit selection setting from working.
   AutoTransactionsConserveSelection dontChangeMySelection(&TextEditorRef());
 
   switch (aInfo.mEditSubAction) {
     case EditSubAction::deleteSelection:
       return DidDeleteSelection();
-    case EditSubAction::undo:
+    case EditSubAction::eUndo:
       return DidUndo(aResult);
-    case EditSubAction::redo:
+    case EditSubAction::eRedo:
       return DidRedo(aResult);
     default:
       // Don't fail on transactions we don't handle here!
       return NS_OK;
   }
 }
 
 bool
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -1496,20 +1496,20 @@ TextEditor::Undo(uint32_t aCount)
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
   if (NS_WARN_IF(!CanUndo()) || NS_WARN_IF(Destroyed())) {
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv;
   {
     AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                        *this, EditSubAction::undo,
+                                        *this, EditSubAction::eUndo,
                                         nsIEditor::eNone);
 
-    EditSubActionInfo subActionInfo(EditSubAction::undo);
+    EditSubActionInfo subActionInfo(EditSubAction::eUndo);
     RefPtr<Selection> selection = GetSelection();
     bool cancel, handled;
     rv = rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
     if (!cancel && NS_SUCCEEDED(rv)) {
       RefPtr<TransactionManager> transactionManager(mTransactionManager);
       for (uint32_t i = 0; i < aCount; ++i) {
         rv = transactionManager->Undo();
         if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -1551,20 +1551,20 @@ TextEditor::Redo(uint32_t aCount)
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
   if (NS_WARN_IF(!CanRedo()) || NS_WARN_IF(Destroyed())) {
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv;
   {
     AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                        *this, EditSubAction::redo,
+                                        *this, EditSubAction::eRedo,
                                         nsIEditor::eNone);
 
-    EditSubActionInfo subActionInfo(EditSubAction::redo);
+    EditSubActionInfo subActionInfo(EditSubAction::eRedo);
     RefPtr<Selection> selection = GetSelection();
     bool cancel, handled;
     rv = rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
     if (!cancel && NS_SUCCEEDED(rv)) {
       RefPtr<TransactionManager> transactionManager(mTransactionManager);
       for (uint32_t i = 0; i < aCount; ++i) {
         nsresult rv = transactionManager->Redo();
         if (NS_WARN_IF(NS_FAILED(rv))) {