From 6551ca6994e20c754d6da3fc6da099d28afd63d7 Mon Sep 17 00:00:00 2001
From: Masayuki Nakano <masayuki@d-toybox.com>
Date: Thu, 17 Sep 2020 08:39:31 +0000
Subject: [PATCH] Bug 1658702 - part 16: Implement
 `AutoBlockElementsJoiner::ComputeRangesToDeleteContentInRanges()` and
 `AutoBlockElementsJoiner::ComputeRangesToJoinBlockElementsInSameParent()`
 r=m_kato

They need to just call
`AutoDeleteRangesHandler::ComputeRangesToDeleteRangesWithTransaction()` because
their corresponding methods calls `EditorBase::DeleteRangesWithTransaction()`
and do additional different jobs after that, but the they don't affect the
ranges.

* https://searchfox.org/mozilla-central/rev/0c97a6410ff018c22e65a0cbe4e5f2ca4581b22e/editor/libeditor/HTMLEditSubActionHandler.cpp#4602,4627-4628,4639-4642
* https://searchfox.org/mozilla-central/rev/0c97a6410ff018c22e65a0cbe4e5f2ca4581b22e/editor/libeditor/HTMLEditSubActionHandler.cpp#4650,4669-4670,4676-4678,4685-4686

Depends on D90212

Differential Revision: https://phabricator.services.mozilla.com/D90213
---
 editor/libeditor/HTMLEditSubActionHandler.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/editor/libeditor/HTMLEditSubActionHandler.cpp b/editor/libeditor/HTMLEditSubActionHandler.cpp
index 2ade154f054c3..85dbb0fecb760 100644
--- a/editor/libeditor/HTMLEditSubActionHandler.cpp
+++ b/editor/libeditor/HTMLEditSubActionHandler.cpp
@@ -5176,7 +5176,13 @@ nsresult HTMLEditor::AutoDeleteRangesHandler::AutoBlockElementsJoiner::
                  ->GetEndContainer()
                  ->IsInclusiveDescendantOf(mRightContent));
 
-  return NS_OK;
+  nsresult rv =
+      mDeleteRangesHandlerConst.ComputeRangesToDeleteRangesWithTransaction(
+         aHTMLEditor, aDirectionAndAmount, aStripWrappers, aRangesToDelete);
+  NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
+                       "AutoDeleteRangesHandler::"
+                       "ComputeRangesToDeleteRangesWithTransaction() failed");
+  return rv;
 }
 
 EditActionResult HTMLEditor::AutoDeleteRangesHandler::AutoBlockElementsJoiner::
@@ -5250,7 +5256,13 @@ nsresult HTMLEditor::AutoDeleteRangesHandler::AutoBlockElementsJoiner::
                  ->IsInclusiveDescendantOf(mRightContent));
   MOZ_ASSERT(mLeftContent->GetParentNode() == mRightContent->GetParentNode());
 
-  return NS_OK;
+  nsresult rv =
+      mDeleteRangesHandlerConst.ComputeRangesToDeleteRangesWithTransaction(
+          aHTMLEditor, aDirectionAndAmount, aStripWrappers, aRangesToDelete);
+  NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
+                       "AutoDeleteRangesHandler::"
+                       "ComputeRangesToDeleteRangesWithTransaction() failed");
+  return rv;
 }
 
 EditActionResult HTMLEditor::AutoDeleteRangesHandler::AutoBlockElementsJoiner::
-- 
GitLab