зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1469741 part 1 - Apply scrollbar colors to background of some scrollbar parts when theme doesn't support them. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D3578 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9197cbf364
Коммит
ee8b85324b
|
@ -2530,6 +2530,43 @@ DrawBackgroundColor(nsCSSRendering::ImageLayerClipState& aClipState,
|
||||||
aCtx->Restore();
|
aCtx->Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Maybe<nscolor>
|
||||||
|
CalcScrollbarColor(nsIFrame* aFrame, StyleComplexColor nsStyleUI::* aColor)
|
||||||
|
{
|
||||||
|
ComputedStyle* scrollbarStyle = nsLayoutUtils::StyleForScrollbar(aFrame);
|
||||||
|
auto color = scrollbarStyle->StyleUI()->*aColor;
|
||||||
|
if (color.IsAuto()) {
|
||||||
|
return Nothing();
|
||||||
|
}
|
||||||
|
return Some(color.CalcColor(scrollbarStyle));
|
||||||
|
}
|
||||||
|
|
||||||
|
static nscolor
|
||||||
|
GetBackgroundColor(nsIFrame* aFrame, ComputedStyle* aComputedStyle)
|
||||||
|
{
|
||||||
|
Maybe<nscolor> overrideColor = Nothing();
|
||||||
|
switch (aComputedStyle->StyleDisplay()->mAppearance) {
|
||||||
|
case StyleAppearance::ScrollbarthumbVertical:
|
||||||
|
case StyleAppearance::ScrollbarthumbHorizontal:
|
||||||
|
overrideColor =
|
||||||
|
CalcScrollbarColor(aFrame, &nsStyleUI::mScrollbarFaceColor);
|
||||||
|
break;
|
||||||
|
case StyleAppearance::ScrollbarVertical:
|
||||||
|
case StyleAppearance::ScrollbarHorizontal:
|
||||||
|
case StyleAppearance::Scrollcorner:
|
||||||
|
overrideColor =
|
||||||
|
CalcScrollbarColor(aFrame, &nsStyleUI::mScrollbarTrackColor);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (overrideColor.isSome()) {
|
||||||
|
return *overrideColor;
|
||||||
|
}
|
||||||
|
return aComputedStyle->
|
||||||
|
GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
nscolor
|
nscolor
|
||||||
nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext,
|
nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext,
|
||||||
ComputedStyle* aComputedStyle,
|
ComputedStyle* aComputedStyle,
|
||||||
|
@ -2551,8 +2588,7 @@ nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext,
|
||||||
const nsStyleBackground *bg = aComputedStyle->StyleBackground();
|
const nsStyleBackground *bg = aComputedStyle->StyleBackground();
|
||||||
nscolor bgColor;
|
nscolor bgColor;
|
||||||
if (aDrawBackgroundColor) {
|
if (aDrawBackgroundColor) {
|
||||||
bgColor = aComputedStyle->
|
bgColor = GetBackgroundColor(aFrame, aComputedStyle);
|
||||||
GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor);
|
|
||||||
if (NS_GET_A(bgColor) == 0) {
|
if (NS_GET_A(bgColor) == 0) {
|
||||||
aDrawBackgroundColor = false;
|
aDrawBackgroundColor = false;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче