tor-browser

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

commit f677371a792dd89c668ec6a3a2d16785e7981c6c
parent dd4180226eb3943253595929d53735cbfa29b4d2
Author: stransky <stransky@redhat.com>
Date:   Fri, 12 Dec 2025 20:02:28 +0000

Bug 2005738 [Linux] Add more logging to nsWindow::RecomputeBoundsX11() r=emilio

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

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

diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp @@ -3376,6 +3376,8 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { gdk_window_get_frame_extents(aWin, &b); if (gtk_check_version(3, 24, 35) && gdk_window_get_window_type(aWin) == GDK_WINDOW_TEMP) { + LOGVERBOSE( + " GetFrameTitlebarBounds gtk 3.24.35 & GDK_WINDOW_TEMP workaround"); // Workaround for https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4820 // Bug 1775017 Gtk < 3.24.35 returns scaled values for // override redirected window on X11. @@ -3387,6 +3389,7 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { auto result = DesktopIntRect(b.x, b.y, b.width, b.height); if (gtk_check_version(3, 24, 50)) { if (auto border = GetXWindowBorder(aWin)) { + LOGVERBOSE(" GetFrameTitlebarBounds gtk 3.24.50 workaround"); // Workaround for // https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8423 // Bug 1958174 Gtk doesn't account for window border sizes on X11. @@ -3406,17 +3409,21 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { // event size, to avoid spurious resizes on e.g. sizemode changes. gdk_window_get_geometry(aWin, nullptr, nullptr, &b.width, &b.height); gdk_window_get_origin(aWin, &b.x, &b.y); - return DesktopIntRect(b.x, b.y, b.width, b.height); + } else { + gdk_window_get_position(aWin, &b.x, &b.y); + b.width = gdk_window_get_width(aWin); + b.height = gdk_window_get_height(aWin); } - gdk_window_get_position(aWin, &b.x, &b.y); - b.width = gdk_window_get_width(aWin); - b.height = gdk_window_get_height(aWin); return DesktopIntRect(b.x, b.y, b.width, b.height); }; const auto toplevelBoundsWithTitlebar = GetFrameTitlebarBounds(toplevel); const auto toplevelBounds = GetBounds(toplevel); + LOGVERBOSE(" toplevelBoundsWithTitlebar %s", + ToString(toplevelBoundsWithTitlebar).c_str()); + LOGVERBOSE(" toplevelBounds %s", ToString(toplevelBounds).c_str()); + // Unscaled bounds include decorations and titlebar (X11) DesktopIntRect finalBounds = [&] { auto bounds = toplevelBoundsWithTitlebar; @@ -3428,9 +3435,10 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { bounds.height = std::max(bounds.height, toplevelBounds.height); return bounds; }(); - + LOGVERBOSE(" finalBounds %s", ToString(finalBounds).c_str()); const bool decorated = IsTopLevelWidget() && mSizeMode != nsSizeMode_Fullscreen && !mUndecorated; + LOGVERBOSE(" decorated %d", decorated); if (!decorated) { mClientMargin = {}; } else if (aMayChangeCsdMargin) { @@ -3438,6 +3446,9 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { const DesktopIntRect clientRectRelativeToFrame = [&] { auto topLevelBoundsRelativeToFrame = toplevelBounds; topLevelBoundsRelativeToFrame -= toplevelBoundsWithTitlebar.TopLeft(); + + LOGVERBOSE(" topLevelBoundsRelativeToFrame %s", + ToString(topLevelBoundsRelativeToFrame).c_str()); if (!mGdkWindow) { return topLevelBoundsRelativeToFrame; } @@ -3447,12 +3458,16 @@ void nsWindow::RecomputeBoundsX11(bool aMayChangeCsdMargin) { // If we don't have gdkwindow bounds, assume we take the whole toplevel. return topLevelBoundsRelativeToFrame; } + LOGVERBOSE(" gdkWindowBounds %s", ToString(gdkWindowBounds).c_str()); // gdkWindowBounds is relative to topLevelBounds already. return gdkWindowBounds + topLevelBoundsRelativeToFrame.TopLeft(); }(); + auto relative = clientRectRelativeToFrame; + LOGVERBOSE(" clientRectRelativeToFrame %s", ToString(relative).c_str()); mClientMargin = DesktopIntRect(DesktopIntPoint(), finalBounds.Size()) - clientRectRelativeToFrame; + LOGVERBOSE(" mClientMargin %s", ToString(mClientMargin).c_str()); mClientMargin.EnsureAtLeast(DesktopIntMargin()); } else { // Assume the client margin remains the same.