Bug 1902068 - Fix HCM styling of input type="range". r=accessibility-frontend-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D214417
This commit is contained in:
Irene Ni 2024-06-25 14:25:33 +00:00
Родитель c1981fb077
Коммит 4f54c3f81f
1 изменённых файлов: 47 добавлений и 14 удалений

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

@ -345,16 +345,28 @@ std::pair<sRGBColor, sRGBColor> Theme::ComputeTextfieldColors(
std::pair<sRGBColor, sRGBColor> Theme::ComputeRangeProgressColors(
const ElementState& aState, const Colors& aColors) {
if (aColors.HighContrast()) {
return aColors.SystemPair(StyleSystemColor::Selecteditem,
StyleSystemColor::Buttontext);
}
bool isActive =
aState.HasAllStates(ElementState::HOVER | ElementState::ACTIVE);
bool isDisabled = aState.HasState(ElementState::DISABLED);
bool isHovered = aState.HasState(ElementState::HOVER);
if (aColors.HighContrast()) {
if (isDisabled) {
return aColors.SystemPair(StyleSystemColor::Graytext,
StyleSystemColor::Graytext);
}
if (isActive) {
return aColors.SystemPair(StyleSystemColor::Selecteditem,
StyleSystemColor::Buttontext);
}
if (isHovered) {
return aColors.SystemPair(StyleSystemColor::Selecteditem,
StyleSystemColor::Selecteditem);
}
return aColors.SystemPair(StyleSystemColor::Buttontext,
StyleSystemColor::Buttontext);
}
if (isDisabled) {
return std::make_pair(sColorGrey40Alpha50, sColorGrey40Alpha50);
}
@ -367,15 +379,28 @@ std::pair<sRGBColor, sRGBColor> Theme::ComputeRangeProgressColors(
std::pair<sRGBColor, sRGBColor> Theme::ComputeRangeTrackColors(
const ElementState& aState, const Colors& aColors) {
if (aColors.HighContrast()) {
return aColors.SystemPair(StyleSystemColor::Window,
StyleSystemColor::Buttontext);
}
bool isActive =
aState.HasAllStates(ElementState::HOVER | ElementState::ACTIVE);
bool isDisabled = aState.HasState(ElementState::DISABLED);
bool isHovered = aState.HasState(ElementState::HOVER);
if (aColors.HighContrast()) {
if (isDisabled) {
return aColors.SystemPair(StyleSystemColor::Buttonface,
StyleSystemColor::Graytext);
}
if (isActive) {
return aColors.SystemPair(StyleSystemColor::Buttonface,
StyleSystemColor::Buttontext);
}
if (isHovered) {
return aColors.SystemPair(StyleSystemColor::Selecteditemtext,
StyleSystemColor::Selecteditem);
}
return aColors.SystemPair(StyleSystemColor::Buttonface,
StyleSystemColor::Buttontext);
}
if (isDisabled) {
return std::make_pair(sColorGrey10Alpha50, sColorGrey40Alpha50);
}
@ -387,16 +412,24 @@ std::pair<sRGBColor, sRGBColor> Theme::ComputeRangeTrackColors(
std::pair<sRGBColor, sRGBColor> Theme::ComputeRangeThumbColors(
const ElementState& aState, const Colors& aColors) {
if (aColors.HighContrast()) {
return aColors.SystemPair(StyleSystemColor::Selecteditemtext,
StyleSystemColor::Selecteditem);
}
bool isActive =
aState.HasAllStates(ElementState::HOVER | ElementState::ACTIVE);
bool isDisabled = aState.HasState(ElementState::DISABLED);
bool isHovered = aState.HasState(ElementState::HOVER);
if (aColors.HighContrast()) {
if (isDisabled) {
return aColors.SystemPair(StyleSystemColor::Buttonface,
StyleSystemColor::Graytext);
}
if (isActive || isHovered) {
return aColors.SystemPair(StyleSystemColor::Selecteditemtext,
StyleSystemColor::Selecteditem);
}
return aColors.SystemPair(StyleSystemColor::Buttonface,
StyleSystemColor::Buttontext);
}
const sRGBColor& backgroundColor = [&] {
if (isDisabled) {
return sColorGrey40;