Bug 1655388 - part 3: Make HTMLEditor::HandleDeleteSelectionInternal() use the new method when it removes an invisible <br> element r=m_kato

Even though it hasn't normalize white-spaces before invisible `<br>` element,
it needs to do it for making them visible.  Therefore, we should make it
use the new method in this case too.

Depends on D87030

Differential Revision: https://phabricator.services.mozilla.com/D87031
This commit is contained in:
Masayuki Nakano 2020-08-18 09:23:16 +00:00
parent 9494d7d9c7
commit e844854c69

View File

@ -2560,14 +2560,16 @@ EditActionResult HTMLEditor::HandleDeleteSelectionInternal(
// the caret point and use `HandleDeleteNonCollapsedRanges()`
// instead after we would create delete range computation
// method at switching to the new white-space normalizer.
nsresult rv = DeleteNodeWithTransaction(
MOZ_KnownLive(*scanFromCaretPointResult.BRElementPtr()));
if (NS_WARN_IF(Destroyed())) {
return EditActionResult(NS_ERROR_EDITOR_DESTROYED);
}
nsresult rv = WhiteSpaceVisibilityKeeper::
DeleteContentNodeAndJoinTextNodesAroundIt(
*this,
MOZ_KnownLive(*scanFromCaretPointResult.BRElementPtr()),
caretPoint);
if (NS_FAILED(rv)) {
NS_WARNING("HTMLEditor::DeleteNodeWithTransaction() failed");
return EditActionResult(rv);
NS_WARNING(
"WhiteSpaceVisibilityKeeper::"
"DeleteContentNodeAndJoinTextNodesAroundIt() failed");
return EditActionHandled(rv);
}
if (SelectionRefPtr()->RangeCount() != 1) {
NS_WARNING(