Bug 1820449 - Make WhiteSpaceVisibilityKeeper verify tracking point of start of right joining node after flushing the tracker r=m_kato

In the legacy mode, right node is not removed from the DOM tree, therefore,
this bug was hidden.  However, after enabling the new mode, the point will
be out of the document.  Therefore, the check will cause
`NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE` error and the joining code stops handling
the deletion.

Differential Revision: https://phabricator.services.mozilla.com/D171822
This commit is contained in:
Masayuki Nakano 2023-03-10 02:39:26 +00:00
parent bf574a2158
commit b68e3ef35e

View File

@ -5008,6 +5008,7 @@ Result<EditActionResult, nsresult> HTMLEditor::AutoDeleteRangesHandler::
"failed");
return result;
}
trackStartOfRightBlock.FlushAndStopTracking();
if (NS_WARN_IF(!startOfRightContent.IsSet()) ||
NS_WARN_IF(!startOfRightContent.GetContainer()->IsInComposedDoc())) {
return Err(NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE);
@ -5039,6 +5040,7 @@ Result<EditActionResult, nsresult> HTMLEditor::AutoDeleteRangesHandler::
"MergeFirstLineOfRightBlockElementIntoLeftBlockElement() failed");
return result;
}
trackStartOfRightBlock.FlushAndStopTracking();
if (NS_WARN_IF(!startOfRightContent.IsSet()) ||
NS_WARN_IF(!startOfRightContent.GetContainer()->IsInComposedDoc())) {
return Err(NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE);