Backed out changeset 0ee82dc106f2 (bug 1624708) for reftest failure on 359903-1.html . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2020-03-25 00:22:30 +02:00
Родитель 78dff22220
Коммит 2f0ac811bf
1 изменённых файлов: 4 добавлений и 19 удалений

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

@ -107,7 +107,6 @@ static void ComputeCheckColors(const EventStates& aState,
bool isPressed = !isDisabled && aState.HasAllStates(NS_EVENT_STATE_HOVER | bool isPressed = !isDisabled && aState.HasAllStates(NS_EVENT_STATE_HOVER |
NS_EVENT_STATE_ACTIVE); NS_EVENT_STATE_ACTIVE);
bool isHovered = !isDisabled && aState.HasState(NS_EVENT_STATE_HOVER); 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); bool isChecked = aState.HasState(NS_EVENT_STATE_CHECKED);
sRGBColor fillColor = sBackgroundColor; sRGBColor fillColor = sBackgroundColor;
@ -131,9 +130,6 @@ static void ComputeCheckColors(const EventStates& aState,
} else if (isPressed) { } else if (isPressed) {
fillColor = sBackgroundActiveColor; fillColor = sBackgroundActiveColor;
borderColor = sBorderHoverColor; borderColor = sBorderHoverColor;
} else if (isFocused) {
fillColor = sBackgroundActiveColor;
borderColor = sBorderFocusColor;
} else if (isHovered) { } else if (isHovered) {
fillColor = sBackgroundColor; fillColor = sBackgroundColor;
borderColor = sBorderHoverColor; borderColor = sBorderHoverColor;
@ -302,25 +298,14 @@ static void PaintCheckedRadioButton(DrawTarget* aDrawTarget, const Rect& aRect,
aDrawTarget->Fill(ellipse, ColorPattern(ToDeviceColor(sBackgroundColor))); 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, static void PaintTextField(DrawTarget* aDrawTarget, const Rect& aRect,
const EventStates& aState, uint32_t aDpi) { const EventStates& aState, uint32_t aDpi) {
bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED); bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
bool isHovered = !isDisabled && aState.HasState(NS_EVENT_STATE_HOVER);
const sRGBColor& backgroundColor = const sRGBColor& backgroundColor =
isDisabled ? sDisabledColor : sBackgroundColor; isDisabled ? sDisabledColor : sBackgroundColor;
const sRGBColor borderColor = ComputeBorderColor(aState); const sRGBColor& borderColor = isHovered ? sBorderHoverColor : sBorderColor;
const CSSCoord kRadius = 4.0f; const CSSCoord kRadius = 4.0f;
@ -351,7 +336,7 @@ std::pair<sRGBColor, sRGBColor> ComputeButtonColors(
return sButtonColor; return sButtonColor;
}(); }();
const sRGBColor borderColor = ComputeBorderColor(aState); const sRGBColor& borderColor = isHovered ? sBorderHoverColor : sBorderColor;
return std::make_pair(backgroundColor, borderColor); return std::make_pair(backgroundColor, borderColor);
} }