Bug 1460509 - part 68: Mark HTMLEditRules::DidMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 17 May 2018 19:05:26 +0900
changeset 798786 ba48afee92855afc89673bdc0305af73f619cc7b
parent 798785 e3cac1b7ff6fee7af79e288a9e5cfa82f2eeb0b8
child 798787 1adc8c22446a3b9bd313193f8bacc5e5681d22ae
push id110840
push usermasayuki@d-toybox.com
push dateWed, 23 May 2018 13:41:58 +0000
reviewersm_kato
bugs1460509
milestone62.0a1
Bug 1460509 - part 68: Mark HTMLEditRules::DidMakeBasicBlock() as MOZ_MUST_USE since it may return NS_ERROR_EDITOR_DESTROYED r?m_kato MozReview-Commit-ID: 5ZxF0ArbnLU
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditRules.h
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -763,19 +763,19 @@ HTMLEditRules::DidDoAction(Selection* aS
     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);
+      return DidMakeBasicBlock();
     case EditAction::setAbsolutePosition: {
-      nsresult rv = DidMakeBasicBlock(aInfo, aResult);
+      nsresult rv = DidMakeBasicBlock();
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
       return DidAbsolutePosition();
     }
     default:
       return TextEditRules::DidDoAction(aSelection, aInfo, aResult);
   }
@@ -4478,18 +4478,17 @@ HTMLEditRules::MakeBasicBlock(nsAtom& bl
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
   return NS_OK;
 }
 
 nsresult
-HTMLEditRules::DidMakeBasicBlock(RulesInfo* aInfo,
-                                 nsresult aResult)
+HTMLEditRules::DidMakeBasicBlock()
 {
   MOZ_ASSERT(IsEditorDataAvailable());
 
   // check for empty block.  if so, put a moz br in it.
   if (!SelectionRef().IsCollapsed()) {
     return NS_OK;
   }
 
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -401,17 +401,23 @@ protected:
   MOZ_MUST_USE nsresult
   WillRelativeChangeZIndex(int32_t aChange, bool* aCancel, bool* aHandled);
 
   nsresult WillMakeDefListItem(const nsAString* aBlockType, bool aEntireList,
                                bool* aCancel, bool* aHandled);
   nsresult WillMakeBasicBlock(const nsAString& aBlockType,
                               bool* aCancel, bool* aHandled);
   nsresult MakeBasicBlock(nsAtom& aBlockType);
-  nsresult DidMakeBasicBlock(RulesInfo* aInfo, nsresult aResult);
+
+  /**
+   * Called after creating a basic block, indenting, outdenting or aligning
+   * contents.  This method inserts moz-<br> element if start container of
+   * Selection needs it.
+   */
+  MOZ_MUST_USE nsresult DidMakeBasicBlock();
 
   /**
    * Called before changing an element to absolute positioned.
    * This method only prepares the operation since DidAbsolutePosition() will
    * change it actually later.  mNewBlock is set to the target element and
    * if necessary, some ancestor nodes of selection may be split.
    *
    * @param aCancel             Returns true if the operation is canceled.