Bug 1464723 - Implement custom scrollbar support for GTK widget. r=karlt,dholbert

When any scrollbar color is specified, or scrollbar-width is thin, we
switch to use the fallback rendering.

The change to xulscrollbars.css is for ensuring that the scrollbar is
displayed for scrollbar-width: thin when there is no scrollbar color
specified. It wouldn't affect cases where -moz-appearance takes effect.

This also changes the fallback width of the scrollbars. Since the two
widths was picked rather randomly, I think it should be fine to change
it if a value looks better than the old one, especially on Linux which
is the main usecase for this fallback rendering.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Xidorn Quan 2018-08-24 07:40:07 +00:00
Родитель 4e4875fdd6
Коммит 9daee9a3a5
3 изменённых файлов: 16 добавлений и 2 удалений

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

@ -532,9 +532,9 @@ GetScrollbarWidthNoTheme(nsIFrame* aBox)
switch (scrollbarStyle->StyleUIReset()->mScrollbarWidth) {
default:
case StyleScrollbarWidth::Auto:
return 16 * AppUnitsPerCSSPixel();
return 12 * AppUnitsPerCSSPixel();
case StyleScrollbarWidth::Thin:
return 8 * AppUnitsPerCSSPixel();
return 6 * AppUnitsPerCSSPixel();
case StyleScrollbarWidth::None:
return 0;
}

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

@ -14,6 +14,7 @@
scrollbar {
-moz-appearance: scrollbar-horizontal;
cursor: default;
background-color: #f0f0f0;
}
@media all and (-moz-overlay-scrollbars) {
@ -43,6 +44,10 @@ slider[orient="vertical"] {
/* ::::: thumb (horizontal) ::::: */
thumb {
background-color: #cdcdcd;
}
thumb[orient="vertical"] {
-moz-appearance: scrollbarthumb-vertical;
min-height: 8px;

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

@ -1866,6 +1866,15 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
if (IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType))
return false;
if (IsWidgetScrollbarPart(aWidgetType)) {
ComputedStyle* cs = nsLayoutUtils::StyleForScrollbar(aFrame);
if (cs->StyleUI()->HasCustomScrollbars() ||
// We cannot handle thin scrollbar on GTK+ widget directly as well.
cs->StyleUIReset()->mScrollbarWidth == StyleScrollbarWidth::Thin) {
return false;
}
}
if (aWidgetType == StyleAppearance::MenulistButton &&
StaticPrefs::layout_css_webkit_appearance_enabled()) {
aWidgetType = StyleAppearance::Menulist;