Bug 1457083 - part 7: Remove methods of TextEditRules and HTMLEditRules, which just return NS_OK r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 10 May 2018 16:04:06 +0900
changeset 473368 363c21e529d0e88f8b5422a825a846776b9cd11c
parent 473367 e84f2a4cd2ae389f7e10ee4e5f8296b1d0ab98b5
child 473369 4026dbe2606d9e52d3da42779db1eefff5cbbbf9
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1457083
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457083 - part 7: Remove methods of TextEditRules and HTMLEditRules, which just return NS_OK r=m_kato Some Did*() of TextEditRules and HTMLEditRules do nothing except returning NS_OK. Let's remove them since there is no reason to keep them. MozReview-Commit-ID: Jcdh5rnm5Yc
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditRules.h
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditRules.h
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -723,18 +723,20 @@ HTMLEditRules::DidDoAction(Selection* aS
   }
   if (NS_WARN_IF(!mHTMLEditor)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   AutoSafeEditorData setData(*this, *mHTMLEditor, *aSelection);
 
   switch (aInfo->action) {
+    case EditAction::insertText:
     case EditAction::insertBreak:
-      return DidInsertBreak(aResult);
+    case EditAction::insertIMEText:
+      return NS_OK;
     case EditAction::deleteSelection:
       return DidDeleteSelection(aInfo->collapsedAction, aResult);
     case EditAction::makeBasicBlock:
     case EditAction::indent:
     case EditAction::outdent:
     case EditAction::align:
       return DidMakeBasicBlock(aInfo, aResult);
     case EditAction::setAbsolutePosition: {
@@ -2091,22 +2093,16 @@ HTMLEditRules::InsertBRElement(const Edi
   SelectionRef().Collapse(afterBRElement, error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   return NS_OK;
 }
 
 nsresult
-HTMLEditRules::DidInsertBreak(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 HTMLEditRules::SplitMailCites(bool* aHandled)
 {
   MOZ_ASSERT(IsEditorDataAvailable());
 
   if (NS_WARN_IF(!aHandled)) {
     return NS_ERROR_INVALID_ARG;
   }
 
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -155,17 +155,16 @@ protected:
   /**
    * InsertBRElement() inserts a <br> element into aInsertToBreak.
    *
    * @param aInsertToBreak      The point where new <br> element will be
    *                            inserted before.
    */
   nsresult InsertBRElement(const EditorDOMPoint& aInsertToBreak);
 
-  nsresult DidInsertBreak(nsresult aResult);
   nsresult SplitMailCites(bool* aHandled);
   nsresult WillDeleteSelection(nsIEditor::EDirection aAction,
                                nsIEditor::EStripWrappers aStripWrappers,
                                bool* aCancel, bool* aHandled);
   nsresult DidDeleteSelection(nsIEditor::EDirection aDir,
                               nsresult aResult);
   nsresult InsertBRIfNeeded();
 
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -364,35 +364,22 @@ TextEditRules::DidDoAction(Selection* aS
 
   AutoSafeEditorData setData(*this, *mTextEditor, *aSelection);
 
   // 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->action) {
-    case EditAction::insertBreak:
-      return DidInsertBreak(aResult);
-    case EditAction::insertText:
-    case EditAction::insertIMEText:
-      return DidInsertText(aResult);
-    case EditAction::setText:
-      return DidSetText(aResult);
     case EditAction::deleteSelection:
       return DidDeleteSelection(aInfo->collapsedAction, aResult);
     case EditAction::undo:
       return DidUndo(aResult);
     case EditAction::redo:
       return DidRedo(aResult);
-    case EditAction::setTextProperty:
-      return DidSetTextProperty(aResult);
-    case EditAction::removeTextProperty:
-      return DidRemoveTextProperty(aResult);
-    case EditAction::outputText:
-      return DidOutputText(aResult);
     default:
       // Don't fail on transactions we don't handle here!
       return NS_OK;
   }
 }
 
 /**
  * Return false if the editor has non-empty text nodes or non-text
@@ -430,22 +417,16 @@ TextEditRules::WillInsert(bool* aCancel)
       TextEditorRef().DeleteNodeWithTransaction(*mBogusNode);
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
       "Failed to remove the bogus node");
     mBogusNode = nullptr;
   }
 }
 
 nsresult
-TextEditRules::DidInsert(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 TextEditRules::WillInsertBreak(bool* aCancel,
                                bool* aHandled,
                                int32_t aMaxLength)
 {
   MOZ_ASSERT(IsEditorDataAvailable());
   if (NS_WARN_IF(!aCancel) || NS_WARN_IF(!aHandled)) {
     return NS_ERROR_INVALID_ARG;
   }
@@ -485,22 +466,16 @@ TextEditRules::WillInsertBreak(bool* aCa
     // initialize out param
     // we want to ignore result of WillInsert()
     *aCancel = false;
   }
   return NS_OK;
 }
 
 nsresult
-TextEditRules::DidInsertBreak(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 TextEditRules::CollapseSelectionToTrailingBRIfNeeded()
 {
   MOZ_ASSERT(IsEditorDataAvailable());
 
   // we only need to execute the stuff below if we are a plaintext editor.
   // html editors have a different mechanism for putting in mozBR's
   // (because there are a bunch more places you have to worry about it in html)
   if (!IsPlaintextEditor()) {
@@ -851,22 +826,16 @@ TextEditRules::WillInsertText(EditAction
         "Failed to collapse selection after inserting string");
     }
   }
   ASSERT_PASSWORD_LENGTHS_EQUAL()
   return NS_OK;
 }
 
 nsresult
-TextEditRules::DidInsertText(nsresult aResult)
-{
-  return DidInsert(aResult);
-}
-
-nsresult
 TextEditRules::WillSetText(bool* aCancel,
                            bool* aHandled,
                            const nsAString* aString,
                            int32_t aMaxLength)
 {
   MOZ_ASSERT(IsEditorDataAvailable());
   MOZ_ASSERT(aCancel);
   MOZ_ASSERT(aHandled);
@@ -953,64 +922,46 @@ TextEditRules::WillSetText(bool* aCancel
   *aHandled = true;
 
   ASSERT_PASSWORD_LENGTHS_EQUAL();
 
   return NS_OK;
 }
 
 nsresult
-TextEditRules::DidSetText(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 TextEditRules::WillSetTextProperty(bool* aCancel,
                                    bool* aHandled)
 {
   if (NS_WARN_IF(!aCancel) || NS_WARN_IF(!aHandled)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   // XXX: should probably return a success value other than NS_OK that means "not allowed"
   if (IsPlaintextEditor()) {
     *aCancel = true;
   }
   return NS_OK;
 }
 
 nsresult
-TextEditRules::DidSetTextProperty(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 TextEditRules::WillRemoveTextProperty(bool* aCancel,
                                       bool* aHandled)
 {
   if (NS_WARN_IF(!aCancel) || NS_WARN_IF(!aHandled)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   // XXX: should probably return a success value other than NS_OK that means "not allowed"
   if (IsPlaintextEditor()) {
     *aCancel = true;
   }
   return NS_OK;
 }
 
 nsresult
-TextEditRules::DidRemoveTextProperty(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 TextEditRules::WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
                                    bool* aCancel,
                                    bool* aHandled)
 {
   MOZ_ASSERT(IsEditorDataAvailable());
 
   if (NS_WARN_IF(!aCancel) || NS_WARN_IF(!aHandled)) {
     return NS_ERROR_INVALID_ARG;
@@ -1350,22 +1301,16 @@ TextEditRules::WillOutputText(const nsAS
   // Otherwise, the text is the value.
   text->GetData(*aOutString);
 
   *aHandled = true;
   return NS_OK;
 }
 
 nsresult
-TextEditRules::DidOutputText(nsresult aResult)
-{
-  return NS_OK;
-}
-
-nsresult
 TextEditRules::RemoveRedundantTrailingBR()
 {
   MOZ_ASSERT(IsEditorDataAvailable());
 
   // If the bogus node exists, we have no work to do
   if (mBogusNode) {
     return NS_OK;
   }
--- a/editor/libeditor/TextEditRules.h
+++ b/editor/libeditor/TextEditRules.h
@@ -130,41 +130,35 @@ protected:
 
   // TextEditRules implementation methods
   nsresult WillInsertText(EditAction aAction,
                           bool* aCancel,
                           bool* aHandled,
                           const nsAString* inString,
                           nsAString* outString,
                           int32_t aMaxLength);
-  nsresult DidInsertText(nsresult aResult);
 
   nsresult WillInsertBreak(bool* aCancel, bool* aHandled, int32_t aMaxLength);
-  nsresult DidInsertBreak(nsresult aResult);
 
   nsresult WillSetText(bool* aCancel,
                        bool* aHandled,
                        const nsAString* inString,
                        int32_t aMaxLength);
-  nsresult DidSetText(nsresult aResult);
 
   void WillInsert(bool* aCancel);
-  nsresult DidInsert(nsresult aResult);
 
   nsresult WillDeleteSelection(nsIEditor::EDirection aCollapsedAction,
                                bool* aCancel,
                                bool* aHandled);
   nsresult DidDeleteSelection(nsIEditor::EDirection aCollapsedAction,
                               nsresult aResult);
 
   nsresult WillSetTextProperty(bool* aCancel, bool* aHandled);
-  nsresult DidSetTextProperty(nsresult aResult);
 
   nsresult WillRemoveTextProperty(bool* aCancel, bool* aHandled);
-  nsresult DidRemoveTextProperty(nsresult aResult);
 
   nsresult WillUndo(bool* aCancel, bool* aHandled);
   nsresult DidUndo(nsresult aResult);
 
   nsresult WillRedo(bool* aCancel, bool* aHandled);
   nsresult DidRedo(nsresult aResult);
 
   /**
@@ -176,18 +170,16 @@ protected:
    *                   and use aOutText as the result.
    */
   nsresult WillOutputText(const nsAString* aInFormat,
                           nsAString* aOutText,
                           uint32_t aFlags,
                           bool* aOutCancel,
                           bool* aHandled);
 
-  nsresult DidOutputText(nsresult aResult);
-
   /**
    * Check for and replace a redundant trailing break.
    */
   nsresult RemoveRedundantTrailingBR();
 
   /**
    * Creates a trailing break in the text doc if there is not one already.
    */