Bug 1698336 - Fix high contrast rendering of <meter>. r=mstange

Using the same color for the track and the meter chunk is not going to
fly of course...

In high contrast, make the colors consistent with <progress>, which
seems like a reasonable thing to do.

Differential Revision: https://phabricator.services.mozilla.com/D108347
This commit is contained in:
Emilio Cobos Álvarez 2021-03-15 21:06:54 +00:00
Родитель 5e0e37888a
Коммит f717a6f4db
2 изменённых файлов: 2 добавлений и 14 удалений

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

@ -459,8 +459,7 @@ std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeProgressTrackColors(
std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeMeterchunkColors(
const EventStates& aMeterState, UseSystemColors aUseSystemColors) {
if (bool(aUseSystemColors)) {
return SystemColorPair(StyleSystemColor::TextBackground,
StyleSystemColor::TextForeground);
return ComputeProgressColors(aUseSystemColors);
}
sRGBColor borderColor = sColorMeterGreen20;
sRGBColor chunkColor = sColorMeterGreen10;
@ -476,15 +475,6 @@ std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeMeterchunkColors(
return std::make_pair(chunkColor, borderColor);
}
std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeMeterTrackColors(
UseSystemColors aUseSystemColors) {
if (bool(aUseSystemColors)) {
return SystemColorPair(StyleSystemColor::TextBackground,
StyleSystemColor::TextForeground);
}
return std::make_pair(sColorGrey10, sColorGrey40);
}
sRGBColor nsNativeBasicTheme::ComputeMenulistArrowButtonColor(
const EventStates& aState, UseSystemColors aUseSystemColors) {
bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
@ -1322,8 +1312,7 @@ void nsNativeBasicTheme::PaintProgress(nsIFrame* aFrame,
{
// Paint the track, unclipped.
auto [backgroundColor, borderColor] =
aIsMeter ? ComputeMeterTrackColors(aUseSystemColors)
: ComputeProgressTrackColors(aUseSystemColors);
ComputeProgressTrackColors(aUseSystemColors);
PaintRoundedRectWithRadius(aPaintData, rect, rect, backgroundColor,
borderColor, borderWidth, radius, aDpiRatio);
}

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

@ -207,7 +207,6 @@ class nsNativeBasicTheme : protected nsNativeTheme, public nsITheme {
std::pair<sRGBColor, sRGBColor> ComputeProgressTrackColors(UseSystemColors);
std::pair<sRGBColor, sRGBColor> ComputeMeterchunkColors(
const EventStates& aMeterState, UseSystemColors);
std::pair<sRGBColor, sRGBColor> ComputeMeterTrackColors(UseSystemColors);
sRGBColor ComputeMenulistArrowButtonColor(const EventStates&,
UseSystemColors);
std::array<sRGBColor, 3> ComputeFocusRectColors(UseSystemColors);