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

@@ -3727,8 +3727,11 @@ static nsMargin GetScrollMargin(const nsIFrame* aFrame) {
// TODO: This is also a bit of an issue for delegated focus, see
// https://github.com/whatwg/html/issues/7033.
if (aFrame->GetContent() && aFrame->GetContent()->ChromeOnlyAccess()) {
// XXX Should we use nsIContent::FindFirstNonChromeOnlyAccessContent()
// instead of nsINode::GetClosestNativeAnonymousSubtreeRootParentOrHost()?
if (const nsIContent* userContent =
aFrame->GetContent()->GetChromeOnlyAccessSubtreeRootParent()) {
aFrame->GetContent()
->GetClosestNativeAnonymousSubtreeRootParentOrHost()) {
if (const nsIFrame* frame = userContent->GetPrimaryFrame()) {
return frame->StyleMargin()->GetScrollMargin();
}