Bug 1939220 - part 3: Make TextFragmentData::BoundaryData not depend on the editing host r=m_kato
Its role is scanning the DOM. Therefore, it can know which node is an editing host during a scan. Therefore, it does not require the editing host parameter. To fix that, some utility methods of `HTMLEditUtils` needs to work with non-editable nodes. Therefore, this patch also updates `HTMLEditUtils`. Finally, this gets rid of the `NS_ASSERTION`s in the constructor of `TextFragmentData` because it'll be available with non-editable nodes too. Although current all callers assume that it works as in an editing host. Differential Revision: https://phabricator.services.mozilla.com/D232934
This commit is contained in:
@@ -1181,7 +1181,7 @@ nsresult HTMLEditor::MaybeCollapseSelectionAtFirstEditableNode(
|
||||
// Chromium collapses selection to start of the editing host when this
|
||||
// is the last leaf content. So, we don't need special handling here.
|
||||
leafContent = HTMLEditUtils::GetNextLeafContentOrNextBlockElement(
|
||||
*leafElement, *editingHost,
|
||||
*leafElement,
|
||||
{LeafNodeType::LeafNodeOrNonEditableNode,
|
||||
LeafNodeType::LeafNodeOrChildBlock},
|
||||
BlockInlineCheck::UseComputedDisplayStyle, editingHost);
|
||||
@@ -1207,7 +1207,7 @@ nsresult HTMLEditor::MaybeCollapseSelectionAtFirstEditableNode(
|
||||
}
|
||||
// If it's an invisible text node, keep scanning next leaf.
|
||||
leafContent = HTMLEditUtils::GetNextLeafContentOrNextBlockElement(
|
||||
*leafContent, *editingHost,
|
||||
*leafContent,
|
||||
{LeafNodeType::LeafNodeOrNonEditableNode,
|
||||
LeafNodeType::LeafNodeOrChildBlock},
|
||||
BlockInlineCheck::UseComputedDisplayStyle, editingHost);
|
||||
@@ -1254,7 +1254,7 @@ nsresult HTMLEditor::MaybeCollapseSelectionAtFirstEditableNode(
|
||||
// Otherwise, we must meet an empty block element or a data node like
|
||||
// comment node. Let's ignore it.
|
||||
leafContent = HTMLEditUtils::GetNextLeafContentOrNextBlockElement(
|
||||
*leafContent, *editingHost,
|
||||
*leafContent,
|
||||
{LeafNodeType::LeafNodeOrNonEditableNode,
|
||||
LeafNodeType::LeafNodeOrChildBlock},
|
||||
BlockInlineCheck::UseComputedDisplayStyle, editingHost);
|
||||
|
||||
Reference in New Issue
Block a user