Bug 1454945 - Get rid of nsIEditor.suppressDispatchingInputEvent since nobody uses it from JS r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 18 Apr 2018 22:57:41 +0900
changeset 784377 71f064650198d3420041d1dbc5a18daeed24c1a5
parent 784173 3f8f2b12a67d865d053a372c4666e26a337fe41c
push id106914
push usermasayuki@d-toybox.com
push dateWed, 18 Apr 2018 13:59:31 +0000
reviewersm_kato
bugs1454945
milestone61.0a1
Bug 1454945 - Get rid of nsIEditor.suppressDispatchingInputEvent since nobody uses it from JS r?m_kato So, this patch replaces the setter with non-virtual method and removing the getter since where is already non-virtual getter method. MozReview-Commit-ID: Is19Yriz8t8
dom/html/nsTextEditorState.cpp
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
editor/nsIEditor.idl
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -60,21 +60,21 @@ public:
     // another SetValue is already happening for this editor.  If it is,
     // we must wait until we unwind to re-enable oninput events.
     , mOuterTransaction(aTextEditor->IsSuppressingDispatchingInputEvent())
   {
     MOZ_ASSERT(aTextEditor);
   }
   ~ValueSetter()
   {
-    mTextEditor->SetSuppressDispatchingInputEvent(mOuterTransaction);
+    mTextEditor->SuppressDispatchingInputEvent(mOuterTransaction);
   }
   void Init()
   {
-    mTextEditor->SetSuppressDispatchingInputEvent(true);
+    mTextEditor->SuppressDispatchingInputEvent(true);
   }
 
 private:
   RefPtr<TextEditor> mTextEditor;
   bool mOuterTransaction;
 };
 
 class RestoreSelectionState : public Runnable {
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -5148,35 +5148,16 @@ EditorBase::OnFocus(nsIDOMEventTarget* a
   InitializeSelection(aFocusEventTarget);
   mSpellCheckerDictionaryUpdated = false;
   if (mInlineSpellChecker && CanEnableSpellCheck()) {
     mInlineSpellChecker->UpdateCurrentDictionary();
     mSpellCheckerDictionaryUpdated = true;
   }
 }
 
-NS_IMETHODIMP
-EditorBase::GetSuppressDispatchingInputEvent(bool* aSuppressed)
-{
-  // NOTE: If you need to override this method, you need to make
-  //       IsSuppressingDispatchingInputEvent() virtual.
-  if (NS_WARN_IF(aSuppressed)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-  *aSuppressed = IsSuppressingDispatchingInputEvent();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-EditorBase::SetSuppressDispatchingInputEvent(bool aSuppress)
-{
-  mDispatchInputEvent = !aSuppress;
-  return NS_OK;
-}
-
 int32_t
 EditorBase::GetIMESelectionStartOffsetIn(nsINode* aTextNode)
 {
   MOZ_ASSERT(aTextNode, "aTextNode must not be nullptr");
 
   nsISelectionController* selectionController = GetSelectionController();
   if (NS_WARN_IF(!selectionController)) {
     return -1;
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -1690,16 +1690,25 @@ public:
 
   /**
    * IsInEditAction() return true while the instance is handling an edit action.
    * Otherwise, false.
    */
   bool IsInEditAction() const { return mIsInEditAction; }
 
   /**
+   * SuppressDispatchingInputEvent() suppresses or unsuppresses dispatching
+   * "input" event.
+   */
+  void SuppressDispatchingInputEvent(bool aSuppress)
+  {
+    mDispatchInputEvent = !aSuppress;
+  }
+
+  /**
    * IsSuppressingDispatchingInputEvent() returns true if the editor stops
    * dispatching input event.  Otherwise, false.
    */
   bool IsSuppressingDispatchingInputEvent() const
   {
     return !mDispatchInputEvent;
   }
 
--- a/editor/nsIEditor.idl
+++ b/editor/nsIEditor.idl
@@ -513,19 +513,16 @@ interface nsIEditor  : nsISupports
   void dumpContentTree();
 
   /** Dumps a text representation of the content tree to standard out */
   void debugDumpContent() ;
 
   /* Run unit tests. Noop in optimized builds */
   void debugUnitTests(out long outNumTests, out long  outNumTestsFailed);
 
-  /* Set true if you want to suppress dispatching input event. */
-  attribute boolean suppressDispatchingInputEvent;
-
   /**
    * forceCompositionEnd() force the composition end
    */
   void forceCompositionEnd();
 
   /**
    * whether this editor has active IME transaction
    */