tor-browser

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

commit 3039907ce143833ffefdf300ad0bc5560f9c418c
parent bc7ee6d4faa5754fe29b26f1c69033e7f78d00e6
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Fri, 17 Oct 2025 10:45:38 +0000

Bug 1994964 - Simplify nsContentUtils::WidgetForDocument. r=tnikkel,layout-reviewers

Use the closest widget of the root frame.

Differential Revision: https://phabricator.services.mozilla.com/D269024

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

diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp @@ -7798,19 +7798,8 @@ nsIWidget* nsContentUtils::WidgetForDocument(const Document* aDocument) { if (!presShell) { return 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); + nsIFrame* rootFrame = presShell->GetRootFrame(); + return rootFrame ? rootFrame->GetNearestWidget() : nullptr; } nsIWidget* nsContentUtils::WidgetForContent(const nsIContent* aContent) {