Bug 1423835 - part 3: Rename EditorDOMPointBase::GetChildAtOffset() to EditorDOMPointBase::GetChild() r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 07 Dec 2017 19:08:56 +0900
changeset 710434 ddba1394714ad8e946e267533d5ac7830c5660a6
parent 710433 024ac127d0043107bb964833f17825849eaef4dd
child 743582 20414b9907b382690a42027d32e1aea1ee8bf123
push id92824
push usermasayuki@d-toybox.com
push dateSun, 10 Dec 2017 04:04:12 +0000
reviewersm_kato
bugs1423835
milestone59.0a1
Bug 1423835 - part 3: Rename EditorDOMPointBase::GetChildAtOffset() to EditorDOMPointBase::GetChild() r?m_kato Different from RangeBoundaryBase, EditorDOMPointBase can store only child node. I.e., mOffset may be invalid until its Offset() is called. So, GetChildAtOffset() isn't good name. It should be just GetChild(). Similarly, GetNextSiblingOfChildAtOffset() and GetPreviousSiblingOfChildAtOffset() should be renamed to GetNextSiblingOfChild() and GetPreviousSiblingOfChild(). MozReview-Commit-ID: WpkPmDwkrL
editor/libeditor/CreateElementTransaction.cpp
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
editor/libeditor/EditorDOMPoint.h
editor/libeditor/EditorUtils.h
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/InsertNodeTransaction.cpp
editor/libeditor/SplitNodeTransaction.cpp
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditor.cpp
editor/libeditor/WSRunObject.cpp
--- a/editor/libeditor/CreateElementTransaction.cpp
+++ b/editor/libeditor/CreateElementTransaction.cpp
@@ -110,25 +110,25 @@ CreateElementTransaction::InsertNewNode(
   if (mPointToInsert.IsSetAndValid()) {
     if (mPointToInsert.IsEndOfContainer()) {
       mPointToInsert.GetContainer()->AppendChild(*mNewNode, aError);
       NS_WARNING_ASSERTION(!aError.Failed(), "Failed to append the new node");
       return;
     }
     mPointToInsert.GetContainer()->
                      InsertBefore(*mNewNode,
-                                  mPointToInsert.GetChildAtOffset(),
+                                  mPointToInsert.GetChild(),
                                   aError);
     NS_WARNING_ASSERTION(!aError.Failed(), "Failed to insert the new node");
     return;
   }
 
-  if (NS_WARN_IF(mPointToInsert.GetChildAtOffset() &&
+  if (NS_WARN_IF(mPointToInsert.GetChild() &&
                  mPointToInsert.GetContainer() !=
-                   mPointToInsert.GetChildAtOffset()->GetParentNode())) {
+                   mPointToInsert.GetChild()->GetParentNode())) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   // If mPointToInsert has only offset and it's not valid, we need to treat
   // it as pointing end of the container.
   mPointToInsert.GetContainer()->AppendChild(*mNewNode, aError);
   NS_WARNING_ASSERTION(!aError.Failed(), "Failed to append the new node");
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -1432,29 +1432,29 @@ EditorBase::CreateNode(nsAtom* aTag,
   int32_t offset = static_cast<int32_t>(pointToInsert.Offset());
 
   AutoRules beginRulesSniffing(this, EditAction::createNode, nsIEditor::eNext);
 
   {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
       listener->WillCreateNode(nsDependentAtomString(aTag),
-                               GetAsDOMNode(pointToInsert.GetChildAtOffset()));
+                               GetAsDOMNode(pointToInsert.GetChild()));
     }
   }
 
   nsCOMPtr<Element> ret;
 
   RefPtr<CreateElementTransaction> transaction =
     CreateTxnForCreateElement(*aTag, pointToInsert);
   nsresult rv = DoTransaction(transaction);
   if (NS_SUCCEEDED(rv)) {
     ret = transaction->GetNewNode();
     MOZ_ASSERT(ret);
-    // Now, aPointToInsert may be invalid.  I.e., ChildAtOffset() keeps
+    // Now, aPointToInsert may be invalid.  I.e., GetChild() keeps
     // referring the next sibling of new node but Offset() refers the
     // new node.  Let's make refer the new node.
     pointToInsert.Set(ret);
   }
 
   mRangeUpdater.SelAdjCreateNode(pointToInsert.GetContainer(), offset);
 
   {
@@ -1498,17 +1498,17 @@ EditorBase::InsertNode(nsIContent& aCont
 
   AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
 
   {
     AutoActionListenerArray listeners(mActionListeners);
     for (auto& listener : listeners) {
       listener->WillInsertNode(
                   aContentToInsert.AsDOMNode(),
-                  GetAsDOMNode(aPointToInsert.GetNextSiblingOfChildAtOffset()));
+                  GetAsDOMNode(aPointToInsert.GetNextSiblingOfChild()));
     }
   }
 
   RefPtr<InsertNodeTransaction> transaction =
     CreateTxnForInsertNode(aContentToInsert, aPointToInsert);
   nsresult rv = DoTransaction(transaction);
 
   mRangeUpdater.SelAdjInsertNode(aPointToInsert.GetContainer(),
@@ -1999,17 +1999,17 @@ EditorBase::MoveChildren(nsIContent& aFi
   }
 
   if (NS_WARN_IF(children.LastElement() != &aLastChild)) {
     aError.Throw(NS_ERROR_INVALID_ARG);
     return;
   }
 
   nsCOMPtr<nsINode> newContainer = aPointToInsert.GetContainer();
-  nsCOMPtr<nsIContent> nextNode = aPointToInsert.GetChildAtOffset();
+  nsCOMPtr<nsIContent> nextNode = aPointToInsert.GetChild();
   for (size_t i = children.Length(); i > 0; --i) {
     nsCOMPtr<nsIContent>& child = children[i - 1];
     if (child->GetParentNode() != oldContainer) {
       // If the child has been moved to different container, we shouldn't
       // touch it.
       continue;
     }
     oldContainer->RemoveChild(*child, aError);
@@ -2617,17 +2617,17 @@ EditorBase::FindBetterInsertionPoint(con
 
     // In some other cases, aNode is the anonymous DIV, and offset points to the
     // terminating mozBR.  In that case, we'll adjust aInOutNode and
     // aInOutOffset to the preceding text node, if any.
     if (!aPoint.IsStartOfContainer()) {
       if (AsHTMLEditor()) {
         // Fall back to a slow path that uses GetChildAt() for Thunderbird's
         // plaintext editor.
-        nsIContent* child = aPoint.GetPreviousSiblingOfChildAtOffset();
+        nsIContent* child = aPoint.GetPreviousSiblingOfChild();
         if (child && child->IsNodeOfType(nsINode::eTEXT)) {
           if (NS_WARN_IF(child->Length() > INT32_MAX)) {
             return aPoint;
           }
           return EditorRawDOMPoint(child, child->Length());
         }
       } else {
         // If we're in a real plaintext editor, use a fast path that avoids
@@ -2703,21 +2703,21 @@ EditorBase::InsertTextImpl(nsIDocument& 
   // element.  Let's try to look for better insertion point in the nearest
   // text node if there is.
   EditorRawDOMPoint pointToInsert = FindBetterInsertionPoint(aPointToInsert);
 
   // If a neighboring text node already exists, use that
   if (!pointToInsert.IsInTextNode()) {
     nsIContent* child = nullptr;
     if (!pointToInsert.IsStartOfContainer() &&
-        (child = pointToInsert.GetPreviousSiblingOfChildAtOffset()) &&
+        (child = pointToInsert.GetPreviousSiblingOfChild()) &&
         child->IsNodeOfType(nsINode::eTEXT)) {
       pointToInsert.Set(child, child->Length());
     } else if (!pointToInsert.IsEndOfContainer() &&
-               (child = pointToInsert.GetChildAtOffset()) &&
+               (child = pointToInsert.GetChild()) &&
                child->IsNodeOfType(nsINode::eTEXT)) {
       pointToInsert.Set(child, 0);
     }
   }
 
   if (ShouldHandleIMEComposition()) {
     CheckedInt<int32_t> newOffset;
     if (!pointToInsert.IsInTextNode()) {
@@ -3147,17 +3147,17 @@ EditorBase::SplitNodeImpl(const EditorDO
 
   nsCOMPtr<nsINode> parent = aStartOfRightNode.GetContainer()->GetParentNode();
   if (NS_WARN_IF(!parent)) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   // Fix the child before mutation observer may touch the DOM tree.
-  nsIContent* firstChildOfRightNode = aStartOfRightNode.GetChildAtOffset();
+  nsIContent* firstChildOfRightNode = aStartOfRightNode.GetChild();
   parent->InsertBefore(aNewLeftNode, aStartOfRightNode.GetContainer(),
                        aError);
   if (NS_WARN_IF(aError.Failed())) {
     return;
   }
 
   // At this point, the existing right node has all the children.  Move all
   // the children which are before aStartOfRightNode.
@@ -3544,18 +3544,18 @@ EditorBase::GetPreviousNodeInternal(cons
       // If we aren't allowed to cross blocks, don't look before this block.
       return nullptr;
     }
     return GetPreviousNodeInternal(*aPoint.GetContainer(),
                                    aFindEditableNode, aNoBlockCrossing);
   }
 
   // else look before the child at 'aOffset'
-  if (aPoint.GetChildAtOffset()) {
-    return GetPreviousNodeInternal(*aPoint.GetChildAtOffset(),
+  if (aPoint.GetChild()) {
+    return GetPreviousNodeInternal(*aPoint.GetChild(),
                                    aFindEditableNode, aNoBlockCrossing);
   }
 
   // unless there isn't one, in which case we are at the end of the node
   // and want the deep-right child.
   nsIContent* rightMostNode =
     GetRightmostChild(aPoint.GetContainer(), aNoBlockCrossing);
   if (!rightMostNode) {
@@ -3598,26 +3598,25 @@ EditorBase::GetNextNodeInternal(const Ed
   if (point.IsInTextNode()) {
     point.Set(point.GetContainer());
     bool advanced = point.AdvanceOffset();
     if (NS_WARN_IF(!advanced)) {
       return nullptr;
     }
   }
 
-  // look at the child at 'aOffset'
-  if (point.GetChildAtOffset()) {
-    if (aNoBlockCrossing && IsBlockNode(point.GetChildAtOffset())) {
-      return point.GetChildAtOffset();
+  if (point.GetChild()) {
+    if (aNoBlockCrossing && IsBlockNode(point.GetChild())) {
+      return point.GetChild();
     }
 
     nsIContent* leftMostNode =
-      GetLeftmostChild(point.GetChildAtOffset(), aNoBlockCrossing);
+      GetLeftmostChild(point.GetChild(), aNoBlockCrossing);
     if (!leftMostNode) {
-      return point.GetChildAtOffset();
+      return point.GetChild();
     }
 
     if (!IsDescendantOfEditorRoot(leftMostNode)) {
       return nullptr;
     }
 
     if (!aFindEditableNode || IsEditable(leftMostNode)) {
       return leftMostNode;
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -393,49 +393,49 @@ public:
   SplitNode(const EditorRawDOMPoint& aStartOfRightNode,
             ErrorResult& aResult);
 
   nsresult JoinNodes(nsINode& aLeftNode, nsINode& aRightNode);
   nsresult MoveNode(nsIContent* aNode, nsINode* aParent, int32_t aOffset);
 
   /**
    * MoveAllChildren() moves all children of aContainer to before
-   * aPointToInsert.GetChildAtOffset().
+   * aPointToInsert.GetChild().
    * See explanation of MoveChildren() for the detail of the behavior.
    *
    * @param aContainer          The container node whose all children should
    *                            be moved.
    * @param aPointToInsert      The insertion point.  The container must not
    *                            be a data node like a text node.
    * @param aError              The result.  If this succeeds to move children,
    *                            returns NS_OK.  Otherwise, an error.
    */
   void MoveAllChildren(nsINode& aContainer,
                        const EditorRawDOMPoint& aPointToInsert,
                        ErrorResult& aError);
 
   /**
    * MovePreviousSiblings() moves all siblings before aChild (i.e., aChild
-   * won't be moved) to before aPointToInsert.GetChildAtOffset().
+   * won't be moved) to before aPointToInsert.GetChild().
    * See explanation of MoveChildren() for the detail of the behavior.
    *
    * @param aChild              The node which is next sibling of the last
    *                            node to be moved.
    * @param aPointToInsert      The insertion point.  The container must not
    *                            be a data node like a text node.
    * @param aError              The result.  If this succeeds to move children,
    *                            returns NS_OK.  Otherwise, an error.
    */
   void MovePreviousSiblings(nsIContent& aChild,
                             const EditorRawDOMPoint& aPointToInsert,
                             ErrorResult& aError);
 
   /**
    * MoveChildren() moves all children between aFirstChild and aLastChild to
-   * before aPointToInsert.GetChildAtOffset().
+   * before aPointToInsert.GetChild().
    * If some children are moved to different container while this method
    * moves other children, they are just ignored.
    * If the child node referred by aPointToInsert is moved to different
    * container while this method moves children, returns error.
    *
    * @param aFirstChild         The first child which should be moved to
    *                            aPointToInsert.
    * @param aLastChild          The last child which should be moved.  This
@@ -969,17 +969,17 @@ public:
    * }
    *
    * Following code must be you expected:
    *
    * while (nsIContent* content = GetNextEditableNode(point)) {
    *   // Do something...
    *   DebugOnly<bool> advanced = point.Advanced();
    *   MOZ_ASSERT(advanced);
-   *   point.Set(point.GetChildAtOffset());
+   *   point.Set(point.GetChild());
    * }
    *
    * On the other hand, the methods taking nsINode behavior must be what
    * you want.  They start to search the result from next node of the given
    * node.
    */
   nsIContent* GetNextNode(const EditorRawDOMPoint& aPoint)
   {
--- a/editor/libeditor/EditorDOMPoint.h
+++ b/editor/libeditor/EditorDOMPoint.h
@@ -34,35 +34,34 @@ class EditorDOMPointBase;
  * changing DOM tree since increasing refcount may appear in micro benchmark
  * if it's in a hot path.  On the other hand, if you need to refer them even
  * after changing DOM tree, you must use EditorDOMPoint.
  *
  * When initializing an instance only with child node or offset,  the instance
  * starts to refer the child node or offset in the container.  In this case,
  * the other information hasn't been initialized due to performance reason.
  * When you retrieve the other information with calling Offset() or
- * GetChildAtOffset(), the other information is computed with the current
- * DOM tree.  Therefore, e.g., in the following case, the other information
- * may be different:
+ * GetChild(), the other information is computed with the current DOM tree.
+ * Therefore, e.g., in the following case, the other information may be
+ * different:
  *
  * EditorDOMPoint pointA(container1, childNode1);
  * EditorDOMPoint pointB(container1, childNode1);
  * Unused << pointA.Offset(); // The offset is computed now.
  * container1->RemoveChild(childNode1->GetPreviousSibling());
  * Unused << pointB.Offset(); // Now, pointB.Offset() equals pointA.Offset() - 1
  *
  * similarly:
  *
  * EditorDOMPoint pointA(container1, 5);
  * EditorDOMPoint pointB(container1, 5);
- * Unused << pointA.GetChildAtOffset(); // The child is computed now.
+ * Unused << pointA.GetChild(); // The child is computed now.
  * container1->RemoveChild(childNode1->GetFirstChild());
- * Unused << pointB.GetChildAtOffset(); // Now, pointB.GetChildAtOffset() equals
- *                                      // pointA.GetChildAtOffset()->
- *                                      //          GetPreviousSibling().
+ * Unused << pointB.GetChild(); // Now, pointB.GetChild() equals
+ *                              // pointA.GetChild()->GetPreviousSibling().
  *
  * So, when you initialize an instance only with one information, you need to
  * be careful when you access the other information after changing the DOM tree.
  * When you need to lock the child node or offset and recompute the other
  * information with new DOM tree, you can use
  * AutoEditorDOMPointOffsetInvalidator and AutoEditorDOMPointChildInvalidator.
  */
 
@@ -250,37 +249,44 @@ public:
    */
   template<typename First, typename... Args>
   bool
   IsContainerAnyOfHTMLElements(First aFirst, Args... aArgs) const
   {
     return mParent && mParent->IsAnyOfHTMLElements(aFirst, aArgs...);
   }
 
+  /**
+   * GetChild() returns a child node which is pointed by the instance.
+   * If mChild hasn't been initialized yet, this computes the child node
+   * from mParent and mOffset with *current* DOM tree.
+   */
   nsIContent*
-  GetChildAtOffset() const
+  GetChild() const
   {
     if (!mParent || !mParent->IsContainerNode()) {
       return nullptr;
     }
     if (mIsChildInitialized) {
       return mChild;
     }
     // Fix child node now.
     const_cast<SelfType*>(this)->EnsureChild();
     return mChild;
   }
 
   /**
-   * GetNextSiblingOfChildOffset() returns next sibling of a child at offset.
+   * GetNextSiblingOfChild() returns next sibling of the child node.
    * If this refers after the last child or the container cannot have children,
    * this returns nullptr with warning.
+   * If mChild hasn't been initialized yet, this computes the child node
+   * from mParent and mOffset with *current* DOM tree.
    */
   nsIContent*
-  GetNextSiblingOfChildAtOffset() const
+  GetNextSiblingOfChild() const
   {
     if (NS_WARN_IF(!mParent) || NS_WARN_IF(!mParent->IsContainerNode())) {
       return nullptr;
     }
     if (mIsChildInitialized) {
       return mChild ? mChild->GetNextSibling() : nullptr;
     }
     MOZ_ASSERT(mOffset.isSome());
@@ -290,22 +296,24 @@ public:
       return nullptr;
     }
     // Fix child node now.
     const_cast<SelfType*>(this)->EnsureChild();
     return mChild ? mChild->GetNextSibling() : nullptr;
   }
 
   /**
-   * GetPreviousSiblingOfChildAtOffset() returns previous sibling of a child
+   * GetPreviousSiblingOfChild() returns previous sibling of a child
    * at offset.  If this refers the first child or the container cannot have
    * children, this returns nullptr with warning.
+   * If mChild hasn't been initialized yet, this computes the child node
+   * from mParent and mOffset with *current* DOM tree.
    */
   nsIContent*
-  GetPreviousSiblingOfChildAtOffset() const
+  GetPreviousSiblingOfChild() const
   {
     if (NS_WARN_IF(!mParent) || NS_WARN_IF(!mParent->IsContainerNode())) {
       return nullptr;
     }
     if (mIsChildInitialized) {
       return mChild ? mChild->GetPreviousSibling() : mParent->GetLastChild();
     }
     MOZ_ASSERT(mOffset.isSome());
@@ -780,17 +788,17 @@ ImplCycleCollectionTraverse(nsCycleColle
 class MOZ_STACK_CLASS AutoEditorDOMPointOffsetInvalidator final
 {
 public:
   explicit AutoEditorDOMPointOffsetInvalidator(EditorDOMPoint& aPoint)
     : mPoint(aPoint)
   {
     MOZ_ASSERT(aPoint.IsSetAndValid());
     MOZ_ASSERT(mPoint.CanContainerHaveChildren());
-    mChild = mPoint.GetChildAtOffset();
+    mChild = mPoint.GetChild();
   }
 
   ~AutoEditorDOMPointOffsetInvalidator()
   {
     InvalidateOffset();
   }
 
   /**
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -171,41 +171,41 @@ public:
 
   /**
    * GetRightNode() simply returns the right node which was split.
    * This won't return nullptr unless failed to split due to invalid arguments.
    */
   nsIContent* GetRightNode() const
   {
     if (mGivenSplitPoint.IsSet()) {
-      return mGivenSplitPoint.GetChildAtOffset();
+      return mGivenSplitPoint.GetChild();
     }
     return mPreviousNode && !mNextNode ? mPreviousNode : mNextNode;
   }
 
   /**
    * GetPreviousNode() returns previous node at the split point.
    */
   nsIContent* GetPreviousNode() const
   {
     if (mGivenSplitPoint.IsSet()) {
       return mGivenSplitPoint.IsEndOfContainer() ?
-               mGivenSplitPoint.GetChildAtOffset() : nullptr;
+               mGivenSplitPoint.GetChild() : nullptr;
     }
     return mPreviousNode;
   }
 
   /**
    * GetNextNode() returns next node at the split point.
    */
   nsIContent* GetNextNode() const
   {
     if (mGivenSplitPoint.IsSet()) {
       return !mGivenSplitPoint.IsEndOfContainer() ?
-                mGivenSplitPoint.GetChildAtOffset() : nullptr;
+                mGivenSplitPoint.GetChild() : nullptr;
     }
     return mNextNode;
   }
 
   /**
    * SplitPoint() returns the split point in the container.
    * This is useful when callers insert an element at split point with
    * EditorBase::CreateNode() or something similar methods.
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -5052,19 +5052,18 @@ HTMLEditRules::WillAlign(Selection& aSel
     nsCOMPtr<nsIContent> brContent =
       htmlEditor->GetNextEditableHTMLNodeInBlock(splitNodeResult.SplitPoint());
     EditorDOMPoint pointToInsertDiv(splitNodeResult.SplitPoint());
     if (brContent && TextEditUtils::IsBreak(brContent)) {
       // Making use of html structure... if next node after where we are
       // putting our div is not a block, then the br we found is in same block
       // we are, so it's safe to consume it.
       nsCOMPtr<nsIContent> sibling;
-      if (pointToInsertDiv.GetChildAtOffset()) {
-        sibling =
-          htmlEditor->GetNextHTMLSibling(pointToInsertDiv.GetChildAtOffset());
+      if (pointToInsertDiv.GetChild()) {
+        sibling = htmlEditor->GetNextHTMLSibling(pointToInsertDiv.GetChild());
       }
       if (sibling && !IsBlockNode(*sibling)) {
         AutoEditorDOMPointChildInvalidator lockOffset(pointToInsertDiv);
         rv = htmlEditor->DeleteNode(brContent);
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
     RefPtr<Element> div =
@@ -7556,17 +7555,17 @@ HTMLEditRules::MaybeSplitAncestorsForIns
   }
 
   // Look for a node that can legally contain the tag.
   EditorRawDOMPoint pointToInsert(aStartOfDeepestRightNode);
   for (; pointToInsert.IsSet();
        pointToInsert.Set(pointToInsert.GetContainer())) {
     // We cannot split active editing host and its ancestor.  So, there is
     // no element to contain the specified element.
-    if (NS_WARN_IF(pointToInsert.GetChildAtOffset() == host)) {
+    if (NS_WARN_IF(pointToInsert.GetChild() == host)) {
       return SplitNodeResult(NS_ERROR_FAILURE);
     }
 
     if (htmlEditor->CanContainTag(*pointToInsert.GetContainer(), aTag)) {
       // Found an ancestor node which can contain the element.
       break;
     }
   }
@@ -7576,17 +7575,17 @@ HTMLEditRules::MaybeSplitAncestorsForIns
   // If the point itself can contain the tag, we don't need to split any
   // ancestor nodes.  In this case, we should return the given split point
   // as is.
   if (pointToInsert.GetContainer() == aStartOfDeepestRightNode.GetContainer()) {
     return SplitNodeResult(aStartOfDeepestRightNode);
   }
 
   SplitNodeResult splitNodeResult =
-    htmlEditor->SplitNodeDeep(*pointToInsert.GetChildAtOffset(),
+    htmlEditor->SplitNodeDeep(*pointToInsert.GetChild(),
                               aStartOfDeepestRightNode,
                               SplitAtEdges::eAllowToCreateEmptyContainer);
   NS_WARNING_ASSERTION(splitNodeResult.Succeeded(),
     "Failed to split the node for insert the element");
   return splitNodeResult;
 }
 
 /**
@@ -7982,31 +7981,29 @@ HTMLEditRules::CheckInterlinePosition(Se
   nsCOMPtr<nsIContent> node =
     htmlEditor->GetPreviousEditableHTMLNodeInBlock(atStartOfSelection.AsRaw());
   if (node && node->IsHTMLElement(nsGkAtoms::br)) {
     aSelection.SetInterlinePosition(true);
     return;
   }
 
   // Are we after a block?  If so try set caret to following content
-  if (atStartOfSelection.GetChildAtOffset()) {
-    node =
-      htmlEditor->GetPriorHTMLSibling(atStartOfSelection.GetChildAtOffset());
+  if (atStartOfSelection.GetChild()) {
+    node = htmlEditor->GetPriorHTMLSibling(atStartOfSelection.GetChild());
   } else {
     node = nullptr;
   }
   if (node && IsBlockNode(*node)) {
     aSelection.SetInterlinePosition(true);
     return;
   }
 
   // Are we before a block?  If so try set caret to prior content
-  if (atStartOfSelection.GetChildAtOffset()) {
-    node =
-      htmlEditor->GetNextHTMLSibling(atStartOfSelection.GetChildAtOffset());
+  if (atStartOfSelection.GetChild()) {
+    node = htmlEditor->GetNextHTMLSibling(atStartOfSelection.GetChild());
   } else {
     node = nullptr;
   }
   if (node && IsBlockNode(*node)) {
     aSelection.SetInterlinePosition(false);
   }
 }
 
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -1550,19 +1550,19 @@ HTMLEditor::InsertNodeIntoProperAncestor
       // where we were originally asked.
       pointToInsert = aPointToInsert;
       break;
     }
   }
 
   if (pointToInsert != aPointToInsert) {
     // We need to split some levels above the original selection parent.
-    MOZ_ASSERT(pointToInsert.GetChildAtOffset());
+    MOZ_ASSERT(pointToInsert.GetChild());
     SplitNodeResult splitNodeResult =
-      SplitNodeDeep(*pointToInsert.GetChildAtOffset(),
+      SplitNodeDeep(*pointToInsert.GetChild(),
                     aPointToInsert, aSplitAtEdges);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return EditorDOMPoint();
     }
     pointToInsert = splitNodeResult.SplitPoint();
     MOZ_ASSERT(pointToInsert.IsSet());
   }
 
@@ -1938,17 +1938,17 @@ HTMLEditor::MakeOrChangeList(const nsASt
           NS_WARN_IF(!pointToInsertList.GetContainerAsContent())) {
         return NS_ERROR_FAILURE;
       }
     }
 
     if (pointToInsertList.GetContainer() != atStartOfSelection.GetContainer()) {
       // We need to split up to the child of parent.
       SplitNodeResult splitNodeResult =
-        SplitNodeDeep(*pointToInsertList.GetChildAtOffset(),
+        SplitNodeDeep(*pointToInsertList.GetChild(),
                       atStartOfSelection,
                       SplitAtEdges::eAllowToCreateEmptyContainer);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       pointToInsertList = splitNodeResult.SplitPoint();
       if (NS_WARN_IF(!pointToInsertList.IsSet())) {
         return NS_ERROR_FAILURE;
@@ -2088,17 +2088,17 @@ HTMLEditor::InsertBasicBlock(const nsASt
         return NS_ERROR_FAILURE;
       }
     }
 
     if (pointToInsertBlock.GetContainer() !=
           atStartOfSelection.GetContainer()) {
       // We need to split up to the child of the point to insert a block.
       SplitNodeResult splitBlockResult =
-        SplitNodeDeep(*pointToInsertBlock.GetChildAtOffset(),
+        SplitNodeDeep(*pointToInsertBlock.GetChild(),
                       atStartOfSelection,
                       SplitAtEdges::eAllowToCreateEmptyContainer);
       if (NS_WARN_IF(splitBlockResult.Failed())) {
         return splitBlockResult.Rv();
       }
       pointToInsertBlock = splitBlockResult.SplitPoint();
       if (NS_WARN_IF(!pointToInsertBlock.IsSet())) {
         return NS_ERROR_FAILURE;
@@ -2171,17 +2171,17 @@ HTMLEditor::Indent(const nsAString& aInd
         return NS_ERROR_FAILURE;
       }
     }
 
     if (pointToInsertBlockquote.GetContainer() !=
           atStartOfSelection.GetContainer()) {
       // We need to split up to the child of parent.
       SplitNodeResult splitBlockquoteResult =
-        SplitNodeDeep(*pointToInsertBlockquote.GetChildAtOffset(),
+        SplitNodeDeep(*pointToInsertBlockquote.GetChild(),
                       atStartOfSelection,
                       SplitAtEdges::eAllowToCreateEmptyContainer);
       if (NS_WARN_IF(splitBlockquoteResult.Failed())) {
         return splitBlockquoteResult.Rv();
       }
       pointToInsertBlockquote = splitBlockquoteResult.SplitPoint();
       if (NS_WARN_IF(!pointToInsertBlockquote.IsSet())) {
         return NS_ERROR_FAILURE;
@@ -2251,17 +2251,17 @@ HTMLEditor::GetElementOrParentByTagName(
     const EditorDOMPoint atAnchor(selection->AnchorRef());
     if (NS_WARN_IF(!atAnchor.IsSet())) {
       return nullptr;
     }
 
     // Try to get the actual selected node
     if (atAnchor.GetContainer()->HasChildNodes() &&
         atAnchor.GetContainerAsContent()) {
-      node = atAnchor.GetChildAtOffset();
+      node = atAnchor.GetChild();
     }
     // Anchor node is probably a text node - just use that
     if (!node) {
       node = atAnchor.GetContainer();
     }
   }
 
   nsCOMPtr<Element> current;
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -418,17 +418,17 @@ HTMLEditor::DoInsertHTMLWithContext(cons
     // don't orphan partial list or table structure
     if (highWaterMark >= 0) {
       ReplaceOrphanedStructure(StartOrEnd::end, nodeList,
                                endListAndTableArray, highWaterMark);
     }
 
     MOZ_ASSERT(pointToInsert.GetContainer()->
                                GetChildAt(pointToInsert.Offset()) ==
-                 pointToInsert.GetChildAtOffset());
+                 pointToInsert.GetChild());
 
     // Loop over the node list and paste the nodes:
     nsCOMPtr<nsINode> parentBlock =
       IsBlockNode(pointToInsert.GetContainer()) ?
         pointToInsert.GetContainer() :
         GetBlockNodeParent(pointToInsert.GetContainer());
     nsCOMPtr<nsIContent> lastInsertNode;
     nsCOMPtr<nsINode> insertedContextParent;
--- a/editor/libeditor/InsertNodeTransaction.cpp
+++ b/editor/libeditor/InsertNodeTransaction.cpp
@@ -27,17 +27,17 @@ InsertNodeTransaction::InsertNodeTransac
                          nsIContent& aContentToInsert,
                          const EditorRawDOMPoint& aPointToInsert)
   : mContentToInsert(&aContentToInsert)
   , mPointToInsert(aPointToInsert)
   , mEditorBase(&aEditorBase)
 {
   MOZ_ASSERT(mPointToInsert.IsSetAndValid());
   // Ensure mPointToInsert stores child at offset.
-  Unused << mPointToInsert.GetChildAtOffset();
+  Unused << mPointToInsert.GetChild();
 }
 
 InsertNodeTransaction::~InsertNodeTransaction()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(InsertNodeTransaction, EditTransactionBase,
                                    mEditorBase,
@@ -56,18 +56,18 @@ InsertNodeTransaction::DoTransaction()
       NS_WARN_IF(!mContentToInsert) ||
       NS_WARN_IF(!mPointToInsert.IsSet())) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   if (!mPointToInsert.IsSetAndValid()) {
     // It seems that DOM tree has been changed after first DoTransaction()
     // and current RedoTranaction() call.
-    if (mPointToInsert.GetChildAtOffset()) {
-      EditorDOMPoint newPointToInsert(mPointToInsert.GetChildAtOffset());
+    if (mPointToInsert.GetChild()) {
+      EditorDOMPoint newPointToInsert(mPointToInsert.GetChild());
       if (!newPointToInsert.IsSet()) {
         // The insertion point has been removed from the DOM tree.
         // In this case, we should append the node to the container instead.
         newPointToInsert.SetToEndOf(mPointToInsert.GetContainer());
         if (NS_WARN_IF(!newPointToInsert.IsSet())) {
           return NS_ERROR_FAILURE;
         }
       }
@@ -79,17 +79,17 @@ InsertNodeTransaction::DoTransaction()
       }
     }
   }
 
   mEditorBase->MarkNodeDirty(GetAsDOMNode(mContentToInsert));
 
   ErrorResult error;
   mPointToInsert.GetContainer()->InsertBefore(*mContentToInsert,
-                                              mPointToInsert.GetChildAtOffset(),
+                                              mPointToInsert.GetChild(),
                                               error);
   error.WouldReportJSException();
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
 
   // Only set selection to insertion point if editor gives permission
   if (mEditorBase->GetShouldTxnSetSelection()) {
--- a/editor/libeditor/SplitNodeTransaction.cpp
+++ b/editor/libeditor/SplitNodeTransaction.cpp
@@ -141,17 +141,17 @@ SplitNodeTransaction::RedoTransaction()
       return rv;
     }
   } else {
     nsCOMPtr<nsIContent> child =
       mStartOfRightNode.GetContainer()->GetFirstChild();
     nsCOMPtr<nsIContent> nextSibling;
     for (uint32_t i = 0; i < mStartOfRightNode.Offset(); i++) {
       // XXX This must be bad behavior.  Perhaps, we should work with
-      //     mStartOfRightNode::GetChildAtOffset().  Even if some children
+      //     mStartOfRightNode::GetChild().  Even if some children
       //     before the right node have been inserted or removed, we should
       //     move all children before the right node because user must focus
       //     on the right node, so, it must be the expected behavior.
       if (NS_WARN_IF(!child)) {
         return NS_ERROR_NULL_POINTER;
       }
       nextSibling = child->GetNextSibling();
       ErrorResult error;
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -777,19 +777,19 @@ TextEditRules::WillInsertText(EditAction
 
     if (pointAfterStringInserted.IsSet()) {
       // Make the caret attach to the inserted text, unless this text ends with a LF,
       // in which case make the caret attach to the next line.
       bool endsWithLF =
         !outString->IsEmpty() && outString->Last() == nsCRT::LF;
       aSelection->SetInterlinePosition(endsWithLF);
 
-      MOZ_ASSERT(!pointAfterStringInserted.GetChildAtOffset(),
+      MOZ_ASSERT(!pointAfterStringInserted.GetChild(),
         "After inserting text into a text node, pointAfterStringInserted."
-        "GetChildAtOffset() should be nullptr");
+        "GetChild() should be nullptr");
       IgnoredErrorResult error;
       aSelection->Collapse(pointAfterStringInserted, error);
       if (error.Failed()) {
         NS_WARNING("Failed to collapse selection after inserting string");
       }
     }
   }
   ASSERT_PASSWORD_LENGTHS_EQUAL()
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -780,19 +780,19 @@ TextEditor::InsertLineBreak()
     EditorRawDOMPoint pointAfterInsertedLineBreak;
     rv = InsertTextImpl(*doc, NS_LITERAL_STRING("\n"), pointToInsert,
                         &pointAfterInsertedLineBreak);
     if (NS_WARN_IF(!pointAfterInsertedLineBreak.IsSet())) {
       rv = NS_ERROR_NULL_POINTER; // don't return here, so DidDoAction is called
     }
     if (NS_SUCCEEDED(rv)) {
       // set the selection to the correct location
-      MOZ_ASSERT(!pointAfterInsertedLineBreak.GetChildAtOffset(),
+      MOZ_ASSERT(!pointAfterInsertedLineBreak.GetChild(),
         "After inserting text into a text node, pointAfterInsertedLineBreak."
-        "GetChildAtOffset() should be nullptr");
+        "GetChild() should be nullptr");
       rv = selection->Collapse(pointAfterInsertedLineBreak);
       if (NS_SUCCEEDED(rv)) {
         // see if we're at the end of the editor range
         EditorRawDOMPoint endPoint = GetEndPoint(selection);
         if (endPoint == pointAfterInsertedLineBreak) {
           // SetInterlinePosition(true) means we want the caret to stick to the
           // content on the "right".  We want the caret to stick to whatever is
           // past the break.  This is because the break is on the same line we
--- a/editor/libeditor/WSRunObject.cpp
+++ b/editor/libeditor/WSRunObject.cpp
@@ -1091,17 +1091,17 @@ WSRunObject::GetPreviousWSNode(const Edi
     // We are at start of non-block container
     return GetPreviousWSNodeInner(aPoint.GetContainer(), aBlockParent);
   }
 
   if (NS_WARN_IF(!aPoint.GetContainerAsContent())) {
     return nullptr;
   }
 
-  nsCOMPtr<nsIContent> priorNode = aPoint.GetPreviousSiblingOfChildAtOffset();
+  nsCOMPtr<nsIContent> priorNode = aPoint.GetPreviousSiblingOfChild();
   if (NS_WARN_IF(!priorNode)) {
     return nullptr;
   }
 
   // We have a prior node.  If it's a block, return it.
   if (IsBlockNode(priorNode)) {
     return priorNode;
   }
@@ -1170,17 +1170,17 @@ WSRunObject::GetNextWSNode(const EditorD
   if (!mHTMLEditor->IsContainer(aPoint.GetContainer())) {
     return GetNextWSNodeInner(aPoint.GetContainer(), aBlockParent);
   }
 
   if (NS_WARN_IF(!aPoint.GetContainerAsContent())) {
     return nullptr;
   }
 
-  nsCOMPtr<nsIContent> nextNode = aPoint.GetChildAtOffset();
+  nsCOMPtr<nsIContent> nextNode = aPoint.GetChild();
   if (!nextNode) {
     if (aPoint.GetContainer() == aBlockParent) {
       // We are at end of the block.
       return nullptr;
     }
 
     // We are at end of non-block container
     return GetNextWSNodeInner(aPoint.GetContainer(), aBlockParent);