Bug 1954413 - Get rid of nsINode::GetChromeOnlyAccessSubtreeRootParent() r=smaug

It's an alias of `nsINode::GetClosestNativeAnonymousSubtreeRootParentOrHost()`
and oddly it returns `const nsIContent*` rather than `nsIContent*`.  Therefore,
some callers need to use `const_cast`.

Differential Revision: https://phabricator.services.mozilla.com/D241776
This commit is contained in:
Masayuki Nakano
2025-03-17 12:49:58 +00:00
parent 0ef5624d51
commit 9add283d50
4 changed files with 16 additions and 15 deletions

View File

@@ -7522,10 +7522,12 @@ Element* HTMLEditor::ComputeEditingHostInternal(
}
if (Element* focusedElementInWindow = innerWindow->GetFocusedElement()) {
if (focusedElementInWindow->ChromeOnlyAccess()) {
focusedElementInWindow =
Element::FromNodeOrNull(const_cast<nsIContent*>(
focusedElementInWindow
->GetChromeOnlyAccessSubtreeRootParent()));
focusedElementInWindow = Element::FromNodeOrNull(
// XXX Should we use
// nsIContent::FindFirstNonChromeOnlyAccessContent() instead of
// nsINode::GetClosestNativeAnonymousSubtreeRootParentOrHost()?
focusedElementInWindow
->GetClosestNativeAnonymousSubtreeRootParentOrHost());
}
if (focusedElementInWindow) {
return focusedElementInWindow->IsEditable() ? focusedElementInWindow