tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d7622487ef3148762fc3fce4b32c91b7a4a5795c
parent e2f09c00452e8854f437523cf23445c294eaeff8
Author: agoloman <agoloman@mozilla.com>
Date:   Fri, 17 Oct 2025 21:36:26 +0300

Revert "Bug 1994964 - Simplify nsContentUtils::WidgetForDocument. r=tnikkel,layout-reviewers" for causing multiple failures.

This reverts commit 3039907ce143833ffefdf300ad0bc5560f9c418c.

Diffstat:
Mdom/base/nsContentUtils.cpp | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp @@ -7798,8 +7798,19 @@ nsIWidget* nsContentUtils::WidgetForDocument(const Document* aDocument) { if (!presShell) { return nullptr; } - nsIFrame* rootFrame = presShell->GetRootFrame(); - return rootFrame ? rootFrame->GetNearestWidget() : nullptr; + nsViewManager* vm = presShell->GetViewManager(); + if (!vm) { + return nullptr; + } + nsView* rootView = vm->GetRootView(); + if (!rootView) { + return nullptr; + } + nsView* displayRoot = nsViewManager::GetDisplayRootFor(rootView); + if (!displayRoot) { + return nullptr; + } + return displayRoot->GetNearestWidget(nullptr); } nsIWidget* nsContentUtils::WidgetForContent(const nsIContent* aContent) {