Bug 1926483 - part 1: Make WSRunScanner instance free from editing host r=m_kato

If it scans starting from a editable point, it does not require the editing
host as an ancestor limiter.  Therefore, some users can be free from editing
host.

Differential Revision: https://phabricator.services.mozilla.com/D233791
This commit is contained in:
Masayuki Nakano
2025-01-24 05:00:47 +00:00
parent 94cf6b7230
commit 395226db0c
8 changed files with 122 additions and 123 deletions

View File

@@ -2244,12 +2244,16 @@ nsresult HTMLEditor::InsertElementAtSelectionAsAction(
if (!SelectionRef().GetAnchorNode()) {
return NS_OK;
}
if (NS_WARN_IF(!SelectionRef().GetAnchorNode()->IsInclusiveDescendantOf(
editingHost))) {
return NS_ERROR_FAILURE;
}
EditorRawDOMPoint atAnchor(SelectionRef().AnchorRef());
// Adjust position based on the node we are going to insert.
EditorDOMPoint pointToInsert =
HTMLEditUtils::GetBetterInsertionPointFor<EditorDOMPoint>(
*aElement, atAnchor, *editingHost);
HTMLEditUtils::GetBetterInsertionPointFor<EditorDOMPoint>(*aElement,
atAnchor);
if (!pointToInsert.IsSet()) {
NS_WARNING("HTMLEditUtils::GetBetterInsertionPointFor() failed");
return NS_ERROR_FAILURE;