зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1624708 - Make non-native theme keyboard navigable. r=spohl
By painting focus colors. I suspect this was mostly an oversight? But it is the most obvious issue I always find with this theme. I followed active > focus > hover, which seems to match what GTK does (and makes sense, generally). Differential Revision: https://phabricator.services.mozilla.com/D68088 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e1dadb10e3
Коммит
403e32fa76
|
@ -107,6 +107,7 @@ static void ComputeCheckColors(const EventStates& aState,
|
|||
bool isPressed = !isDisabled && aState.HasAllStates(NS_EVENT_STATE_HOVER |
|
||||
NS_EVENT_STATE_ACTIVE);
|
||||
bool isHovered = !isDisabled && aState.HasState(NS_EVENT_STATE_HOVER);
|
||||
bool isFocused = aState.HasState(NS_EVENT_STATE_FOCUS);
|
||||
bool isChecked = aState.HasState(NS_EVENT_STATE_CHECKED);
|
||||
|
||||
sRGBColor fillColor = sBackgroundColor;
|
||||
|
@ -130,6 +131,9 @@ static void ComputeCheckColors(const EventStates& aState,
|
|||
} else if (isPressed) {
|
||||
fillColor = sBackgroundActiveColor;
|
||||
borderColor = sBorderHoverColor;
|
||||
} else if (isFocused) {
|
||||
fillColor = sBackgroundActiveColor;
|
||||
borderColor = sBorderFocusColor;
|
||||
} else if (isHovered) {
|
||||
fillColor = sBackgroundColor;
|
||||
borderColor = sBorderHoverColor;
|
||||
|
@ -298,14 +302,25 @@ static void PaintCheckedRadioButton(DrawTarget* aDrawTarget, const Rect& aRect,
|
|||
aDrawTarget->Fill(ellipse, ColorPattern(ToDeviceColor(sBackgroundColor)));
|
||||
}
|
||||
|
||||
static sRGBColor ComputeBorderColor(const EventStates& aState) {
|
||||
bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
|
||||
bool isHovered = !isDisabled && aState.HasState(NS_EVENT_STATE_HOVER);
|
||||
bool isFocused = aState.HasState(NS_EVENT_STATE_FOCUS);
|
||||
if (isFocused) {
|
||||
return sBorderFocusColor;
|
||||
}
|
||||
if (isHovered) {
|
||||
return sBorderHoverColor;
|
||||
}
|
||||
return sBorderColor;
|
||||
}
|
||||
|
||||
static void PaintTextField(DrawTarget* aDrawTarget, const Rect& aRect,
|
||||
const EventStates& aState, uint32_t aDpi) {
|
||||
bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
|
||||
bool isHovered = !isDisabled && aState.HasState(NS_EVENT_STATE_HOVER);
|
||||
|
||||
const sRGBColor& backgroundColor =
|
||||
isDisabled ? sDisabledColor : sBackgroundColor;
|
||||
const sRGBColor& borderColor = isHovered ? sBorderHoverColor : sBorderColor;
|
||||
const sRGBColor borderColor = ComputeBorderColor(aState);
|
||||
|
||||
const CSSCoord kRadius = 4.0f;
|
||||
|
||||
|
@ -336,7 +351,7 @@ std::pair<sRGBColor, sRGBColor> ComputeButtonColors(
|
|||
return sButtonColor;
|
||||
}();
|
||||
|
||||
const sRGBColor& borderColor = isHovered ? sBorderHoverColor : sBorderColor;
|
||||
const sRGBColor borderColor = ComputeBorderColor(aState);
|
||||
|
||||
return std::make_pair(backgroundColor, borderColor);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче