Bug 1460509 - part 22: Mark HTMLEditRules::InsertBRIfNeededInternal() and its wrappers as MOZ_MUST_USE r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 12 May 2018 11:56:56 +0900
changeset 798740 03d9b44f58d72c3a1613937ea47586c215321442
parent 798739 de2a818efa2802c6a5c30bc1bad0167ef6dbfd75
child 798741 6c3ad9fe0dc90a239f2a322472552457fe861e1b
push id110840
push usermasayuki@d-toybox.com
push dateWed, 23 May 2018 13:41:58 +0000
reviewersm_kato
bugs1460509
milestone62.0a1
Bug 1460509 - part 22: Mark HTMLEditRules::InsertBRIfNeededInternal() and its wrappers as MOZ_MUST_USE r?m_kato MozReview-Commit-ID: 4ueY3i1QFuD
editor/libeditor/HTMLEditRules.h
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -180,25 +180,45 @@ protected:
 
   /**
    * CanContainParagraph() returns true if aElement can have a <p> element as
    * its child or its descendant.
    */
   bool CanContainParagraph(Element& aElement) const;
 
   /**
+   * Insert normal <br> element into aNode when aNode is a block and it has
+   * no children.
+   */
+  MOZ_MUST_USE nsresult InsertBRIfNeeded(nsINode& aNode)
+  {
+    return InsertBRIfNeededInternal(aNode, false);
+  }
+
+  /**
+   * Insert moz-<br> element (<br type="_moz">) into aNode when aNode is a
+   * block and it has no children.
+   */
+  MOZ_MUST_USE nsresult InsertMozBRIfNeeded(nsINode& aNode)
+  {
+    return InsertBRIfNeededInternal(aNode, true);
+  }
+
+  /**
    * Insert a normal <br> element or a moz-<br> element to aNode when
-   * aNode is a block and it has no children.
+   * aNode is a block and it has no children.  Use InsertBRIfNeeded() or
+   * InsertMozBRIfNeeded() instead.
    *
    * @param aNode           Reference to a block parent.
    * @param aInsertMozBR    true if this should insert a moz-<br> element.
    *                        Otherwise, i.e., this should insert a normal <br>
    *                        element, false.
    */
-  nsresult InsertBRIfNeededInternal(nsINode& aNode, bool aInsertMozBR);
+  MOZ_MUST_USE nsresult
+  InsertBRIfNeededInternal(nsINode& aNode, bool aInsertMozBR);
 
   EditorDOMPoint GetGoodSelPointForNode(nsINode& aNode,
                                         nsIEditor::EDirection aAction);
 
   /**
    * TryToJoinBlocksWithTransaction() tries to join two block elements.  The
    * right element is always joined to the left element.  If the elements are
    * the same type and not nested within each other,
@@ -572,34 +592,16 @@ protected:
    * table element is its own nearest table element ancestor.
    */
   bool InDifferentTableElements(nsINode* aNode1, nsINode* aNode2);
   nsresult RemoveEmptyNodes();
   nsresult SelectionEndpointInNode(nsINode* aNode, bool* aResult);
   nsresult UpdateDocChangeRange(nsRange* aRange);
   nsresult ConfirmSelectionInBody();
 
-  /**
-   * Insert normal <br> element into aNode when aNode is a block and it has
-   * no children.
-   */
-  nsresult InsertBRIfNeeded(nsINode& aNode)
-  {
-    return InsertBRIfNeededInternal(aNode, false);
-  }
-
-  /**
-   * Insert moz-<br> element (<br type="_moz">) into aNode when aNode is a
-   * block and it has no children.
-   */
-  nsresult InsertMozBRIfNeeded(nsINode& aNode)
-  {
-    return InsertBRIfNeededInternal(aNode, true);
-  }
-
   bool IsEmptyInline(nsINode& aNode);
   bool ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& arrayOfNodes);
 
   /**
    * RemoveAlignment() removes align attributes, text-align properties and
    * <center> elements in aNode.
    *
    * @param aNode               Alignment information of the node and/or its