Bug 1463985 - part 2: Rename EditSubAction::none to EditSubAction::eNone r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 28 May 2018 20:29:34 +0900
changeset 801972 48faf65656467282814b015b4761f3a0ca5b720c
parent 801971 45e919bbb946cb0ca41f9511aab9cb1361d5a289
child 801973 6224d9e226c6c872885066a5917e635224832da6
push id111796
push usermasayuki@d-toybox.com
push dateThu, 31 May 2018 06:40:56 +0000
reviewersm_kato
bugs1463985
milestone62.0a1
Bug 1463985 - part 2: Rename EditSubAction::none to EditSubAction::eNone r?m_kato MozReview-Commit-ID: 4wJyaNS1P1y
editor/libeditor/EditAction.h
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
editor/libeditor/TextEditRules.cpp
--- a/editor/libeditor/EditAction.h
+++ b/editor/libeditor/EditAction.h
@@ -11,17 +11,19 @@ namespace mozilla {
 // This is int32_t instead of int16_t because nsIInlineSpellChecker.idl's
 // spellCheckAfterEditorChange is defined to take it as a long.
 // TODO: Make each name eFoo and investigate whether the numeric values
 //       still have some meaning.
 enum class EditSubAction : int32_t
 {
   ignore = -1,
 
-  none = 0,
+  // eNone indicates not edit sub-action is being handled.  This is useful
+  // of initial value of member variables.
+  eNone = 0,
   undo,
   redo,
   insertNode,
   createNode,
   deleteNode,
   splitNode,
   joinNode,
 
@@ -56,12 +58,12 @@ enum class EditSubAction : int32_t
   decreaseZIndex,
   increaseZIndex,
 };
 
 } // namespace mozilla
 
 inline bool operator!(const mozilla::EditSubAction& aEditSubAction)
 {
-  return aEditSubAction == mozilla::EditSubAction::none;
+  return aEditSubAction == mozilla::EditSubAction::eNone;
 }
 
 #endif // #ifdef mozilla_EditAction_h
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -155,17 +155,17 @@ EditorBase::MoveNodeWithTransaction(nsIC
                                     const EditorRawDOMPoint& aPointToInsert);
 
 EditorBase::EditorBase()
   : mPlaceholderName(nullptr)
   , mModCount(0)
   , mFlags(0)
   , mUpdateCount(0)
   , mPlaceholderBatch(0)
-  , mTopLevelEditSubAction(EditSubAction::none)
+  , mTopLevelEditSubAction(EditSubAction::eNone)
   , mDirection(eNone)
   , mDocDirtyState(-1)
   , mSpellcheckCheckboxState(eTriUnset)
   , mShouldTxnSetSelection(true)
   , mDidPreDestroy(false)
   , mDidPostCreate(false)
   , mDispatchInputEvent(true)
   , mIsInEditSubAction(false)
@@ -253,17 +253,17 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(EditorB
 
 nsresult
 EditorBase::Init(nsIDocument& aDocument,
                  Element* aRoot,
                  nsISelectionController* aSelectionController,
                  uint32_t aFlags,
                  const nsAString& aValue)
 {
-  MOZ_ASSERT(mTopLevelEditSubAction == EditSubAction::none,
+  MOZ_ASSERT(mTopLevelEditSubAction == EditSubAction::eNone,
              "Initializing during an edit action is an error");
 
   // First only set flags, but other stuff shouldn't be initialized now.
   // Don't move this call after initializing mDocument.
   // SetFlags() can check whether it's called during initialization or not by
   // them.  Note that SetFlags() will be called by PostCreate().
 #ifdef DEBUG
   nsresult rv =
@@ -2425,17 +2425,17 @@ EditorBase::OnStartToHandleTopLevelEditS
 {
   mTopLevelEditSubAction = aEditSubAction;
   mDirection = aDirection;
 }
 
 void
 EditorBase::OnEndHandlingTopLevelEditSubAction()
 {
-  mTopLevelEditSubAction = EditSubAction::none;
+  mTopLevelEditSubAction = EditSubAction::eNone;
   mDirection = eNone;
 }
 
 NS_IMETHODIMP
 EditorBase::CloneAttribute(const nsAString& aAttribute,
                            Element* aDestElement,
                            Element* aSourceElement)
 {
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1583,17 +1583,17 @@ protected: // May be called by friends.
    * nsCaret.  Therefore, this is stateless.
    */
   void HideCaret(bool aHide);
 
 protected: // Called by helper classes.
 
   /**
    * OnStartToHandleTopLevelEditSubAction() is called when
-   * mTopLevelEditSubAction is EditSubAction::none and somebody starts to
+   * mTopLevelEditSubAction is EditSubAction::eNone and somebody starts to
    * handle aEditSubAction.
    *
    * @param aEditSubAction      Top level edit sub action which will be
    *                            handled soon.
    * @param aDirection          Direction of aEditSubAction.
    */
   virtual void
   OnStartToHandleTopLevelEditSubAction(EditSubAction aEditSubAction,
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -67,17 +67,17 @@ TextEditRules::TextEditRules()
   , mData(nullptr)
   , mPasswordIMEIndex(0)
   , mCachedSelectionOffset(0)
   , mActionNesting(0)
   , mLockRulesSniffing(false)
   , mDidExplicitlySetInterline(false)
   , mDeleteBidiImmediately(false)
   , mIsHTMLEditRules(false)
-  , mTopLevelEditSubAction(EditSubAction::none)
+  , mTopLevelEditSubAction(EditSubAction::eNone)
   , mLastStart(0)
   , mLastLength(0)
 {
   InitFields();
 }
 
 void
 TextEditRules::InitFields()
@@ -88,17 +88,17 @@ TextEditRules::InitFields()
   mPasswordIMEIndex = 0;
   mBogusNode = nullptr;
   mCachedSelectionNode = nullptr;
   mCachedSelectionOffset = 0;
   mActionNesting = 0;
   mLockRulesSniffing = false;
   mDidExplicitlySetInterline = false;
   mDeleteBidiImmediately = false;
-  mTopLevelEditSubAction = EditSubAction::none;
+  mTopLevelEditSubAction = EditSubAction::eNone;
   mTimer = nullptr;
   mLastStart = 0;
   mLastLength = 0;
 }
 
 TextEditRules::~TextEditRules()
 {
    // do NOT delete mTextEditor here.  We do not hold a ref count to