mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
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:
parent
20a681b496
commit
91ee8905cc
@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user