tor-browser

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

commit cf526ee996bd497c93e083f98094b331b9f4e120
parent e0caacd89193d0512f44e292a6889f8baf2a05d2
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Tue, 21 Oct 2025 08:25:46 +0000

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

Use the closest widget from the pres shell.

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

Diffstat:
Mdom/base/nsContentUtils.cpp | 17+----------------
1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp @@ -7795,22 +7795,7 @@ nsPresContext* nsContentUtils::FindPresContextForDocument( nsIWidget* nsContentUtils::WidgetForDocument(const Document* aDocument) { PresShell* presShell = FindPresShellForDocument(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); + return presShell ? presShell->GetNearestWidget() : nullptr; } nsIWidget* nsContentUtils::WidgetForContent(const nsIContent* aContent) {