commit 98b063a0ef2c14f20a4cd184afd82fdbc59b43d6
parent bad5312cfe19de254877706486f00bc7928b2204
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Fri, 10 Oct 2025 09:34:57 +0000
Bug 1993570 - Simplify nsWindow::GetTopmostWindow(). r=stransky
The code already doesn't jump across toplevel boundaries so this is
simpler.
Differential Revision: https://phabricator.services.mozilla.com/D268207
Diffstat:
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
@@ -1738,14 +1738,7 @@ void nsWindow::LogPopupHierarchy() {
#endif
nsWindow* nsWindow::GetTopmostWindow() {
- if (nsView* view = nsView::GetViewFor(this)) {
- if (nsView* parentView = view->GetParent()) {
- if (nsIWidget* parentWidget = parentView->GetNearestWidget(nullptr)) {
- return static_cast<nsWindow*>(parentWidget);
- }
- }
- }
- return nullptr;
+ return static_cast<nsWindow*>(GetTopLevelWidget());
}
// Configure Wayland popup. If true is returned we need to track popup