tor-browser

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

commit 94a165971f644d80959dc3fc12ef1eaac45eb268
parent 0a0abe40bbe8cc587e6316541d7c59042fb9ae54
Author: stransky <stransky@redhat.com>
Date:   Tue, 11 Nov 2025 05:06:23 +0000

Bug 1998949 [Wayland] Propagate correct window coordinates constraint to layout r=emilio

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

Diffstat:
Mwidget/gtk/nsWindow.cpp | 19++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp @@ -1148,6 +1148,10 @@ void nsWindow::ResizeInt(const Maybe<DesktopIntPoint>& aMove, return; } + // TODO: Behave better if there's an active move-to-rect callback. + if (mWaitingForMoveToRectCallback) { + NS_WARNING("Resized during active move-to-rect callbak!"); + } NativeMoveResize(moved, resized); } @@ -2155,6 +2159,7 @@ void nsWindow::NativeMoveResizeWaylandPopupCallback( newClientArea.y, newClientArea.width, newClientArea.height); if (!needsSizeUpdate && !needsPositionUpdate) { + LOG(" Size/position is the same, quit."); return; } if (needsSizeUpdate) { @@ -2163,10 +2168,10 @@ void nsWindow::NativeMoveResizeWaylandPopupCallback( // Beware that gtk_window_resize() requests sizes asynchronously and so // newClientArea might not have the size from the most recent // gtk_window_resize(). - if (mClientArea.width < mLastSizeRequest.width) { + if (newClientArea.width < mLastSizeRequest.width) { mMoveToRectPopupSize.width = newClientArea.width; } - if (mClientArea.height < mLastSizeRequest.height) { + if (newClientArea.height < mLastSizeRequest.height) { mMoveToRectPopupSize.height = newClientArea.height; } LOG(" mMoveToRectPopupSize set to [%d, %d]", mMoveToRectPopupSize.width, @@ -3470,8 +3475,6 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { #endif #ifdef MOZ_WAYLAND void nsWindow::RecomputeBoundsWayland(bool aMayChangeCsdMargin) { - LOG("RecomputeBoundsWayland(%d)", aMayChangeCsdMargin); - auto GetBounds = [&](GdkWindow* aWin) { GdkRectangle b{0}; gdk_window_get_position(aWin, &b.x, &b.y); @@ -3481,8 +3484,14 @@ void nsWindow::RecomputeBoundsWayland(bool aMayChangeCsdMargin) { }; const auto toplevelBounds = GetBounds(GetToplevelGdkWindow()); - mClientArea = GetBounds(mGdkWindow); + + LOG("RecomputeBoundsWayland(%d) GetBounds(mGdkWindow) [%d,%d] -> [%d x %d] " + "GetBounds(mShell) [%d,%d] -> [%d x %d]", + aMayChangeCsdMargin, mClientArea.x, mClientArea.y, mClientArea.width, + mClientArea.height, toplevelBounds.x, toplevelBounds.y, + toplevelBounds.width, toplevelBounds.height); + if (mClientArea.X() < 0 || mClientArea.Y() < 0 || mClientArea.Width() <= 1 || mClientArea.Height() <= 1) { // If we don't have gdkwindow bounds, assume we take the whole toplevel.