diff --git a/widget/nsNativeBasicTheme.cpp b/widget/nsNativeBasicTheme.cpp index 9c86ffa03f6c..6cac2bc744d1 100644 --- a/widget/nsNativeBasicTheme.cpp +++ b/widget/nsNativeBasicTheme.cpp @@ -107,7 +107,6 @@ 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; @@ -131,9 +130,6 @@ 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; @@ -302,25 +298,14 @@ 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 = ComputeBorderColor(aState); + const sRGBColor& borderColor = isHovered ? sBorderHoverColor : sBorderColor; const CSSCoord kRadius = 4.0f; @@ -351,7 +336,7 @@ std::pair ComputeButtonColors( return sButtonColor; }(); - const sRGBColor borderColor = ComputeBorderColor(aState); + const sRGBColor& borderColor = isHovered ? sBorderHoverColor : sBorderColor; return std::make_pair(backgroundColor, borderColor); }