tor-browser

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

commit 0de0fe7b26f4c4936e34ae3629331bba92321291
parent e03e557a603309aea9838273773779e874c45b06
Author: stransky <stransky@redhat.com>
Date:   Thu, 20 Nov 2025 13:18:15 +0000

Bug 1998657 [Wayland] Update fractional scale & popup logging r=emilio

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

Diffstat:
Mwidget/gtk/WaylandSurface.cpp | 32+++++++++++++++++++++++++++++---
Mwidget/gtk/nsWindow.cpp | 7++++---
2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/widget/gtk/WaylandSurface.cpp b/widget/gtk/WaylandSurface.cpp @@ -27,6 +27,7 @@ # include "Units.h" # undef LOGWAYLAND # undef LOGVERBOSE +# undef LOG_ENABLED_VERBOSE extern mozilla::LazyLogModule gWidgetWaylandLog; # define LOGWAYLAND(str, ...) \ MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Debug, \ @@ -38,12 +39,16 @@ extern mozilla::LazyLogModule gWidgetWaylandLog; MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) # define LOGS_VERBOSE(...) \ MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Verbose, (__VA_ARGS__)) +# define LOG_ENABLED_VERBOSE() \ + MOZ_LOG_TEST(gWidgetWaylandLog, mozilla::LogLevel::Verbose) #else # define LOGWAYLAND(...) # undef LOGVERBOSE +# undef LOG_ENABLED_VERBOSE # define LOGVERBOSE(...) # define LOGS(...) # define LOGS_VERBOSE(...) +# define LOG_ENABLED_VERBOSE(...) #endif /* MOZ_LOGGING */ using namespace mozilla; @@ -136,6 +141,10 @@ void WaylandSurface::FrameCallbackHandler(struct wl_callback* aCallback, // Don't run emulated callbacks on hidden surfaces if ((emulatedCallback || aRoutedFromChildSurface) && !mIsVisible) { + LOGVERBOSE( + "WaylandSurface::FrameCallbackHandler() quit, emulatedCallback %d " + "aRoutedFromChildSurface %d mIsVisible %d", + emulatedCallback, aRoutedFromChildSurface, !mIsVisible); return; } @@ -161,6 +170,9 @@ void WaylandSurface::FrameCallbackHandler(struct wl_callback* aCallback, // We're getting regular frame callback from this surface so we must // have buffer attached. if (!emulatedCallback && !aRoutedFromChildSurface) { + LOGVERBOSE( + "WaylandSurface::FrameCallbackHandler() marked as visible & has " + "buffer"); mIsVisible = true; mBufferAttached = true; } @@ -1140,16 +1152,30 @@ GdkWindow* WaylandSurface::GetGdkWindow() const { } double WaylandSurface::GetScale() { +#ifdef MOZ_LOGGING + static float lastLoggedScale = 0.0; +#endif + if (mScreenScale != sNoScale) { - LOGVERBOSE("WaylandSurface::GetScale() fractional scale %f", - (double)mScreenScale); +#ifdef MOZ_LOGGING + if (LOG_ENABLED_VERBOSE() && lastLoggedScale != mScreenScale) { + lastLoggedScale = mScreenScale; + LOGVERBOSE("WaylandSurface::GetScale() fractional scale %f", + (double)mScreenScale); + } +#endif return mScreenScale; } // We don't have scale yet - query parent surface if there's any. if (mParent) { auto scale = mParent->GetScale(); - LOGVERBOSE("WaylandSurface::GetScale() parent scale %f", scale); +#ifdef MOZ_LOGGING + if (LOG_ENABLED_VERBOSE() && lastLoggedScale != scale) { + lastLoggedScale = scale; + LOGVERBOSE("WaylandSurface::GetScale() parent scale %f", scale); + } +#endif return scale; } diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp @@ -970,7 +970,7 @@ bool nsWindow::ToplevelUsesCSD() const { #ifdef MOZ_WAYLAND if (GdkIsWaylandDisplay()) { static auto sGdkWaylandDisplayPrefersSsd = - (gboolean(*)(const GdkWaylandDisplay*))dlsym( + (gboolean (*)(const GdkWaylandDisplay*))dlsym( RTLD_DEFAULT, "gdk_wayland_display_prefers_ssd"); // NOTE(emilio): Not using GDK_WAYLAND_DISPLAY to avoid bug 1946088. return !sGdkWaylandDisplayPrefersSsd || @@ -1439,6 +1439,7 @@ void nsWindow::WaylandPopupCloseOrphanedPopups() { LOG(" popup [%p] is waiting to show, close all child popups", popup); dangling = true; } else if (dangling) { + LOG(" popup [%p] is dangling, hide it", popup); popup->WaylandPopupMarkAsClosed(); } popup = popup->mWaylandPopupNext; @@ -5286,7 +5287,7 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) { if (StaticPrefs::apz_gtk_pangesture_enabled() && gtk_check_version(3, 20, 0) == nullptr) { static auto sGdkEventIsScrollStopEvent = - (gboolean(*)(const GdkEvent*))dlsym( + (gboolean (*)(const GdkEvent*))dlsym( RTLD_DEFAULT, "gdk_event_is_scroll_stop_event"); LOG("[%d] pan smooth event dx=%.2f dy=%.2f inprogress=%d\n", @@ -10086,7 +10087,7 @@ RefPtr<nsWindow::ExportHandlePromise> nsWindow::ExportHandle() { auto* toplevel = GetToplevelGdkWindow(); #ifdef MOZ_WAYLAND if (GdkIsWaylandDisplay()) { - static auto sGdkWaylandWindowExportHandle = (gboolean(*)( + static auto sGdkWaylandWindowExportHandle = (gboolean (*)( const GdkWindow*, GdkWaylandWindowExported, gpointer, GDestroyNotify))dlsym(RTLD_DEFAULT, "gdk_wayland_window_export_handle"); if (!sGdkWaylandWindowExportHandle || !toplevel) {