Bug 1698783 - Make non-native scrollbar size configurable in Windows too. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D108960
This commit is contained in:
Emilio Cobos Álvarez 2021-03-18 19:12:49 +00:00
Родитель c33fc977ba
Коммит 2ef90f0690
5 изменённых файлов: 11 добавлений и 22 удалений

Просмотреть файл

@ -10715,13 +10715,17 @@
mirror: always mirror: always
# The size in CSS pixels at full zoom of the minimum scrollbar width. # The size in CSS pixels at full zoom of the minimum scrollbar width.
- name: widget.non-native-theme.gtk.scrollbar.normal-size - name: widget.non-native-theme.scrollbar.normal-size
type: uint32_t type: uint32_t
#if defined(MOZ_WIDGET_GTK)
value: 12 value: 12
#else
value: 17
#endif
mirror: always mirror: always
# The size in CSS pixels at full zoom of the "thin" scrollbars. # The size in CSS pixels at full zoom of the "thin" scrollbars.
- name: widget.non-native-theme.gtk.scrollbar.thin-size - name: widget.non-native-theme.scrollbar.thin-size
type: uint32_t type: uint32_t
value: 6 value: 6
mirror: always mirror: always

Просмотреть файл

@ -41,18 +41,6 @@ bool nsNativeBasicThemeGTK::ThemeSupportsScrollbarButtons() {
return StaticPrefs::widget_non_native_theme_gtk_scrollbar_allow_buttons(); return StaticPrefs::widget_non_native_theme_gtk_scrollbar_allow_buttons();
} }
auto nsNativeBasicThemeGTK::GetScrollbarSizes(nsPresContext* aPresContext,
StyleScrollbarWidth aWidth,
Overlay) -> ScrollbarSizes {
DPIRatio dpiRatio = GetDPIRatioForScrollbarPart(aPresContext);
CSSCoord size =
aWidth == StyleScrollbarWidth::Thin
? StaticPrefs::widget_non_native_theme_gtk_scrollbar_thin_size()
: StaticPrefs::widget_non_native_theme_gtk_scrollbar_normal_size();
LayoutDeviceIntCoord s = (size * dpiRatio).Truncated();
return {s, s};
}
NS_IMETHODIMP NS_IMETHODIMP
nsNativeBasicThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext, nsNativeBasicThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
nsIFrame* aFrame, nsIFrame* aFrame,

Просмотреть файл

@ -40,8 +40,6 @@ class nsNativeBasicThemeGTK : public nsNativeBasicTheme {
DPIRatio); DPIRatio);
bool ThemeSupportsScrollbarButtons() override; bool ThemeSupportsScrollbarButtons() override;
ScrollbarSizes GetScrollbarSizes(nsPresContext*, StyleScrollbarWidth,
Overlay) override;
protected: protected:
virtual ~nsNativeBasicThemeGTK() = default; virtual ~nsNativeBasicThemeGTK() = default;

Просмотреть файл

@ -1518,7 +1518,7 @@ void nsNativeBasicTheme::PaintScrollbarButton(
float arrowPolygonX[] = {-4.0f, 0.0f, 4.0f, 4.0f, 0.0f, -4.0f}; float arrowPolygonX[] = {-4.0f, 0.0f, 4.0f, 4.0f, 0.0f, -4.0f};
float arrowPolygonY[] = {0.0f, -4.0f, 0.0f, 3.0f, -1.0f, 3.0f}; float arrowPolygonY[] = {0.0f, -4.0f, 0.0f, 3.0f, -1.0f, 3.0f};
const float kPolygonSize = kMinimumScrollbarSize; const float kPolygonSize = 17;
const int32_t arrowNumPoints = ArrayLength(arrowPolygonX); const int32_t arrowNumPoints = ArrayLength(arrowPolygonX);
switch (aAppearance) { switch (aAppearance) {
@ -1934,9 +1934,10 @@ bool nsNativeBasicTheme::GetWidgetOverflow(nsDeviceContext* aContext,
auto nsNativeBasicTheme::GetScrollbarSizes(nsPresContext* aPresContext, auto nsNativeBasicTheme::GetScrollbarSizes(nsPresContext* aPresContext,
StyleScrollbarWidth aWidth, Overlay) StyleScrollbarWidth aWidth, Overlay)
-> ScrollbarSizes { -> ScrollbarSizes {
CSSCoord size = aWidth == StyleScrollbarWidth::Thin CSSCoord size =
? kMinimumThinScrollbarSize aWidth == StyleScrollbarWidth::Thin
: kMinimumScrollbarSize; ? StaticPrefs::widget_non_native_theme_scrollbar_thin_size()
: StaticPrefs::widget_non_native_theme_scrollbar_normal_size();
LayoutDeviceIntCoord s = LayoutDeviceIntCoord s =
(size * GetDPIRatioForScrollbarPart(aPresContext)).Rounded(); (size * GetDPIRatioForScrollbarPart(aPresContext)).Rounded();
return {s, s}; return {s, s};

Просмотреть файл

@ -66,8 +66,6 @@ static const gfx::sRGBColor sScrollbarBorderColor(gfx::sRGBColor(1.0f, 1.0f,
static const gfx::sRGBColor sScrollbarThumbColor( static const gfx::sRGBColor sScrollbarThumbColor(
gfx::sRGBColor::UnusualFromARGB(0xffcdcdcd)); gfx::sRGBColor::UnusualFromARGB(0xffcdcdcd));
static const CSSCoord kMinimumScrollbarSize = 17.0f;
static const CSSCoord kMinimumThinScrollbarSize = 6.0f;
static const CSSCoord kMinimumColorPickerHeight = 32.0f; static const CSSCoord kMinimumColorPickerHeight = 32.0f;
static const CSSCoord kMinimumRangeThumbSize = 20.0f; static const CSSCoord kMinimumRangeThumbSize = 20.0f;
static const CSSCoord kMinimumDropdownArrowButtonWidth = 18.0f; static const CSSCoord kMinimumDropdownArrowButtonWidth = 18.0f;