Bug 1657270 - part 5: Guarantee that AutoEmptyBlockAncestorDeleter did nothing if it returns "not handled" or an error at the caller r=m_kato

Differential Revision: https://phabricator.services.mozilla.com/D85999
This commit is contained in:
Masayuki Nakano 2020-08-11 05:04:33 +00:00
parent 76b257fb0f
commit 0b7819addd

View File

@ -2460,8 +2460,9 @@ EditActionResult HTMLEditor::HandleDeleteSelectionInternal(
}
if (startPoint.GetContainerAsContent()) {
AutoEditorDOMPointChildInvalidator lockOffset(startPoint);
#ifdef DEBUG
nsMutationGuard debugMutation;
#endif // #ifdef DEBUG
AutoEmptyBlockAncestorDeleter deleter;
if (deleter.ScanEmptyBlockInclusiveAncestor(
*this, MOZ_KnownLive(*startPoint.GetContainerAsContent()),
@ -2473,6 +2474,9 @@ EditActionResult HTMLEditor::HandleDeleteSelectionInternal(
return result;
}
}
MOZ_ASSERT(!debugMutation.Mutated(0),
"AutoEmptyBlockAncestorDeleter shouldn't modify the DOM tree "
"if it returns not handled nor error");
}
// Test for distance between caret and text that will be deleted