Bug 1463985 - part 13: Rename EditSubAction::setText to EditSubAction::eSetText r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 22:20:43 +0900
changeset 801983 f7e3358c1a808c46002606952e39283d5f8fb259
parent 801982 446a42331249e6a86af8eae8ac7f991771623be7
child 801984 aaeea4c1d7bd25fdf2cbbed7c9b29db34c397269
push id111796
push usermasayuki@d-toybox.com
push dateThu, 31 May 2018 06:40:56 +0000
reviewersm_kato
bugs1463985
milestone62.0a1
Bug 1463985 - part 13: Rename EditSubAction::setText to EditSubAction::eSetText r?m_kato MozReview-Commit-ID: A4DF3fX9IV6
editor/libeditor/EditAction.h
editor/libeditor/EditorBase.cpp
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditor.cpp
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -57,17 +57,18 @@ enum class EditSubAction : int32_t
 
   // eRemoveTextProperty indicates to remove a style from text.
   eRemoveTextProperty,
 
   // eComputeTextToOutput indicates to compute the editor value as plain text
   // or something requested format.
   eComputeTextToOutput,
 
-  setText,
+  // eSetText indicates to set editor value to new value.
+  eSetText,
 
   // HTML editor only actions
   insertBreak = 3000,
   makeList,
   indent,
   outdent,
   align,
   makeBasicBlock,
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2909,17 +2909,17 @@ EditorBase::NotifyDocumentListeners(
 
 nsresult
 EditorBase::SetTextImpl(Selection& aSelection, const nsAString& aString,
                         Text& aCharData)
 {
   const uint32_t length = aCharData.Length();
 
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::setText,
+                                      *this, EditSubAction::eSetText,
                                       nsIEditor::eNext);
 
   // Let listeners know what's up
   if (!mActionListeners.IsEmpty() && length) {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
       listener->WillDeleteText(&aCharData, 0, length);
     }
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -215,17 +215,17 @@ TextEditRules::BeforeEdit(EditSubAction 
   AutoLockRulesSniffing lockIt(this);
   mDidExplicitlySetInterline = false;
   if (!mActionNesting) {
     // let rules remember the top level action
     mTopLevelEditSubAction = aEditSubAction;
   }
   mActionNesting++;
 
-  if (aEditSubAction == EditSubAction::setText) {
+  if (aEditSubAction == EditSubAction::eSetText) {
     // setText replaces all text, so mCachedSelectionNode might be invalid on
     // AfterEdit.
     // Since this will be used as start position of spellchecker, we should
     // use root instead.
     mCachedSelectionNode = mTextEditor->GetRoot();
     mCachedSelectionOffset = 0;
   } else {
     Selection* selection = mTextEditor->GetSelection();
@@ -331,17 +331,17 @@ TextEditRules::WillDoAction(Selection* a
       UndefineCaretBidiLevel();
       return WillInsertBreak(aCancel, aHandled, aInfo.maxLength);
     case EditSubAction::eInsertText:
     case EditSubAction::eInsertTextComingFromIME:
       UndefineCaretBidiLevel();
       return WillInsertText(aInfo.mEditSubAction, aCancel, aHandled,
                             aInfo.inString, aInfo.outString,
                             aInfo.maxLength);
-    case EditSubAction::setText:
+    case EditSubAction::eSetText:
       UndefineCaretBidiLevel();
       return WillSetText(aCancel, aHandled, aInfo.inString,
                          aInfo.maxLength);
     case EditSubAction::eDeleteSelectedContent:
       return WillDeleteSelection(aInfo.collapsedAction, aCancel, aHandled);
     case EditSubAction::eUndo:
       return WillUndo(aCancel, aHandled);
     case EditSubAction::eRedo:
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -1100,25 +1100,25 @@ TextEditor::SetText(const nsAString& aSt
   }
 
   // Protect the edit rules object from dying
   RefPtr<TextEditRules> rules(mRules);
 
   // delete placeholder txns merge.
   AutoPlaceholderBatch batch(this, nullptr);
   AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
-                                      *this, EditSubAction::setText,
+                                      *this, EditSubAction::eSetText,
                                       nsIEditor::eNext);
 
   // pre-process
   RefPtr<Selection> selection = GetSelection();
   if (NS_WARN_IF(!selection)) {
     return NS_ERROR_NULL_POINTER;
   }
-  EditSubActionInfo subActionInfo(EditSubAction::setText);
+  EditSubActionInfo subActionInfo(EditSubAction::eSetText);
   subActionInfo.inString = &aString;
   subActionInfo.maxLength = mMaxTextLength;
 
   bool cancel;
   bool handled;
   nsresult rv =
     rules->WillDoAction(selection, subActionInfo, &cancel, &handled);
   if (NS_WARN_IF(NS_FAILED(rv))) {