Bug 1701825 - Minor scrollbar tweaks. r=stransky

This is a follow-up that I thought was worth doing, but let me know if
you disagree or what not. I think this produces the best results:

 * For light pages, we still get light scrollbars for the track, but the
   active thumb still uses the dark theme highlight color.

 * For dark pages, we again still use the themed highlight color for the
   thumb, and we use dark scrollbar colors elsewhere like we do now.

Again, let me know if you think this is not worth it, or is too much, or
what not. I've tested this on a decent range of popular GTK themes and
it looks like a clear progression to me.

Differential Revision: https://phabricator.services.mozilla.com/D110203
This commit is contained in:
Emilio Cobos Álvarez 2021-03-30 17:31:33 +00:00
Родитель 2c16065ecb
Коммит 0c995f22b1
3 изменённых файлов: 32 добавлений и 7 удалений

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

@ -10854,6 +10854,13 @@
#endif #endif
mirror: always mirror: always
# Whether the active thumb color should always use the themed colors, even if
# dark scrollbars are in use.
- name: widget.non-native-theme.scrollbar.active-always-themed
type: bool
value: true
mirror: always
# Whether we use the Windows CSS scrollbar sizes, or the scrollbar sizes # Whether we use the Windows CSS scrollbar sizes, or the scrollbar sizes
# defined above. # defined above.
- name: widget.non-native-theme.win.scrollbar.use-system-size - name: widget.non-native-theme.win.scrollbar.use-system-size
@ -10952,13 +10959,23 @@
value: true value: true
mirror: always mirror: always
# Whether scrollbars colors get passed from the real GTK theme even if # Whether the scrollbar thumb active color gets passed from the real GTK theme
# allow-gtk-dark-theme is false. # even if allow-gtk-dark-theme is false.
- name: widget.content.allow-gtk-dark-theme.scrollbars - name: widget.content.allow-gtk-dark-theme.scrollbar_active
type: bool type: bool
value: true value: true
mirror: always mirror: always
# Whether other scrollbar colors get passed from the real GTK theme even if
# allow-gtk-dark-theme is false.
#
# This is default false because light scrollbars usually match better websites,
# and we have automatic scrollbar darkening.
- name: widget.content.allow-gtk-dark-theme.scrollbar
type: bool
value: false
mirror: always
# Whether to use gtk high contrast themes to disable content styling like on # Whether to use gtk high contrast themes to disable content styling like on
# windows high contrast mode. # windows high contrast mode.
- name: widget.content.gtk-high-contrast.enabled - name: widget.content.gtk-high-contrast.enabled

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

@ -1124,9 +1124,11 @@ bool nsLookAndFeel::FromParentTheme(ColorID aID) {
case ColorID::ThemedScrollbarInactive: case ColorID::ThemedScrollbarInactive:
case ColorID::ThemedScrollbarThumb: case ColorID::ThemedScrollbarThumb:
case ColorID::ThemedScrollbarThumbHover: case ColorID::ThemedScrollbarThumbHover:
case ColorID::ThemedScrollbarThumbActive:
case ColorID::ThemedScrollbarThumbInactive: case ColorID::ThemedScrollbarThumbInactive:
return StaticPrefs::widget_content_allow_gtk_dark_theme_scrollbars(); return StaticPrefs::widget_content_allow_gtk_dark_theme_scrollbar();
case ColorID::ThemedScrollbarThumbActive:
return StaticPrefs::
widget_content_allow_gtk_dark_theme_scrollbar_active();
case ColorID::MozAccentColor: case ColorID::MozAccentColor:
case ColorID::MozAccentColorForeground: case ColorID::MozAccentColorForeground:
return StaticPrefs::widget_content_allow_gtk_dark_theme_accent(); return StaticPrefs::widget_content_allow_gtk_dark_theme_accent();

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

@ -664,9 +664,15 @@ sRGBColor nsNativeBasicTheme::ComputeScrollbarThumbColor(
const EventStates& aElementState, const EventStates& aDocumentState, const EventStates& aElementState, const EventStates& aDocumentState,
UseSystemColors aUseSystemColors) { UseSystemColors aUseSystemColors) {
if (!bool(aUseSystemColors) && ShouldUseDarkScrollbar(aFrame, aStyle)) { if (!bool(aUseSystemColors) && ShouldUseDarkScrollbar(aFrame, aStyle)) {
return sRGBColor::FromABGR(AdjustUnthemedScrollbarThumbColor( const bool forceThemed =
NS_RGBA(249, 249, 250, 102), aElementState)); aElementState.HasState(NS_EVENT_STATE_ACTIVE) &&
StaticPrefs::widget_non_native_theme_scrollbar_active_always_themed();
if (!forceThemed) {
return sRGBColor::FromABGR(AdjustUnthemedScrollbarThumbColor(
NS_RGBA(249, 249, 250, 102), aElementState));
}
} }
const nsStyleUI* ui = aStyle.StyleUI(); const nsStyleUI* ui = aStyle.StyleUI();
nscolor color; nscolor color;
if (ui->mScrollbarColor.IsColors()) { if (ui->mScrollbarColor.IsColors()) {