- Revision
- 293812
- Author
- akeer...@apple.com
- Date
- 2022-05-04 18:53:23 -0700 (Wed, 04 May 2022)
Log Message
Indeterminate, checked checkboxes do not render correctly on iOS, GTK, and Windows
https://bugs.webkit.org/show_bug.cgi?id=240015
rdar://92645056
Reviewed by Cameron McCormack.
Source/WebCore:
Checkboxes can have the indeterminate and checked attributes set to
true at the same time. In this scenario, an indeterminate appearance
should be rendered. Reorder logic to ensure that the indeterminate
attribute has precedence when deciding what to draw. This approach
aligns with the macOS logic in ThemeMac.
Test: fast/forms/checkbox-checked-indeterminate.html
* platform/adwaita/ThemeAdwaita.cpp:
(WebCore::ThemeAdwaita::paintCheckbox):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintCheckbox):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::determineState):
LayoutTests:
Added a reference test to to verify that indeterminate, checked
checkboxes have the same appearance as indeterminate checkboxes.
* fast/forms/checkbox-checked-indeterminate-expected.html: Added.
* fast/forms/checkbox-checked-indeterminate.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (293811 => 293812)
--- trunk/LayoutTests/ChangeLog 2022-05-05 01:34:14 UTC (rev 293811)
+++ trunk/LayoutTests/ChangeLog 2022-05-05 01:53:23 UTC (rev 293812)
@@ -1,3 +1,17 @@
+2022-05-04 Aditya Keerthi <akeer...@apple.com>
+
+ Indeterminate, checked checkboxes do not render correctly on iOS, GTK, and Windows
+ https://bugs.webkit.org/show_bug.cgi?id=240015
+ rdar://92645056
+
+ Reviewed by Cameron McCormack.
+
+ Added a reference test to to verify that indeterminate, checked
+ checkboxes have the same appearance as indeterminate checkboxes.
+
+ * fast/forms/checkbox-checked-indeterminate-expected.html: Added.
+ * fast/forms/checkbox-checked-indeterminate.html: Added.
+
2022-05-04 Karl Rackler <rack...@apple.com>
[ iOS ] fast/text/international/system-language/navigator-language/navigator-language-fr.html is a flaky failure
Added: trunk/LayoutTests/fast/forms/checkbox-checked-indeterminate-expected.html (0 => 293812)
--- trunk/LayoutTests/fast/forms/checkbox-checked-indeterminate-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/checkbox-checked-indeterminate-expected.html 2022-05-05 01:53:23 UTC (rev 293812)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<script>
+function runTest() {
+ checkbox.indeterminate = true;
+}
+</script>
+<body _onload_="runTest()">
+<input type="checkbox" id="checkbox">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/checkbox-checked-indeterminate.html (0 => 293812)
--- trunk/LayoutTests/fast/forms/checkbox-checked-indeterminate.html (rev 0)
+++ trunk/LayoutTests/fast/forms/checkbox-checked-indeterminate.html 2022-05-05 01:53:23 UTC (rev 293812)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<script>
+function runTest() {
+ checkbox.indeterminate = true;
+}
+</script>
+<body _onload_="runTest()">
+<input type="checkbox" id="checkbox" checked>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (293811 => 293812)
--- trunk/Source/WebCore/ChangeLog 2022-05-05 01:34:14 UTC (rev 293811)
+++ trunk/Source/WebCore/ChangeLog 2022-05-05 01:53:23 UTC (rev 293812)
@@ -1,3 +1,26 @@
+2022-05-04 Aditya Keerthi <akeer...@apple.com>
+
+ Indeterminate, checked checkboxes do not render correctly on iOS, GTK, and Windows
+ https://bugs.webkit.org/show_bug.cgi?id=240015
+ rdar://92645056
+
+ Reviewed by Cameron McCormack.
+
+ Checkboxes can have the indeterminate and checked attributes set to
+ true at the same time. In this scenario, an indeterminate appearance
+ should be rendered. Reorder logic to ensure that the indeterminate
+ attribute has precedence when deciding what to draw. This approach
+ aligns with the macOS logic in ThemeMac.
+
+ Test: fast/forms/checkbox-checked-indeterminate.html
+
+ * platform/adwaita/ThemeAdwaita.cpp:
+ (WebCore::ThemeAdwaita::paintCheckbox):
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::paintCheckbox):
+ * rendering/RenderThemeWin.cpp:
+ (WebCore::RenderThemeWin::determineState):
+
2022-05-04 Eric Carlson <eric.carl...@apple.com>
[macOS] ScreenCaptureKitCaptureSource should stop content sharing session when capture ends
Modified: trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp (293811 => 293812)
--- trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp 2022-05-05 01:34:14 UTC (rev 293811)
+++ trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp 2022-05-05 01:53:23 UTC (rev 293812)
@@ -272,7 +272,9 @@
GraphicsContextStateSaver checkedStateSaver(graphicsContext);
graphicsContext.translate(fieldRect.x(), fieldRect.y());
graphicsContext.scale(FloatSize::narrowPrecision(fieldRect.width() / toggleSize, fieldRect.height() / toggleSize));
- if (states.states().contains(ControlStates::States::Checked)) {
+ if (states.states().contains(ControlStates::States::Indeterminate))
+ path.addRoundedRect(FloatRect(2, 5, 10, 4), corner);
+ else {
path.moveTo({ 2.43, 6.57 });
path.addLineTo({ 7.5, 11.63 });
path.addLineTo({ 14, 5 });
@@ -280,8 +282,7 @@
path.addLineTo({ 7.5, 7.38 });
path.addLineTo({ 4.56, 4.44 });
path.closeSubpath();
- } else
- path.addRoundedRect(FloatRect(2, 5, 10, 4), corner);
+ }
graphicsContext.setFillColor(foregroundColor);
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (293811 => 293812)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2022-05-05 01:34:14 UTC (rev 293811)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2022-05-05 01:53:23 UTC (rev 293812)
@@ -2180,7 +2180,14 @@
}
Path path;
- if (checked) {
+ if (indeterminate) {
+ const FloatSize indeterminateBarRoundingRadii(1.25f, 1.25f);
+ constexpr float indeterminateBarPadding = 2.5f;
+ float height = 0.12f * rect.height();
+
+ FloatRect indeterminateBarRect(rect.x() + indeterminateBarPadding, rect.center().y() - height / 2.0f, rect.width() - indeterminateBarPadding * 2, height);
+ path.addRoundedRect(indeterminateBarRect, indeterminateBarRoundingRadii);
+ } else {
path.moveTo({ 28.174f, 68.652f });
path.addBezierCurveTo({ 31.006f, 68.652f }, { 33.154f, 67.578f }, { 34.668f, 65.332f });
path.addLineTo({ 70.02f, 11.28f });
@@ -2202,13 +2209,6 @@
transform.translate(rect.center() - (checkmarkSize * scale * 0.5f));
transform.scale(scale);
path.transform(transform);
- } else {
- const FloatSize indeterminateBarRoundingRadii(1.25f, 1.25f);
- constexpr float indeterminateBarPadding = 2.5f;
- float height = 0.12f * rect.height();
-
- FloatRect indeterminateBarRect(rect.x() + indeterminateBarPadding, rect.center().y() - height / 2.0f, rect.width() - indeterminateBarPadding * 2, height);
- path.addRoundedRect(indeterminateBarRect, indeterminateBarRoundingRadii);
}
context.setFillColor(checkboxRadioIndicatorColor(controlStates, styleColorOptions));
Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (293811 => 293812)
--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp 2022-05-05 01:34:14 UTC (rev 293811)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp 2022-05-05 01:53:23 UTC (rev 293812)
@@ -443,10 +443,10 @@
result = TS_FOCUSED;
else if (isHovered(o))
result = TS_HOVER;
- if (isChecked(o))
+ if (isIndeterminate(o) && appearance == CheckboxPart)
+ result += 8;
+ else if (isChecked(o))
result += 4; // 4 unchecked states, 4 checked states.
- else if (isIndeterminate(o) && appearance == CheckboxPart)
- result += 8;
return result;
}