commit 44c1e061076ff328f8f0f00fd6fc223c4a591ce9
parent 444d4fbc9d66c4ca3a42132958750224bbafa588
Author: Serban Stanca <sstanca@mozilla.com>
Date: Fri, 31 Oct 2025 05:54:12 +0200
Revert "Bug 1993820 - Tweak checked radio rendering to minimize snapping artifacts. r=dholbert" for causing reftests failures in radio-clamp-01.html.
This reverts commit 88016633b31bbc3fa5e7c1b17dcf27fc961a3496.
Diffstat:
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/widget/Theme.cpp b/widget/Theme.cpp
@@ -633,29 +633,26 @@ void Theme::PaintRadioControl(PaintBackendData& aPaintData,
DPIRatio aDpiRatio) {
auto [backgroundColor, borderColor, checkColor] =
ComputeCheckboxColors(aState, StyleAppearance::Radio, aColors);
- const bool isChecked = aState.HasState(ElementState::CHECKED);
{
- CSSCoord outerBorderWidth = kCheckboxRadioBorderWidth;
- auto effectiveBackground = isChecked ? checkColor : backgroundColor;
- if (effectiveBackground == borderColor) {
- outerBorderWidth = 0.0f;
+ CSSCoord borderWidth = kCheckboxRadioBorderWidth;
+ if (backgroundColor == borderColor) {
+ borderWidth = 0.0f;
}
- PaintStrokedCircle(aPaintData, aRect, effectiveBackground, borderColor,
- outerBorderWidth, aDpiRatio);
- }
-
- if (isChecked) {
- // See bug 1951930 / bug 1941755 for discussion on this chunk of code.
- constexpr CSSCoord kInnerBorderWidth = 2.0f;
- LayoutDeviceRect innerCircleBounds(aRect);
- // It's important that these are two different calls so that the snapping of
- // the inner rect matches the one PaintStrokedCircle above does.
- innerCircleBounds.Deflate(
- ThemeDrawing::SnapBorderWidth(kCheckboxRadioBorderWidth, aDpiRatio));
- innerCircleBounds.Deflate(
- ThemeDrawing::SnapBorderWidth(kInnerBorderWidth, aDpiRatio));
- PaintStrokedCircle(aPaintData, innerCircleBounds, backgroundColor,
- sTransparent, 0.0f, aDpiRatio);
+ PaintStrokedCircle(aPaintData, aRect, backgroundColor, borderColor,
+ borderWidth, aDpiRatio);
+ }
+
+ if (aState.HasState(ElementState::CHECKED)) {
+ // See bug 1951930 and bug 1941755 for some discussion on this chunk of
+ // code.
+ const CSSCoord kOuterBorderWidth = 1.0f;
+ const CSSCoord kInnerBorderWidth = 2.0f;
+ LayoutDeviceRect rect(aRect);
+ auto width = LayoutDeviceCoord(
+ ThemeDrawing::SnapBorderWidth(kOuterBorderWidth, aDpiRatio));
+ rect.Deflate(width);
+ PaintStrokedCircle(aPaintData, rect, backgroundColor, checkColor,
+ kInnerBorderWidth, aDpiRatio);
}
if (aState.HasState(ElementState::FOCUSRING)) {