Bug 1747008 - Make HTMLEditor::OnEndHandlingTopLevelEditSubActionInternal stop stripping empty inline elements if they may be inserted intentionally r=m_kato

Starting from bug 1730429, we strip empty inline elements at caret for
compatibility with Blink/WebKit.  However, we should not do it for the elements
which are intentionally inserted (from `inserthtml` command, paste and DnD).

All the cases are handled by `HTMLEditor::HTMLWithContextInserter` so that
it should prevent the new clean up with `TopLevelEditSubActionData`.

Note that `inserthtml` command handling of Blink is really odd.  It inserts
the empty inline elements of the adding testcases into different place so that
Chrome does not pass the new tests.  However, it does not make sense and I
believe that it's out of scope of this bug.

Differential Revision: https://phabricator.services.mozilla.com/D135195
This commit is contained in:
Masayuki Nakano
2022-01-07 03:08:41 +00:00
parent cef65bf7b2
commit ef75bd0339
4 changed files with 27 additions and 3 deletions

View File

@@ -744,6 +744,9 @@ nsresult HTMLEditor::HTMLWithContextInserter::Run(
return lastInsertedPoint.inspectErr();
}
mHTMLEditor.TopLevelEditSubActionDataRef()
.mNeedsToCleanUpEmptyInlineElements = false;
if (!lastInsertedPoint.inspect().IsSet()) {
return NS_OK;
}