Bug 1753830 - Take GTK unthemed scrollbar colors from Adwaita. r=stransky

Rather than windows 10, which has much wider scrollbars.

Differential Revision: https://phabricator.services.mozilla.com/D137938
This commit is contained in:
Emilio Cobos Álvarez 2022-02-08 16:36:12 +00:00
parent 20a681b496
commit 91ee8905cc
3 changed files with 16 additions and 16 deletions

View File

@ -124,12 +124,15 @@ sRGBColor ScrollbarDrawing::ComputeScrollbarTrackColor(
return sRGBColor::FromABGR(
ui->mScrollbarColor.AsColors().track.CalcColor(aStyle));
}
if (aDocumentState.HasAllStates(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
return aColors.SystemOrElse(StyleSystemColor::ThemedScrollbarInactive,
[] { return sScrollbarColor; });
}
return aColors.SystemOrElse(StyleSystemColor::ThemedScrollbar,
[] { return sScrollbarColor; });
static constexpr gfx::sRGBColor sDefaultTrackColor(
gfx::sRGBColor::UnusualFromARGB(0xfff0f0f0));
auto systemColor =
aDocumentState.HasAllStates(NS_DOCUMENT_STATE_WINDOW_INACTIVE)
? StyleSystemColor::ThemedScrollbarInactive
: StyleSystemColor::ThemedScrollbar;
return aColors.SystemOrElse(systemColor, [] { return sDefaultTrackColor; });
}
// Don't use the theme color for dark scrollbars if it's not a color (if it's
@ -191,7 +194,7 @@ sRGBColor ScrollbarDrawing::ComputeScrollbarThumbColor(
return aColors.SystemOrElse(systemColor, [&] {
return sRGBColor::FromABGR(ThemeColors::AdjustUnthemedScrollbarThumbColor(
sScrollbarThumbColor.ToABGR(), aElementState));
NS_RGB(0xcd, 0xcd, 0xcd), aElementState));
});
}

View File

@ -17,11 +17,6 @@
namespace mozilla::widget {
static constexpr gfx::sRGBColor sScrollbarColor(
gfx::sRGBColor::UnusualFromARGB(0xfff0f0f0));
static constexpr gfx::sRGBColor sScrollbarThumbColor(
gfx::sRGBColor::UnusualFromARGB(0xffcdcdcd));
class ScrollbarDrawing {
protected:
using DPIRatio = mozilla::CSSToLayoutDeviceScale;

View File

@ -1604,15 +1604,17 @@ void nsLookAndFeel::PerThemeData::Init() {
}();
if (fallbackToUnthemedColors) {
mMozScrollbar = mThemedScrollbar = widget::sScrollbarColor.ToABGR();
mThemedScrollbarInactive = widget::sScrollbarColor.ToABGR();
mThemedScrollbarThumb = widget::sScrollbarThumbColor.ToABGR();
// Taken from Adwaita.
mMozScrollbar = mThemedScrollbar = NS_RGB(0xce, 0xce, 0xce);
mThemedScrollbarInactive = NS_RGB(0xec, 0xed, 0xef);
mThemedScrollbarThumb = NS_RGB(0x82, 0x81, 0x7e);
mThemedScrollbarThumbInactive = NS_RGB(0xce, 0xcf, 0xce);
mThemedScrollbarThumbHover = ThemeColors::AdjustUnthemedScrollbarThumbColor(
mThemedScrollbarThumb, NS_EVENT_STATE_HOVER);
mThemedScrollbarThumbActive =
ThemeColors::AdjustUnthemedScrollbarThumbColor(mThemedScrollbarThumb,
NS_EVENT_STATE_ACTIVE);
mThemedScrollbarThumbInactive = mThemedScrollbarThumb;
}
// The label is not added to a parent widget, but shared for constructing