Bug 1451672 - part 3: Rename EditorBase::SplitNode() and related methods to ending with "WithTransaction" r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 10 Apr 2018 02:16:49 +0900
changeset 786086 f6b7456eb2df85c8fd2601aeb480e9ada9491c28
parent 786085 9a90e0b804f29c52134daeffe56760ad862100a5
child 786087 7353775dea5561e0ee37aeb6f324a5f428e4c085
push id107393
push usermasayuki@d-toybox.com
push dateSat, 21 Apr 2018 04:40:12 +0000
reviewersm_kato
bugs1451672
milestone61.0a1
Bug 1451672 - part 3: Rename EditorBase::SplitNode() and related methods to ending with "WithTransaction" r?m_kato This patch renames: EditorBase::SplitNode() -> EditorBase::SplitNodeWithTransaction() EditorBase::SplitNodeDeep() -> EditorBase::SplitNodeDeepWithTransaction() HTMLEditRules::MaybeSplitAncestorsForInsert() -> HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction() Note it might be that some callers of those methods should be renamed too. However, we should do it in follow up bug after landing those patches since we can investigate it with searchfox.org after landing patches. MozReview-Commit-ID: FfxCfaI85z5
editor/libeditor/EditorBase.cpp
editor/libeditor/EditorBase.h
editor/libeditor/EditorUtils.h
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLEditRules.h
editor/libeditor/HTMLEditor.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/HTMLStyleEditor.cpp
editor/libeditor/TextEditor.cpp
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -129,29 +129,31 @@ EditorBase::CreateNodeWithTransaction(ns
                                       const EditorRawDOMPoint& aPointToInsert);
 template nsresult
 EditorBase::InsertNodeWithTransaction(nsIContent& aContentToInsert,
                                       const EditorDOMPoint& aPointToInsert);
 template nsresult
 EditorBase::InsertNodeWithTransaction(nsIContent& aContentToInsert,
                                       const EditorRawDOMPoint& aPointToInsert);
 template already_AddRefed<nsIContent>
-EditorBase::SplitNode(const EditorDOMPoint& aStartOfRightNode,
-                      ErrorResult& aError);
+EditorBase::SplitNodeWithTransaction(const EditorDOMPoint& aStartOfRightNode,
+                                     ErrorResult& aError);
 template already_AddRefed<nsIContent>
-EditorBase::SplitNode(const EditorRawDOMPoint& aStartOfRightNode,
-                      ErrorResult& aError);
+EditorBase::SplitNodeWithTransaction(const EditorRawDOMPoint& aStartOfRightNode,
+                                     ErrorResult& aError);
 template SplitNodeResult
-EditorBase::SplitNodeDeep(nsIContent& aMostAncestorToSplit,
-                          const EditorDOMPoint& aStartOfDeepestRightNode,
-                          SplitAtEdges aSplitAtEdges);
+EditorBase::SplitNodeDeepWithTransaction(
+              nsIContent& aMostAncestorToSplit,
+              const EditorDOMPoint& aStartOfDeepestRightNode,
+              SplitAtEdges aSplitAtEdges);
 template SplitNodeResult
-EditorBase::SplitNodeDeep(nsIContent& aMostAncestorToSplit,
-                          const EditorRawDOMPoint& aStartOfDeepestRightNode,
-                          SplitAtEdges aSplitAtEdges);
+EditorBase::SplitNodeDeepWithTransaction(
+              nsIContent& aMostAncestorToSplit,
+              const EditorRawDOMPoint& aStartOfDeepestRightNode,
+              SplitAtEdges aSplitAtEdges);
 
 EditorBase::EditorBase()
   : mPlaceholderName(nullptr)
   , mModCount(0)
   , mFlags(0)
   , mUpdateCount(0)
   , mPlaceholderBatch(0)
   , mAction(EditAction::none)
@@ -1463,28 +1465,29 @@ EditorBase::SplitNode(nsIDOMNode* aNode,
   if (NS_WARN_IF(!node)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   int32_t offset = std::min(std::max(aOffset, 0),
                             static_cast<int32_t>(node->Length()));
   ErrorResult error;
   nsCOMPtr<nsIContent> newNode =
-    SplitNode(EditorRawDOMPoint(node, offset), error);
+    SplitNodeWithTransaction(EditorRawDOMPoint(node, offset), error);
   *aNewLeftNode = GetAsDOMNode(newNode.forget().take());
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
   return NS_OK;
 }
 
 template<typename PT, typename CT>
 already_AddRefed<nsIContent>
-EditorBase::SplitNode(const EditorDOMPointBase<PT, CT>& aStartOfRightNode,
-                      ErrorResult& aError)
+EditorBase::SplitNodeWithTransaction(
+              const EditorDOMPointBase<PT, CT>& aStartOfRightNode,
+              ErrorResult& aError)
 {
   if (NS_WARN_IF(!aStartOfRightNode.IsSet()) ||
       NS_WARN_IF(!aStartOfRightNode.GetContainerAsContent())) {
     aError.Throw(NS_ERROR_INVALID_ARG);
     return nullptr;
   }
   MOZ_ASSERT(aStartOfRightNode.IsSetAndValid());
 
@@ -4054,17 +4057,17 @@ EditorBase::IsPreformatted(nsINode* aNod
 
   const nsStyleText* styleText = elementStyle->StyleText();
 
   return styleText->WhiteSpaceIsSignificant();
 }
 
 template<typename PT, typename CT>
 SplitNodeResult
-EditorBase::SplitNodeDeep(
+EditorBase::SplitNodeDeepWithTransaction(
               nsIContent& aMostAncestorToSplit,
               const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode,
               SplitAtEdges aSplitAtEdges)
 {
   MOZ_ASSERT(aStartOfDeepestRightNode.IsSetAndValid());
   MOZ_ASSERT(aStartOfDeepestRightNode.GetContainer() == &aMostAncestorToSplit ||
              EditorUtils::IsDescendantOf(
                             *aStartOfDeepestRightNode.GetContainer(),
@@ -4096,17 +4099,18 @@ EditorBase::SplitNodeDeep(
 
     // If the split point is middle of the node or the node is not a text node
     // and we're allowed to create empty element node, split it.
     if ((aSplitAtEdges == SplitAtEdges::eAllowToCreateEmptyContainer &&
          !atStartOfRightNode.GetContainerAsText()) ||
         (!atStartOfRightNode.IsStartOfContainer() &&
          !atStartOfRightNode.IsEndOfContainer())) {
       ErrorResult error;
-      nsCOMPtr<nsIContent> newLeftNode = SplitNode(atStartOfRightNode, error);
+      nsCOMPtr<nsIContent> newLeftNode =
+        SplitNodeWithTransaction(atStartOfRightNode, error);
       if (NS_WARN_IF(error.Failed())) {
         return SplitNodeResult(error.StealNSResult());
       }
 
       if (currentRightNode == &aMostAncestorToSplit) {
         // Actually, we split aMostAncestorToSplit.
         return SplitNodeResult(newLeftNode, &aMostAncestorToSplit);
       }
@@ -4445,17 +4449,17 @@ EditorBase::DeleteSelectionAndPrepareToC
     selection->Collapse(afterAnchorContainer, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
     return NS_OK;
   }
 
   ErrorResult error;
-  nsCOMPtr<nsIContent> newLeftNode = SplitNode(atAnchor, error);
+  nsCOMPtr<nsIContent> newLeftNode = SplitNodeWithTransaction(atAnchor, error);
   if (NS_WARN_IF(error.Failed())) {
     return error.StealNSResult();
   }
 
   EditorRawDOMPoint atRightNode(atAnchor.GetContainer());
   if (NS_WARN_IF(!atRightNode.IsSet())) {
     return NS_ERROR_FAILURE;
   }
--- a/editor/libeditor/EditorBase.h
+++ b/editor/libeditor/EditorBase.h
@@ -161,29 +161,30 @@ private:
   nsWeakPtr mWeakPtr;
   T* MOZ_NON_OWNING_REF mCache;
 };
 
 #define kMOZEditorBogusNodeAttrAtom nsGkAtoms::mozeditorbogusnode
 #define kMOZEditorBogusNodeValue NS_LITERAL_STRING("TRUE")
 
 /**
- * SplitAtEdges is for EditorBase::SplitNodeDeep(),
+ * SplitAtEdges is for EditorBase::SplitNodeDeepWithTransaction(),
  * HTMLEditor::InsertNodeAtPoint()
  */
 enum class SplitAtEdges
 {
-  // EditorBase::SplitNodeDeep() won't split container element nodes at
-  // their edges.  I.e., when split point is start or end of container,
-  // it won't be split.
+  // EditorBase::SplitNodeDeepWithTransaction() won't split container element
+  // nodes at their edges.  I.e., when split point is start or end of
+  // container, it won't be split.
   eDoNotCreateEmptyContainer,
-  // EditorBase::SplitNodeDeep() always splits containers even if the split
-  // point is at edge of a container.  E.g., if split point is start of an
-  // inline element, empty inline element is created as a new left node.
-  eAllowToCreateEmptyContainer
+  // EditorBase::SplitNodeDeepWithTransaction() always splits containers even
+  // if the split point is at edge of a container.  E.g., if split point is
+  // start of an inline element, empty inline element is created as a new left
+  // node.
+  eAllowToCreateEmptyContainer,
 };
 
 /**
  * Implementation of an editor object.  it will be the controller/focal point
  * for the main editor services. i.e. the GUIManager, publishing, transaction
  * manager, event interfaces. the idea for the event interfaces is to have them
  * delegate the actual commands to the editor independent of the XPFE
  * implementation.
@@ -366,31 +367,32 @@ public:
   nsresult RemoveContainer(nsIContent* aNode);
   already_AddRefed<Element> InsertContainerAbove(nsIContent* aNode,
                                                  nsAtom* aNodeType,
                                                  nsAtom* aAttribute = nullptr,
                                                  const nsAString* aValue =
                                                  nullptr);
 
   /**
-   * SplitNode() creates a transaction to create a new node (left node)
-   * identical to an existing node (right node), and split the contents
-   * between the same point in both nodes, then, execute the transaction.
+   * SplitNodeWithTransaction() creates a transaction to create a new node
+   * (left node) identical to an existing node (right node), and split the
+   * contents between the same point in both nodes, then, execute the
+   * transaction.
    *
    * @param aStartOfRightNode   The point to split.  Its container will be
    *                            the right node, i.e., become the new node's
    *                            next sibling.  And the point will be start
    *                            of the right node.
    * @param aError              If succeed, returns no error.  Otherwise, an
    *                            error.
    */
   template<typename PT, typename CT>
   already_AddRefed<nsIContent>
-  SplitNode(const EditorDOMPointBase<PT, CT>& aStartOfRightNode,
-            ErrorResult& aResult);
+  SplitNodeWithTransaction(const EditorDOMPointBase<PT, CT>& 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.GetChild().
    * See explanation of MoveChildren() for the detail of the behavior.
@@ -1245,17 +1247,17 @@ public:
    * When you are using AppendNodeToSelectionAsRange(), call this first to
    * start a new selection.
    */
   nsresult ClearSelection();
 
   static bool IsPreformatted(nsINode* aNode);
 
   /**
-   * SplitNodeDeep() splits aMostAncestorToSplit deeply.
+   * SplitNodeDeepWithTransaction() splits aMostAncestorToSplit deeply.
    *
    * @param aMostAncestorToSplit        The most ancestor node which should be
    *                                    split.
    * @param aStartOfDeepestRightNode    The start point of deepest right node.
    *                                    This point must be descendant of
    *                                    aMostAncestorToSplit.
    * @param aSplitAtEdges               Whether the caller allows this to
    *                                    create empty container element when
@@ -1263,19 +1265,20 @@ public:
    *                                    element.
    * @return                            SplitPoint() returns split point in
    *                                    aMostAncestorToSplit.  The point must
    *                                    be good to insert something if the
    *                                    caller want to do it.
    */
   template<typename PT, typename CT>
   SplitNodeResult
-  SplitNodeDeep(nsIContent& aMostAncestorToSplit,
-                const EditorDOMPointBase<PT, CT>& aDeepestStartOfRightNode,
-                SplitAtEdges aSplitAtEdges);
+  SplitNodeDeepWithTransaction(
+    nsIContent& aMostAncestorToSplit,
+    const EditorDOMPointBase<PT, CT>& aDeepestStartOfRightNode,
+    SplitAtEdges aSplitAtEdges);
 
   EditorDOMPoint JoinNodeDeep(nsIContent& aLeftNode,
                               nsIContent& aRightNode);
 
   nsresult GetString(const nsAString& name, nsAString& value);
 
   void BeginUpdateViewBatch();
   virtual nsresult EndUpdateViewBatch();
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -135,17 +135,18 @@ EditActionHandled(nsresult aRv = NS_OK)
  */
 inline EditActionResult
 EditActionCanceled(nsresult aRv = NS_OK)
 {
   return EditActionResult(aRv, true, true);
 }
 
 /***************************************************************************
- * SplitNodeResult is a simple class for EditorBase::SplitNodeDeep().
+ * SplitNodeResult is a simple class for
+ * EditorBase::SplitNodeDeepWithTransaction().
  * This makes the callers' code easier to read.
  */
 class MOZ_STACK_CLASS SplitNodeResult final
 {
 public:
   bool Succeeded() const { return NS_SUCCEEDED(mRv); }
   bool Failed() const { return NS_FAILED(mRv); }
   nsresult Rv() const { return mRv; }
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -1879,18 +1879,19 @@ HTMLEditRules::InsertBRElement(Selection
     nsCOMPtr<nsINode> linkDOMNode;
     if (htmlEditor->IsInLink(pointToBreak.GetContainer(),
                              address_of(linkDOMNode))) {
       nsCOMPtr<Element> linkNode = do_QueryInterface(linkDOMNode);
       if (NS_WARN_IF(!linkNode)) {
         return NS_ERROR_FAILURE;
       }
       SplitNodeResult splitLinkNodeResult =
-        htmlEditor->SplitNodeDeep(*linkNode, pointToBreak,
-                                  SplitAtEdges::eDoNotCreateEmptyContainer);
+        htmlEditor->SplitNodeDeepWithTransaction(
+                      *linkNode, pointToBreak,
+                      SplitAtEdges::eDoNotCreateEmptyContainer);
       if (NS_WARN_IF(splitLinkNodeResult.Failed())) {
         return splitLinkNodeResult.Rv();
       }
       pointToBreak = splitLinkNodeResult.SplitPoint();
     }
     brElement = wsObj.InsertBreak(aSelection, pointToBreak, nsIEditor::eNone);
     if (NS_WARN_IF(!brElement)) {
       return NS_ERROR_FAILURE;
@@ -2022,18 +2023,19 @@ HTMLEditRules::SplitMailCites(Selection*
       "Failed to advance offset to after the visible node");
   }
 
   if (NS_WARN_IF(!pointToSplit.GetContainerAsContent())) {
     return NS_ERROR_FAILURE;
   }
 
   SplitNodeResult splitCiteNodeResult =
-    htmlEditor->SplitNodeDeep(*citeNode, pointToSplit,
-                              SplitAtEdges::eDoNotCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  *citeNode, pointToSplit,
+                  SplitAtEdges::eDoNotCreateEmptyContainer);
   if (NS_WARN_IF(splitCiteNodeResult.Failed())) {
     return splitCiteNodeResult.Rv();
   }
   pointToSplit.Clear();
 
   // Add an invisible <br> to the end of current cite node (If new left cite
   // has not been created, we're at the end of it.  Otherwise, we're still at
   // the right node) if it was a <span> of style="display: block". This is
@@ -3581,17 +3583,17 @@ HTMLEditRules::WillMakeList(Selection* a
     // Make sure we can put a list here.
     if (!htmlEditor->CanContainTag(*atStartOfSelection.GetContainer(),
                                    listType)) {
       *aCancel = true;
       return NS_OK;
     }
 
     SplitNodeResult splitAtSelectionStartResult =
-      MaybeSplitAncestorsForInsert(listType, atStartOfSelection);
+      MaybeSplitAncestorsForInsertWithTransaction(listType, atStartOfSelection);
     if (NS_WARN_IF(splitAtSelectionStartResult.Failed())) {
       return splitAtSelectionStartResult.Rv();
     }
     RefPtr<Element> theList =
       htmlEditor->CreateNodeWithTransaction(
                     *listType,
                     splitAtSelectionStartResult.SplitPoint());
     if (NS_WARN_IF(!theList)) {
@@ -3692,17 +3694,17 @@ HTMLEditRules::WillMakeList(Selection* a
         // list item is in wrong type of list. if we don't have a curList,
         // split the old list and make a new list of correct type.
         if (!curList || EditorUtils::IsDescendantOf(*curNode, *curList)) {
           if (NS_WARN_IF(!atCurNode.GetContainerAsContent())) {
             return NS_ERROR_FAILURE;
           }
           ErrorResult error;
           nsCOMPtr<nsIContent> newLeftNode =
-            htmlEditor->SplitNode(atCurNode, error);
+            htmlEditor->SplitNodeWithTransaction(atCurNode, error);
           if (NS_WARN_IF(error.Failed())) {
             return error.StealNSResult();
           }
           newBlock = newLeftNode ? newLeftNode->AsElement() : nullptr;
           EditorRawDOMPoint atParentOfCurNode(atCurNode.GetContainer());
           curList = htmlEditor->CreateNodeWithTransaction(*listType,
                                                           atParentOfCurNode);
           if (NS_WARN_IF(!curList)) {
@@ -3760,17 +3762,17 @@ HTMLEditRules::WillMakeList(Selection* a
       NS_ENSURE_SUCCESS(rv, rv);
       listCount = arrayOfNodes.Length();
       continue;
     }
 
     // need to make a list to put things in if we haven't already,
     if (!curList) {
       SplitNodeResult splitCurNodeResult =
-        MaybeSplitAncestorsForInsert(listType, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(listType, atCurNode);
       if (NS_WARN_IF(splitCurNodeResult.Failed())) {
         return splitCurNodeResult.Rv();
       }
       curList =
         htmlEditor->CreateNodeWithTransaction(*listType,
                                               splitCurNodeResult.SplitPoint());
       if (NS_WARN_IF(!curList)) {
         return NS_ERROR_FAILURE;
@@ -3956,18 +3958,19 @@ HTMLEditRules::MakeBasicBlock(Selection&
         htmlEditor->GetNextEditableHTMLNode(pointToInsertBlock);
       if (brNode && brNode->IsHTMLElement(nsGkAtoms::br)) {
         AutoEditorDOMPointChildInvalidator lockOffset(pointToInsertBlock);
         rv = htmlEditor->DeleteNode(brNode);
         NS_ENSURE_SUCCESS(rv, rv);
       }
       // Do the splits!
       SplitNodeResult splitNodeResult =
-        htmlEditor->SplitNodeDeep(*curBlock, pointToInsertBlock,
-                                  SplitAtEdges::eDoNotCreateEmptyContainer);
+        htmlEditor->SplitNodeDeepWithTransaction(
+                      *curBlock, pointToInsertBlock,
+                      SplitAtEdges::eDoNotCreateEmptyContainer);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       EditorRawDOMPoint pointToInsertBrNode(splitNodeResult.SplitPoint());
       // Put a br at the split point
       brNode = htmlEditor->CreateBR(pointToInsertBrNode);
       NS_ENSURE_STATE(brNode);
       // Put selection at the split point
@@ -3989,17 +3992,18 @@ HTMLEditRules::MakeBasicBlock(Selection&
       AutoEditorDOMPointChildInvalidator lockOffset(pointToInsertBlock);
       rv = htmlEditor->DeleteNode(brNode);
       NS_ENSURE_SUCCESS(rv, rv);
       // We don't need to act on this node any more
       arrayOfNodes.RemoveElement(brNode);
     }
     // Make sure we can put a block here.
     SplitNodeResult splitNodeResult =
-      MaybeSplitAncestorsForInsert(blockType, pointToInsertBlock);
+      MaybeSplitAncestorsForInsertWithTransaction(blockType,
+                                                  pointToInsertBlock);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return splitNodeResult.Rv();
     }
     RefPtr<Element> block =
       htmlEditor->CreateNodeWithTransaction(blockType,
                                             splitNodeResult.SplitPoint());
     if (NS_WARN_IF(!block)) {
       return NS_ERROR_FAILURE;
@@ -4141,17 +4145,18 @@ HTMLEditRules::WillCSSIndent(Selection* 
 
     EditorDOMPoint atStartOfSelection(firstRange->StartRef());
     if (NS_WARN_IF(!atStartOfSelection.IsSet())) {
       return NS_ERROR_FAILURE;
     }
 
     // make sure we can put a block here
     SplitNodeResult splitNodeResult =
-      MaybeSplitAncestorsForInsert(*nsGkAtoms::div, atStartOfSelection);
+      MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
+                                                  atStartOfSelection);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return splitNodeResult.Rv();
     }
     RefPtr<Element> theBlock =
       htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                             splitNodeResult.SplitPoint());
     if (NS_WARN_IF(!theBlock)) {
       return NS_ERROR_FAILURE;
@@ -4232,17 +4237,18 @@ HTMLEditRules::WillCSSIndent(Selection* 
         sibling = htmlEditor->GetPriorHTMLSibling(curNode);
       }
 
       if (!curList || (sibling && sibling != curList)) {
         nsAtom* containerName =
           atCurNode.GetContainer()->NodeInfo()->NameAtom();
         // Create a new nested list of correct type.
         SplitNodeResult splitNodeResult =
-          MaybeSplitAncestorsForInsert(*containerName, atCurNode);
+          MaybeSplitAncestorsForInsertWithTransaction(*containerName,
+                                                      atCurNode);
         if (NS_WARN_IF(splitNodeResult.Failed())) {
           return splitNodeResult.Rv();
         }
         curList =
           htmlEditor->CreateNodeWithTransaction(*containerName,
                                                 splitNodeResult.SplitPoint());
         if (NS_WARN_IF(!curList)) {
           return NS_ERROR_FAILURE;
@@ -4270,17 +4276,17 @@ HTMLEditRules::WillCSSIndent(Selection* 
     if (!curQuote) {
       // First, check that our element can contain a div.
       if (!htmlEditor->CanContainTag(*atCurNode.GetContainer(),
                                      *nsGkAtoms::div)) {
         return NS_OK; // cancelled
       }
 
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(*nsGkAtoms::div, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div, atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       curQuote =
         htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!curQuote)) {
         return NS_ERROR_FAILURE;
@@ -4347,18 +4353,18 @@ HTMLEditRules::WillHTMLIndent(Selection*
 
     EditorDOMPoint atStartOfSelection(firstRange->StartRef());
     if (NS_WARN_IF(!atStartOfSelection.IsSet())) {
       return NS_ERROR_FAILURE;
     }
 
     // Make sure we can put a block here.
     SplitNodeResult splitNodeResult =
-      MaybeSplitAncestorsForInsert(*nsGkAtoms::blockquote,
-                                   atStartOfSelection);
+      MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::blockquote,
+                                                  atStartOfSelection);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return splitNodeResult.Rv();
     }
     RefPtr<Element> theBlock =
       htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::blockquote,
                                             splitNodeResult.SplitPoint());
     if (NS_WARN_IF(!theBlock)) {
       return NS_ERROR_FAILURE;
@@ -4438,17 +4444,18 @@ HTMLEditRules::WillHTMLIndent(Selection*
         sibling = htmlEditor->GetPriorHTMLSibling(curNode);
       }
 
       if (!curList || (sibling && sibling != curList)) {
         nsAtom* containerName =
           atCurNode.GetContainer()->NodeInfo()->NameAtom();
         // Create a new nested list of correct type.
         SplitNodeResult splitNodeResult =
-          MaybeSplitAncestorsForInsert(*containerName, atCurNode);
+          MaybeSplitAncestorsForInsertWithTransaction(*containerName,
+                                                      atCurNode);
         if (NS_WARN_IF(splitNodeResult.Failed())) {
           return splitNodeResult.Rv();
         }
         curList =
           htmlEditor->CreateNodeWithTransaction(*containerName,
                                                 splitNodeResult.SplitPoint());
         if (NS_WARN_IF(!curList)) {
           return NS_ERROR_FAILURE;
@@ -4490,17 +4497,18 @@ HTMLEditRules::WillHTMLIndent(Selection*
         EditorDOMPoint atListItem(listItem);
         if (NS_WARN_IF(!listItem)) {
           return NS_ERROR_FAILURE;
         }
         nsAtom* containerName =
           atListItem.GetContainer()->NodeInfo()->NameAtom();
         // Create a new nested list of correct type.
         SplitNodeResult splitNodeResult =
-          MaybeSplitAncestorsForInsert(*containerName, atListItem);
+          MaybeSplitAncestorsForInsertWithTransaction(*containerName,
+                                                      atListItem);
         if (NS_WARN_IF(splitNodeResult.Failed())) {
           return splitNodeResult.Rv();
         }
         curList =
           htmlEditor->CreateNodeWithTransaction(*containerName,
                                                 splitNodeResult.SplitPoint());
         if (NS_WARN_IF(!curList)) {
           return NS_ERROR_FAILURE;
@@ -4527,17 +4535,18 @@ HTMLEditRules::WillHTMLIndent(Selection*
     if (!curQuote) {
       // First, check that our element can contain a blockquote.
       if (!htmlEditor->CanContainTag(*atCurNode.GetContainer(),
                                      *nsGkAtoms::blockquote)) {
         return NS_OK; // cancelled
       }
 
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(*nsGkAtoms::blockquote, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::blockquote,
+                                                    atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       curQuote =
         htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::blockquote,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!curQuote)) {
         return NS_ERROR_FAILURE;
@@ -4836,29 +4845,31 @@ HTMLEditRules::SplitBlock(Element& aBloc
   // aStartChild and aEndChild must be exclusive descendants of aBlock
   MOZ_ASSERT(EditorUtils::IsDescendantOf(aStartChild, aBlock) &&
              EditorUtils::IsDescendantOf(aEndChild, aBlock));
   NS_ENSURE_TRUE_VOID(mHTMLEditor);
   RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
 
   // Split at the start.
   SplitNodeResult splitAtStartResult =
-    htmlEditor->SplitNodeDeep(aBlock, EditorRawDOMPoint(&aStartChild),
-                              SplitAtEdges::eDoNotCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  aBlock, EditorRawDOMPoint(&aStartChild),
+                  SplitAtEdges::eDoNotCreateEmptyContainer);
   NS_WARNING_ASSERTION(splitAtStartResult.Succeeded(),
     "Failed to split aBlock at start");
 
   // Split at after the end
   EditorRawDOMPoint atAfterEnd(&aEndChild);
   DebugOnly<bool> advanced = atAfterEnd.AdvanceOffset();
   NS_WARNING_ASSERTION(advanced,
     "Failed to advance offset after the end node");
   SplitNodeResult splitAtEndResult =
-    htmlEditor->SplitNodeDeep(aBlock, atAfterEnd,
-                              SplitAtEdges::eDoNotCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  aBlock, atAfterEnd,
+                  SplitAtEdges::eDoNotCreateEmptyContainer);
   NS_WARNING_ASSERTION(splitAtEndResult.Succeeded(),
     "Failed to split aBlock at after end");
 
   if (aOutLeftNode) {
     NS_IF_ADDREF(*aOutLeftNode = splitAtStartResult.GetPreviousNode());
   }
 
   if (aOutRightNode) {
@@ -4993,18 +5004,19 @@ HTMLEditRules::CreateStyleForInsertText(
   item = Move(htmlEditor->mTypeInState->TakeSetProperty());
 
   if (item || relFontSize) {
     // we have at least one style to add; make a new text node to insert style
     // nodes above.
     if (RefPtr<Text> text = node->GetAsText()) {
       // if we are in a text node, split it
       SplitNodeResult splitTextNodeResult =
-        htmlEditor->SplitNodeDeep(*text, EditorRawDOMPoint(text, offset),
-                                   SplitAtEdges::eAllowToCreateEmptyContainer);
+        htmlEditor->SplitNodeDeepWithTransaction(
+                       *text, EditorRawDOMPoint(text, offset),
+                       SplitAtEdges::eAllowToCreateEmptyContainer);
       if (NS_WARN_IF(splitTextNodeResult.Failed())) {
         return splitTextNodeResult.Rv();
       }
       EditorRawDOMPoint splitPoint(splitTextNodeResult.SplitPoint());
       node = splitPoint.GetContainer();
       offset = splitPoint.Offset();
     }
     if (!htmlEditor->IsContainer(node)) {
@@ -5140,17 +5152,18 @@ HTMLEditRules::WillAlign(Selection& aSel
     }
 
     EditorDOMPoint atStartOfSelection(firstRange->StartRef());
     if (NS_WARN_IF(!atStartOfSelection.IsSet())) {
       return NS_ERROR_FAILURE;
     }
 
     SplitNodeResult splitNodeResult =
-      MaybeSplitAncestorsForInsert(*nsGkAtoms::div, atStartOfSelection);
+      MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
+                                                  atStartOfSelection);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return splitNodeResult.Rv();
     }
 
     // Consume a trailing br, if any.  This is to keep an alignment from
     // creating extra lines, if possible.
     nsCOMPtr<nsIContent> brContent =
       htmlEditor->GetNextEditableHTMLNodeInBlock(splitNodeResult.SplitPoint());
@@ -5276,17 +5289,17 @@ HTMLEditRules::WillAlign(Selection& aSel
       // First, check that our element can contain a div.
       if (!htmlEditor->CanContainTag(*atCurNode.GetContainer(),
                                      *nsGkAtoms::div)) {
         // Cancelled
         return NS_OK;
       }
 
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(*nsGkAtoms::div, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div, atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       curDiv =
         htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!curDiv)) {
         return NS_ERROR_FAILURE;
@@ -6204,16 +6217,19 @@ public:
 
 private:
   nsTArray<OwningNonNull<nsINode>>& mArray;
 };
 
 /**
  * GetNodesForOperation() runs through the ranges in the array and construct a
  * new array of nodes to be acted on.
+ *
+ * XXX This name stats with "Get" but actually this modifies the DOM tree with
+ *     transaction.  We should rename this to making clearer what this does.
  */
 nsresult
 HTMLEditRules::GetNodesForOperation(
                  nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
                  nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
                  EditAction aOperationType,
                  TouchContent aTouchContent)
 {
@@ -6229,17 +6245,17 @@ HTMLEditRules::GetNodesForOperation(
       if (NS_WARN_IF(!atEnd.IsSet()) || !atEnd.IsInTextNode()) {
         continue;
       }
 
       if (!atEnd.IsStartOfContainer() && !atEnd.IsEndOfContainer()) {
         // Split the text node.
         ErrorResult error;
         nsCOMPtr<nsIContent> newLeftNode =
-          htmlEditor->SplitNode(atEnd, error);
+          htmlEditor->SplitNodeWithTransaction(atEnd, error);
         if (NS_WARN_IF(error.Failed())) {
           return error.StealNSResult();
         }
 
         // Correct the range.
         // The new end parent becomes the parent node of the text.
         // XXX We want nsRange::SetEnd(const RawRangeBoundary&)
         EditorRawDOMPoint atContainerOfSplitNode(atEnd.GetContainer());
@@ -6580,20 +6596,20 @@ HTMLEditRules::BustUpInlinesAtRangeEndpo
     return NS_ERROR_FAILURE;
   }
 
   // XXX Oh, then, if the range is collapsed, we don't need to call
   //     GetHighestInlineParent(), isn't it?
   if (endInline && !isCollapsed) {
     RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
     SplitNodeResult splitEndInlineResult =
-      htmlEditor->SplitNodeDeep(*endInline,
-                                EditorRawDOMPoint(item.mEndContainer,
-                                                  item.mEndOffset),
-                                SplitAtEdges::eDoNotCreateEmptyContainer);
+      htmlEditor->SplitNodeDeepWithTransaction(
+                    *endInline,
+                    EditorRawDOMPoint(item.mEndContainer, item.mEndOffset),
+                    SplitAtEdges::eDoNotCreateEmptyContainer);
     if (NS_WARN_IF(splitEndInlineResult.Failed())) {
       return splitEndInlineResult.Rv();
     }
     if (NS_WARN_IF(!mHTMLEditor)) {
       return NS_ERROR_FAILURE;
     }
     EditorRawDOMPoint splitPointAtEnd(splitEndInlineResult.SplitPoint());
     item.mEndContainer = splitPointAtEnd.GetContainer();
@@ -6604,20 +6620,20 @@ HTMLEditRules::BustUpInlinesAtRangeEndpo
     GetHighestInlineParent(*item.mStartContainer);
   if (NS_WARN_IF(!mHTMLEditor)) {
     return NS_ERROR_FAILURE;
   }
 
   if (startInline) {
     RefPtr<HTMLEditor> htmlEditor(mHTMLEditor);
     SplitNodeResult splitStartInlineResult =
-      htmlEditor->SplitNodeDeep(*startInline,
-                                EditorRawDOMPoint(item.mStartContainer,
-                                                  item.mStartOffset),
-                                SplitAtEdges::eDoNotCreateEmptyContainer);
+      htmlEditor->SplitNodeDeepWithTransaction(
+                    *startInline,
+                    EditorRawDOMPoint(item.mStartContainer, item.mStartOffset),
+                    SplitAtEdges::eDoNotCreateEmptyContainer);
     if (NS_WARN_IF(splitStartInlineResult.Failed())) {
       return splitStartInlineResult.Rv();
     }
     if (NS_WARN_IF(!mHTMLEditor)) {
       return NS_ERROR_FAILURE;
     }
     EditorRawDOMPoint splitPointAtStart(splitStartInlineResult.SplitPoint());
     item.mStartContainer = splitPointAtStart.GetContainer();
@@ -6650,27 +6666,28 @@ HTMLEditRules::BustUpInlinesAtBRs(
   // Else we need to bust up aNode along all the breaks
   nsCOMPtr<nsIContent> nextNode = &aNode;
   for (OwningNonNull<nsINode>& brNode : arrayOfBreaks) {
     EditorRawDOMPoint atBrNode(brNode);
     if (NS_WARN_IF(!atBrNode.IsSet())) {
       return NS_ERROR_FAILURE;
     }
     SplitNodeResult splitNodeResult =
-      htmlEditor->SplitNodeDeep(*nextNode, atBrNode,
-                                SplitAtEdges::eAllowToCreateEmptyContainer);
+      htmlEditor->SplitNodeDeepWithTransaction(
+                    *nextNode, atBrNode,
+                    SplitAtEdges::eAllowToCreateEmptyContainer);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return splitNodeResult.Rv();
     }
 
     // Put previous node at the split point.
     if (splitNodeResult.GetPreviousNode()) {
       // Might not be a left node.  A break might have been at the very
-      // beginning of inline container, in which case SplitNodeDeep would not
-      // actually split anything
+      // beginning of inline container, in which case
+      // SplitNodeDeepWithTransaction() would not actually split anything.
       aOutArrayOfNodes.AppendElement(*splitNodeResult.GetPreviousNode());
     }
 
     // Move break outside of container and also put in node list
     EditorRawDOMPoint atNextNode(splitNodeResult.GetNextNode());
     nsresult rv =
       htmlEditor->MoveNode(brNode->AsContent(), atNextNode.GetContainer(),
                            atNextNode.Offset());
@@ -6871,18 +6888,19 @@ HTMLEditRules::ReturnInHeader(Selection&
   NS_ENSURE_SUCCESS(rv, rv);
   if (NS_WARN_IF(!node->IsContent())) {
     return NS_ERROR_FAILURE;
   }
 
   // Split the header
   ErrorResult error;
   SplitNodeResult splitHeaderResult =
-    htmlEditor->SplitNodeDeep(aHeader, EditorRawDOMPoint(node, aOffset),
-                              SplitAtEdges::eAllowToCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  aHeader, EditorRawDOMPoint(node, aOffset),
+                  SplitAtEdges::eAllowToCreateEmptyContainer);
   NS_WARNING_ASSERTION(splitHeaderResult.Succeeded(),
     "Failed to split aHeader");
 
   // If the previous heading of split point is empty, put a mozbr into it.
   nsCOMPtr<nsIContent> prevItem = htmlEditor->GetPriorHTMLSibling(&aHeader);
   if (prevItem) {
     MOZ_DIAGNOSTIC_ASSERT(
       HTMLEditUtils::IsHeader(*prevItem));
@@ -7076,17 +7094,17 @@ HTMLEditRules::ReturnInParagraph(Selecti
         NS_WARNING_ASSERTION(advanced,
           "Failed to advance offset to after the container of selection start");
         brNode = nullptr;
       }
     } else {
       if (doesCRCreateNewP) {
         ErrorResult error;
         nsCOMPtr<nsIContent> newLeftDivOrP =
-          htmlEditor->SplitNode(pointToSplitParentDivOrP, error);
+          htmlEditor->SplitNodeWithTransaction(pointToSplitParentDivOrP, error);
         if (NS_WARN_IF(error.Failed())) {
           return EditActionResult(error.StealNSResult());
         }
         pointToSplitParentDivOrP.SetToEndOf(newLeftDivOrP);
       }
 
       // We need to put new <br> after the left node if given node was split
       // above.
@@ -7169,19 +7187,20 @@ HTMLEditRules::SplitParagraph(
                                             address_of(selNode), &selOffset);
   NS_ENSURE_SUCCESS(rv, rv);
   if (NS_WARN_IF(!selNode->IsContent())) {
     return NS_ERROR_FAILURE;
   }
 
   // Split the paragraph.
   SplitNodeResult splitDivOrPResult =
-    htmlEditor->SplitNodeDeep(aParentDivOrP,
-                              EditorRawDOMPoint(selNode, selOffset),
-                              SplitAtEdges::eAllowToCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  aParentDivOrP,
+                  EditorRawDOMPoint(selNode, selOffset),
+                  SplitAtEdges::eAllowToCreateEmptyContainer);
   if (NS_WARN_IF(splitDivOrPResult.Failed())) {
     return splitDivOrPResult.Rv();
   }
   if (NS_WARN_IF(!splitDivOrPResult.DidSplit())) {
     return NS_ERROR_FAILURE;
   }
 
   // Get rid of the break, if it is visible (otherwise it may be needed to
@@ -7251,17 +7270,17 @@ HTMLEditRules::ReturnInListItem(Selectio
       root != aListItem.GetParentElement() &&
       IsEmptyBlockElement(aListItem, IgnoreSingleBR::eYes)) {
     nsCOMPtr<nsIContent> leftListNode = aListItem.GetParent();
     // Are we the last list item in the list?
     if (!htmlEditor->IsLastEditableChild(&aListItem)) {
       // We need to split the list!
       EditorRawDOMPoint atListItem(&aListItem);
       ErrorResult error;
-      leftListNode = htmlEditor->SplitNode(atListItem, error);
+      leftListNode = htmlEditor->SplitNodeWithTransaction(atListItem, error);
       if (NS_WARN_IF(error.Failed())) {
         return error.StealNSResult();
       }
     }
 
     // Are we in a sublist?
     EditorRawDOMPoint atNextSiblingOfLeftList(leftListNode);
     DebugOnly<bool> advanced = atNextSiblingOfLeftList.AdvanceOffset();
@@ -7317,18 +7336,19 @@ HTMLEditRules::ReturnInListItem(Selectio
                                             address_of(selNode), &aOffset);
   NS_ENSURE_SUCCESS(rv, rv);
   if (NS_WARN_IF(!selNode->IsContent())) {
     return NS_ERROR_FAILURE;
   }
 
   // Now split the list item.
   SplitNodeResult splitListItemResult =
-    htmlEditor->SplitNodeDeep(aListItem, EditorRawDOMPoint(selNode, aOffset),
-                              SplitAtEdges::eAllowToCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  aListItem, EditorRawDOMPoint(selNode, aOffset),
+                  SplitAtEdges::eAllowToCreateEmptyContainer);
   NS_WARNING_ASSERTION(splitListItemResult.Succeeded(),
     "Failed to split the list item");
 
   // Hack: until I can change the damaged doc range code back to being
   // extra-inclusive, I have to manually detect certain list items that may be
   // left empty.
   nsCOMPtr<nsIContent> prevItem = htmlEditor->GetPriorHTMLSibling(&aListItem);
   if (prevItem && HTMLEditUtils::IsListItem(prevItem)) {
@@ -7465,17 +7485,18 @@ HTMLEditRules::MakeBlockquote(nsTArray<O
     } else {
       prevParent = curNode->GetParentNode();
     }
 
     // If no curBlock, make one
     if (!curBlock) {
       EditorDOMPoint atCurNode(curNode);
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(*nsGkAtoms::blockquote, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::blockquote,
+                                                    atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       curBlock =
         htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::blockquote,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!curBlock)) {
         return NS_ERROR_FAILURE;
@@ -7645,17 +7666,17 @@ HTMLEditRules::ApplyBlockStyle(nsTArray<
       if (!childArray.IsEmpty()) {
         nsresult rv = ApplyBlockStyle(childArray, aBlockTag);
         NS_ENSURE_SUCCESS(rv, rv);
         continue;
       }
 
       // Make sure we can put a block here
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(aBlockTag, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(aBlockTag, atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       RefPtr<Element> theBlock =
         htmlEditor->CreateNodeWithTransaction(aBlockTag,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!theBlock)) {
         return NS_ERROR_FAILURE;
@@ -7674,17 +7695,17 @@ HTMLEditRules::ApplyBlockStyle(nsTArray<
         nsresult rv = htmlEditor->DeleteNode(curNode);
         NS_ENSURE_SUCCESS(rv, rv);
         continue;
       }
 
       // The break is the first (or even only) node we encountered.  Create a
       // block for it.
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(aBlockTag, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(aBlockTag, atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       curBlock =
         htmlEditor->CreateNodeWithTransaction(aBlockTag,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!curBlock)) {
         return NS_ERROR_FAILURE;
@@ -7710,17 +7731,17 @@ HTMLEditRules::ApplyBlockStyle(nsTArray<
         continue;
       }
 
       // If no curBlock, make one
       if (!curBlock) {
         AutoEditorDOMPointOffsetInvalidator lockChild(atCurNode);
 
         SplitNodeResult splitNodeResult =
-          MaybeSplitAncestorsForInsert(aBlockTag, atCurNode);
+          MaybeSplitAncestorsForInsertWithTransaction(aBlockTag, atCurNode);
         if (NS_WARN_IF(splitNodeResult.Failed())) {
           return splitNodeResult.Rv();
         }
         curBlock =
           htmlEditor->CreateNodeWithTransaction(aBlockTag,
                                                 splitNodeResult.SplitPoint());
         if (NS_WARN_IF(!curBlock)) {
           return NS_ERROR_FAILURE;
@@ -7743,17 +7764,17 @@ HTMLEditRules::ApplyBlockStyle(nsTArray<
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
   return NS_OK;
 }
 
 template<typename PT, typename CT>
 SplitNodeResult
-HTMLEditRules::MaybeSplitAncestorsForInsert(
+HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
                  nsAtom& aTag,
                  const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode)
 {
   if (NS_WARN_IF(!aStartOfDeepestRightNode.IsSet())) {
     return SplitNodeResult(NS_ERROR_INVALID_ARG);
   }
   MOZ_ASSERT(aStartOfDeepestRightNode.IsSetAndValid());
 
@@ -7795,19 +7816,20 @@ 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.GetChild(),
-                              aStartOfDeepestRightNode,
-                              SplitAtEdges::eAllowToCreateEmptyContainer);
+    htmlEditor->SplitNodeDeepWithTransaction(
+                  *pointToInsert.GetChild(),
+                  aStartOfDeepestRightNode,
+                  SplitAtEdges::eAllowToCreateEmptyContainer);
   NS_WARNING_ASSERTION(splitNodeResult.Succeeded(),
     "Failed to split the node for insert the element");
   return splitNodeResult;
 }
 
 /**
  * JoinNodesSmart: Join two nodes, doing whatever makes sense for their
  * children (which often means joining them, too).  aNodeLeft & aNodeRight must
@@ -8713,17 +8735,17 @@ HTMLEditRules::PopListItem(nsIContent& a
     EditorDOMPoint atListItem(&aListItem);
     if (NS_WARN_IF(!atListItem.IsSet())) {
       return NS_ERROR_INVALID_ARG;
     }
     MOZ_ASSERT(atListItem.IsSetAndValid());
 
     // split the list
     ErrorResult error;
-    leftListNode = mHTMLEditor->SplitNode(atListItem, error);
+    leftListNode = mHTMLEditor->SplitNodeWithTransaction(atListItem, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
     if (NS_WARN_IF(!mHTMLEditor)) {
       return NS_ERROR_FAILURE;
     }
   }
 
@@ -9390,17 +9412,18 @@ HTMLEditRules::WillAbsolutePosition(Sele
 
     EditorDOMPoint atStartOfSelection(firstRange->StartRef());
     if (NS_WARN_IF(!atStartOfSelection.IsSet())) {
       return NS_ERROR_FAILURE;
     }
 
     // Make sure we can put a block here.
     SplitNodeResult splitNodeResult =
-      MaybeSplitAncestorsForInsert(*nsGkAtoms::div, atStartOfSelection);
+      MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
+                                                  atStartOfSelection);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return splitNodeResult.Rv();
     }
     RefPtr<Element> positionedDiv =
       htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                             splitNodeResult.SplitPoint());
     if (NS_WARN_IF(!positionedDiv)) {
       return NS_ERROR_FAILURE;
@@ -9448,17 +9471,18 @@ HTMLEditRules::WillAbsolutePosition(Sele
         sibling = htmlEditor->GetPriorHTMLSibling(curNode);
       }
 
       if (!curList || (sibling && sibling != curList)) {
         nsAtom* containerName =
           atCurNode.GetContainer()->NodeInfo()->NameAtom();
         // Create a new nested list of correct type.
         SplitNodeResult splitNodeResult =
-          MaybeSplitAncestorsForInsert(*containerName, atCurNode);
+          MaybeSplitAncestorsForInsertWithTransaction(*containerName,
+                                                      atCurNode);
         if (NS_WARN_IF(splitNodeResult.Failed())) {
           return splitNodeResult.Rv();
         }
         if (!curPositionedDiv) {
           curPositionedDiv =
             htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                                   splitNodeResult.SplitPoint());
           NS_WARNING_ASSERTION(curPositionedDiv,
@@ -9504,17 +9528,18 @@ HTMLEditRules::WillAbsolutePosition(Sele
         EditorDOMPoint atListItem(listItem);
         if (NS_WARN_IF(!atListItem.IsSet())) {
           return NS_ERROR_FAILURE;
         }
         nsAtom* containerName =
           atListItem.GetContainer()->NodeInfo()->NameAtom();
         // Create a new nested list of correct type
         SplitNodeResult splitNodeResult =
-          MaybeSplitAncestorsForInsert(*containerName, atListItem);
+          MaybeSplitAncestorsForInsertWithTransaction(*containerName,
+                                                      atListItem);
         if (NS_WARN_IF(splitNodeResult.Failed())) {
           return splitNodeResult.Rv();
         }
         if (!curPositionedDiv) {
           EditorRawDOMPoint atListItemParent(atListItem.GetContainer());
           curPositionedDiv =
             htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                                   atListItemParent);
@@ -9542,17 +9567,18 @@ HTMLEditRules::WillAbsolutePosition(Sele
     if (!curPositionedDiv) {
       if (curNode->IsHTMLElement(nsGkAtoms::div)) {
         curPositionedDiv = curNode->AsElement();
         mNewBlock = curPositionedDiv;
         curList = nullptr;
         continue;
       }
       SplitNodeResult splitNodeResult =
-        MaybeSplitAncestorsForInsert(*nsGkAtoms::div, atCurNode);
+        MaybeSplitAncestorsForInsertWithTransaction(*nsGkAtoms::div,
+                                                    atCurNode);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       curPositionedDiv =
         htmlEditor->CreateNodeWithTransaction(*nsGkAtoms::div,
                                               splitNodeResult.SplitPoint());
       if (NS_WARN_IF(!curPositionedDiv)) {
         return NS_ERROR_FAILURE;
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -433,34 +433,34 @@ protected:
    * @param aBlockTag       The element name of new block elements.
    */
   nsresult ApplyBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
                            nsAtom& aBlockTag);
 
   nsresult MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
 
   /**
-   * MaybeSplitAncestorsForInsert() does nothing if container of
+   * MaybeSplitAncestorsForInsertWithTransaction() does nothing if container of
    * aStartOfDeepestRightNode can have an element whose tag name is aTag.
    * Otherwise, looks for an ancestor node which is or is in active editing
    * host and can have an element whose name is aTag.  If there is such
    * ancestor, its descendants are split.
    *
    * Note that this may create empty elements while splitting ancestors.
    *
    * @param aTag                        The name of element to be inserted
    *                                    after calling this method.
    * @param aStartOfDeepestRightNode    The start point of deepest right node.
    *                                    This point must be descendant of
    *                                    active editing host.
    * @return                            When succeeded, SplitPoint() returns
    *                                    the point to insert the element.
    */
   template<typename PT, typename CT>
-  SplitNodeResult MaybeSplitAncestorsForInsert(
+  SplitNodeResult MaybeSplitAncestorsForInsertWithTransaction(
                     nsAtom& aTag,
                     const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode);
 
   EditorDOMPoint JoinNodesSmart(nsIContent& aNodeLeft,
                                 nsIContent& aNodeRight);
   Element* GetTopEnclosingMailCite(nsINode& aNode);
   nsresult PopListItem(nsIContent& aListItem, bool* aOutOfList = nullptr);
   nsresult RemoveListStructure(Element& aList);
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -1654,18 +1654,18 @@ HTMLEditor::InsertNodeIntoProperAncestor
       break;
     }
   }
 
   if (pointToInsert != aPointToInsert) {
     // We need to split some levels above the original selection parent.
     MOZ_ASSERT(pointToInsert.GetChild());
     SplitNodeResult splitNodeResult =
-      SplitNodeDeep(*pointToInsert.GetChild(),
-                    aPointToInsert, aSplitAtEdges);
+      SplitNodeDeepWithTransaction(*pointToInsert.GetChild(),
+                                   aPointToInsert, aSplitAtEdges);
     if (NS_WARN_IF(splitNodeResult.Failed())) {
       return EditorDOMPoint();
     }
     pointToInsert = splitNodeResult.SplitPoint();
     MOZ_ASSERT(pointToInsert.IsSet());
   }
 
   {
@@ -2029,19 +2029,19 @@ 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.GetChild(),
-                      atStartOfSelection,
-                      SplitAtEdges::eAllowToCreateEmptyContainer);
+        SplitNodeDeepWithTransaction(
+          *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;
       }
     }
@@ -2188,19 +2188,19 @@ 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.GetChild(),
-                      atStartOfSelection,
-                      SplitAtEdges::eAllowToCreateEmptyContainer);
+        SplitNodeDeepWithTransaction(
+          *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;
       }
     }
@@ -2276,19 +2276,19 @@ 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.GetChild(),
-                      atStartOfSelection,
-                      SplitAtEdges::eAllowToCreateEmptyContainer);
+        SplitNodeDeepWithTransaction(
+          *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;
       }
     }
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -361,18 +361,19 @@ HTMLEditor::DoInsertHTMLWithContext(cons
     }
 
     // Remember if we are in a link.
     bool bStartedInLink = IsInLink(pointToInsert.GetContainer());
 
     // Are we in a text node? If so, split it.
     if (pointToInsert.IsInTextNode()) {
       SplitNodeResult splitNodeResult =
-        SplitNodeDeep(*pointToInsert.GetContainerAsContent(), pointToInsert,
-                      SplitAtEdges::eAllowToCreateEmptyContainer);
+        SplitNodeDeepWithTransaction(
+          *pointToInsert.GetContainerAsContent(), pointToInsert,
+          SplitAtEdges::eAllowToCreateEmptyContainer);
       if (NS_WARN_IF(splitNodeResult.Failed())) {
         return splitNodeResult.Rv();
       }
       pointToInsert = splitNodeResult.SplitPoint();
       if (NS_WARN_IF(!pointToInsert.IsSet())) {
         return NS_ERROR_FAILURE;
       }
     }
@@ -664,18 +665,19 @@ HTMLEditor::DoInsertHTMLWithContext(cons
           IsInLink(selNode, address_of(link))) {
         // so, if we just pasted a link, I split it.  Why do that instead of just
         // nudging selection point beyond it?  Because it might have ended in a BR
         // that is not visible.  If so, the code above just placed selection
         // inside that.  So I split it instead.
         nsCOMPtr<nsIContent> linkContent = do_QueryInterface(link);
         NS_ENSURE_STATE(linkContent || !link);
         SplitNodeResult splitLinkResult =
-          SplitNodeDeep(*linkContent, EditorRawDOMPoint(selNode, selOffset),
-                        SplitAtEdges::eDoNotCreateEmptyContainer);
+          SplitNodeDeepWithTransaction(
+            *linkContent, EditorRawDOMPoint(selNode, selOffset),
+            SplitAtEdges::eDoNotCreateEmptyContainer);
         NS_WARNING_ASSERTION(splitLinkResult.Succeeded(),
           "Failed to split the link");
         if (splitLinkResult.GetPreviousNode()) {
           EditorRawDOMPoint afterLeftLink(splitLinkResult.GetPreviousNode());
           if (afterLeftLink.AdvanceOffset()) {
             selection->Collapse(afterLeftLink);
           }
         }
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -286,28 +286,28 @@ HTMLEditor::SetInlinePropertyOnTextNode(
   // Make the range an independent node.
   nsCOMPtr<nsIContent> textNodeForTheRange = &aText;
 
   // Split at the end of the range.
   EditorRawDOMPoint atEnd(textNodeForTheRange, aEndOffset);
   if (!atEnd.IsEndOfContainer()) {
     // We need to split off back of text node
     ErrorResult error;
-    textNodeForTheRange = SplitNode(atEnd, error);
+    textNodeForTheRange = SplitNodeWithTransaction(atEnd, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
   }
 
   // Split at the start of the range.
   EditorRawDOMPoint atStart(textNodeForTheRange, aStartOffset);
   if (!atStart.IsStartOfContainer()) {
     // We need to split off front of text node
     ErrorResult error;
-    nsCOMPtr<nsIContent> newLeftNode = SplitNode(atStart, error);
+    nsCOMPtr<nsIContent> newLeftNode = SplitNodeWithTransaction(atStart, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
     Unused << newLeftNode;
   }
 
   if (aAttribute) {
     // Look for siblings that are correct type of node
@@ -551,18 +551,18 @@ HTMLEditor::SplitStyleAbovePoint(nsCOMPt
         // node is href - test if really <a href=...
         (aProperty == nsGkAtoms::href && HTMLEditUtils::IsLink(node)) ||
         // or node is any prop, and we asked to split them all
         (!aProperty && NodeIsProperty(node)) ||
         // or the style is specified in the style attribute
         isSet) {
       // Found a style node we need to split
       SplitNodeResult splitNodeResult =
-        SplitNodeDeep(*node, EditorRawDOMPoint(*aNode, *aOffset),
-                      SplitAtEdges::eAllowToCreateEmptyContainer);
+        SplitNodeDeepWithTransaction(*node, EditorRawDOMPoint(*aNode, *aOffset),
+                                     SplitAtEdges::eAllowToCreateEmptyContainer);
       NS_WARNING_ASSERTION(splitNodeResult.Succeeded(),
         "Failed to split the node");
 
       EditorRawDOMPoint atRightNode(splitNodeResult.SplitPoint());
       *aNode = atRightNode.GetContainer();
       *aOffset = atRightNode.Offset();
       if (aOutLeftNode) {
         NS_IF_ADDREF(*aOutLeftNode = splitNodeResult.GetPreviousNode());
@@ -1458,28 +1458,28 @@ HTMLEditor::RelativeFontChangeOnTextNode
   // Make the range an independent node.
   nsCOMPtr<nsIContent> textNodeForTheRange = &aTextNode;
 
   // Split at the end of the range.
   EditorRawDOMPoint atEnd(textNodeForTheRange, aEndOffset);
   if (!atEnd.IsEndOfContainer()) {
     // We need to split off back of text node
     ErrorResult error;
-    textNodeForTheRange = SplitNode(atEnd, error);
+    textNodeForTheRange = SplitNodeWithTransaction(atEnd, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
   }
 
   // Split at the start of the range.
   EditorRawDOMPoint atStart(textNodeForTheRange, aStartOffset);
   if (!atStart.IsStartOfContainer()) {
     // We need to split off front of text node
     ErrorResult error;
-    nsCOMPtr<nsIContent> newLeftNode = SplitNode(atStart, error);
+    nsCOMPtr<nsIContent> newLeftNode = SplitNodeWithTransaction(atStart, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
     Unused << newLeftNode;
   }
 
   // Look for siblings that are correct type of node
   nsAtom* nodeType = aDir == FontSize::incr ? nsGkAtoms::big
--- a/editor/libeditor/TextEditor.cpp
+++ b/editor/libeditor/TextEditor.cpp
@@ -455,17 +455,18 @@ TextEditor::CreateBRImpl(Selection& aSel
       }
       DebugOnly<bool> advanced = pointInContainer.AdvanceOffset();
       NS_WARNING_ASSERTION(advanced,
         "Failed to advance offset to after the text node");
     } else {
       MOZ_DIAGNOSTIC_ASSERT(aPointToInsert.IsSetAndValid());
       // Unfortunately, we need to split the text node at the offset.
       ErrorResult error;
-      nsCOMPtr<nsIContent> newLeftNode = SplitNode(aPointToInsert, error);
+      nsCOMPtr<nsIContent> newLeftNode =
+        SplitNodeWithTransaction(aPointToInsert, error);
       if (NS_WARN_IF(error.Failed())) {
         error.SuppressException();
         return nullptr;
       }
       Unused << newLeftNode;
       // Insert new <br> before the right node.
       pointInContainer.Set(aPointToInsert.GetContainer());
     }