tor-browser

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

commit 193b10c3d689a5c6b34dd066fb25d37cf71d1640
parent d5c4943ee8062761bb72dd6a0c1a928ee02a62ad
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Wed, 17 Dec 2025 12:58:52 +0000

Bug 2006320 - Remove mRelativePopupPosition. r=stransky

We want to move to the layout-requested position, and the relative position we can get with WaylandPopupGetParent().

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

Diffstat:
Mwidget/gtk/nsWindow.cpp | 48++----------------------------------------------
Mwidget/gtk/nsWindow.h | 4----
2 files changed, 2 insertions(+), 50 deletions(-)

diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp @@ -1617,49 +1617,6 @@ void nsWindow::WaylandPopupHierarchyCalculatePositions() { GTK_WINDOW(popup->mWaylandPopupPrev->mShell)); popup = popup->mWaylandPopupNext; } - - popup = this; - while (popup) { - // Anchored window has mPopupPosition already calculated against - // its parent, no need to recalculate. - LOG(" popup [%p] bounds [%d, %d] -> [%d x %d]", popup, - (int)(popup->mClientArea.x), (int)(popup->mClientArea.y), - (int)(popup->mClientArea.width), (int)(popup->mClientArea.height)); -#ifdef MOZ_LOGGING - if (LOG_ENABLED()) { - if (nsMenuPopupFrame* popupFrame = GetPopupFrame()) { - auto r = LayoutDeviceRect::FromAppUnitsRounded( - popupFrame->GetRect(), - popupFrame->PresContext()->AppUnitsPerDevPixel()); - LOG(" popup [%p] layout [%d, %d] -> [%d x %d]", popup, r.x, r.y, - r.width, r.height); - } - } -#endif - if (popup->WaylandPopupIsFirst()) { - LOG(" popup [%p] has toplevel as parent", popup); - popup->mRelativePopupPosition = popup->mPopupPosition; - } else { - if (popup->mPopupAnchored) { - LOG(" popup [%p] is anchored", popup); - if (!popup->mPopupMatchesLayout) { - NS_WARNING("Anchored popup does not match layout!"); - } - } - DesktopIntPoint parent = popup->WaylandGetParentPosition(); - LOG(" popup [%p] uses transformed coordinates\n", popup); - LOG(" parent position [%d, %d]\n", parent.x.value, parent.y.value); - LOG(" popup position [%d, %d]\n", popup->mPopupPosition.x, - popup->mPopupPosition.y); - - popup->mRelativePopupPosition.x = popup->mPopupPosition.x - parent.x; - popup->mRelativePopupPosition.y = popup->mPopupPosition.y - parent.y; - } - LOG(" popup [%p] transformed popup coordinates from [%d, %d] to [%d, %d]", - popup, popup->mPopupPosition.x, popup->mPopupPosition.y, - popup->mRelativePopupPosition.x, popup->mRelativePopupPosition.y); - popup = popup->mWaylandPopupNext; - } } bool nsWindow::WaylandPopupIsContextMenu() { @@ -2811,14 +2768,13 @@ void nsWindow::WaylandPopupMoveImpl() { LOG("nsWindow::WaylandPopupMove"); LOG(" original widget popup position [%d, %d]\n", mPopupPosition.x, mPopupPosition.y); - LOG(" relative widget popup position [%d, %d]\n", mRelativePopupPosition.x, - mRelativePopupPosition.y); LOG(" popup use move to rect %d", mPopupUseMoveToRect); WaylandPopupPrepareForMove(); if (!mPopupUseMoveToRect) { - WaylandPopupMovePlain(mRelativePopupPosition.x, mRelativePopupPosition.y); + auto pos = mLastMoveRequest - WaylandGetParentPosition(); + WaylandPopupMovePlain(pos.x, pos.y); // Layout already should be aware of our bounds, since we didn't change it // from the widget side for flipping or so. return; diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h @@ -964,10 +964,6 @@ class nsWindow final : public nsIWidget { // Popup position is relative to main (toplevel) window. GdkPoint mPopupPosition{}; - // mRelativePopupPosition is popup position calculated against - // recent popup parent window. - GdkPoint mRelativePopupPosition{}; - // Toplevel window (first element) of linked list of Wayland popups. It's null // if we're the toplevel. RefPtr<nsWindow> mWaylandToplevel;