tor-browser

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

commit 0a310bf4d7c6921c559a7ffb248c164c6095c7cc
parent c141abb081a2a3d2ef3b4aeb70b9476a6b84677e
Author: Greg Stoll <gstoll@mozilla.com>
Date:   Mon, 20 Oct 2025 18:18:35 +0000

Bug 1956974 - make thin scrollbars have thumb buttons on Windows r=spohl,win-reviewers,desktop-theme-reviewers,handyman,emilio

Per the bug, all thin scrollbars in the Windows OS (that I could find)
do have thumb buttons for scrolling up/down, so we should match that.

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

Diffstat:
Mwidget/ScrollbarDrawing.cpp | 6------
Mwidget/ScrollbarDrawing.h | 1-
Mwidget/ScrollbarDrawingWin.cpp | 5-----
Mwidget/ScrollbarDrawingWin11.cpp | 3---
Mwidget/Theme.cpp | 27++++++++++++---------------
5 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/widget/ScrollbarDrawing.cpp b/widget/ScrollbarDrawing.cpp @@ -72,12 +72,6 @@ bool ScrollbarDrawing::IsScrollbarWidthThin(const ComputedStyle& aStyle) { return scrollbarWidth == StyleScrollbarWidth::Thin; } -/*static*/ -bool ScrollbarDrawing::IsScrollbarWidthThin(nsIFrame* aFrame) { - ComputedStyle* style = nsLayoutUtils::StyleForScrollbar(aFrame); - return IsScrollbarWidthThin(*style); -} - CSSIntCoord ScrollbarDrawing::GetCSSScrollbarSize(StyleScrollbarWidth aWidth, Overlay aOverlay) const { return mScrollbarSize[aWidth == StyleScrollbarWidth::Thin] diff --git a/widget/ScrollbarDrawing.h b/widget/ScrollbarDrawing.h @@ -55,7 +55,6 @@ class ScrollbarDrawing { static bool IsParentScrollbarHoveredOrActive(nsIFrame* aFrame); static bool IsScrollbarWidthThin(const ComputedStyle& aStyle); - static bool IsScrollbarWidthThin(nsIFrame* aFrame); CSSIntCoord GetCSSScrollbarSize(StyleScrollbarWidth, Overlay) const; LayoutDeviceIntCoord GetScrollbarSize(const nsPresContext*, diff --git a/widget/ScrollbarDrawingWin.cpp b/widget/ScrollbarDrawingWin.cpp @@ -24,11 +24,6 @@ LayoutDeviceIntSize ScrollbarDrawingWin::GetMinimumWidgetSize( case StyleAppearance::ScrollbarbuttonDown: case StyleAppearance::ScrollbarbuttonLeft: case StyleAppearance::ScrollbarbuttonRight: - // For scrollbar-width:thin, we don't display the buttons. - if (IsScrollbarWidthThin(aFrame)) { - return LayoutDeviceIntSize{}; - } - [[fallthrough]]; case StyleAppearance::ScrollbarVertical: case StyleAppearance::ScrollbarHorizontal: case StyleAppearance::ScrollbarthumbVertical: diff --git a/widget/ScrollbarDrawingWin11.cpp b/widget/ScrollbarDrawingWin11.cpp @@ -59,9 +59,6 @@ LayoutDeviceIntSize ScrollbarDrawingWin11::GetMinimumWidgetSize( case StyleAppearance::ScrollbarbuttonDown: case StyleAppearance::ScrollbarbuttonLeft: case StyleAppearance::ScrollbarbuttonRight: { - if (IsScrollbarWidthThin(aFrame)) { - return {}; - } const LayoutDeviceIntCoord size = ScrollbarDrawing::GetScrollbarSize(aPresContext, aFrame); return LayoutDeviceIntSize{ diff --git a/widget/Theme.cpp b/widget/Theme.cpp @@ -1234,21 +1234,18 @@ bool Theme::DoDrawWidgetBackground(PaintBackendData& aPaintData, case StyleAppearance::ScrollbarbuttonDown: case StyleAppearance::ScrollbarbuttonLeft: case StyleAppearance::ScrollbarbuttonRight: { - // For scrollbar-width:thin, we don't display the buttons. - if (!ScrollbarDrawing::IsScrollbarWidthThin(aFrame)) { - if constexpr (std::is_same_v<PaintBackendData, WebRenderBackendData>) { - // TODO: Need to figure out how to best draw this using WR. - return false; - } else { - bool isHorizontal = - aAppearance == StyleAppearance::ScrollbarbuttonLeft || - aAppearance == StyleAppearance::ScrollbarbuttonRight; - auto kind = ComputeScrollbarKind(aFrame, isHorizontal); - GetScrollbarDrawing().PaintScrollbarButton( - aPaintData, aAppearance, devPxRect, kind, aFrame, - *nsLayoutUtils::StyleForScrollbar(aFrame), elementState, colors, - dpiRatio); - } + if constexpr (std::is_same_v<PaintBackendData, WebRenderBackendData>) { + // TODO: Need to figure out how to best draw this using WR. + return false; + } else { + bool isHorizontal = + aAppearance == StyleAppearance::ScrollbarbuttonLeft || + aAppearance == StyleAppearance::ScrollbarbuttonRight; + auto kind = ComputeScrollbarKind(aFrame, isHorizontal); + GetScrollbarDrawing().PaintScrollbarButton( + aPaintData, aAppearance, devPxRect, kind, aFrame, + *nsLayoutUtils::StyleForScrollbar(aFrame), elementState, colors, + dpiRatio); } break; }