Bug 1685010 - Paint indeterminate checkboxes properly on Windows high contrast mode in the non-native theme. r=spohl

Differential Revision: https://phabricator.services.mozilla.com/D100757
This commit is contained in:
Cameron McCormack 2021-01-05 12:46:09 +00:00
parent b8b0d529d8
commit 88f9c54b10

View File

@ -15,18 +15,20 @@ std::pair<sRGBColor, sRGBColor> nsNativeBasicThemeWin::ComputeCheckboxColors(
bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
bool isChecked = aState.HasState(NS_EVENT_STATE_CHECKED);
bool isIndeterminate = aAppearance == StyleAppearance::Checkbox &&
aState.HasState(NS_EVENT_STATE_INDETERMINATE);
sRGBColor backgroundColor = sRGBColor::FromABGR(
LookAndFeel::GetColor(LookAndFeel::ColorID::TextBackground));
sRGBColor borderColor = sRGBColor::FromABGR(
LookAndFeel::GetColor(LookAndFeel::ColorID::Buttontext));
if (isDisabled && isChecked) {
if (isDisabled && (isChecked || isIndeterminate)) {
backgroundColor = borderColor = sRGBColor::FromABGR(
LookAndFeel::GetColor(LookAndFeel::ColorID::Graytext));
} else if (isDisabled) {
borderColor = sRGBColor::FromABGR(
LookAndFeel::GetColor(LookAndFeel::ColorID::Graytext));
} else if (isChecked) {
} else if (isChecked || isIndeterminate) {
backgroundColor = borderColor = sRGBColor::FromABGR(
LookAndFeel::GetColor(LookAndFeel::ColorID::Highlight));
}