Skip to content

Commit f6ee249

Browse files
committed
[Form Control Refresh] Button elements with submit type appear as normal buttons, color well bleeds slightly outside paint rect
https://bugs.webkit.org/show_bug.cgi?id=297205 rdar://156546077 Reviewed by Abrar Rahman Protyasha, Megan Gardner, and Wenson Hsieh. During style adjustment and control painting for buttons, detect submit buttons using `RenderTheme::isSubmitButton(const Node*)` instead of attempting to downcast to an input element and checking `HTMLInputElement::isSubmitButton`. All fast/forms/form-control-refresh/* tests which contain an input with type `submit` now contain a button with type `submit` as well to improve test comprehensiveness. Due to antialiasing, color-well controls bleed slightly outside their bounding rect. Clip to the paint rect before performing any painting to resolve the issue. `submit-button-text-color-disabled-state.html` erroneously lacked any text, resulting in the test not actually checking text color. Updated the test & expectation to include text, and to account for the new disabled text-color added in 298318@main. Skip the following tests on iOS since the window inactive appearance is not supported: fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode.html fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode.html * LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode-expected.html: * LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode.html: * LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode-expected.html: * LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode.html: * LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-submit-does-not-disappear.html: * LayoutTests/fast/forms/form-control-refresh/button-like-controls-text-color-matches-expected.txt: * LayoutTests/fast/forms/form-control-refresh/button-like-controls-text-color-matches.html: * LayoutTests/fast/forms/form-control-refresh/submit-button-appearance-matches-button-window-inactive-expected.html: * LayoutTests/fast/forms/form-control-refresh/submit-button-appearance-matches-button-window-inactive.html: * LayoutTests/fast/forms/form-control-refresh/submit-button-text-color-disabled-state-expected.html: * LayoutTests/fast/forms/form-control-refresh/submit-button-text-color-disabled-state.html: * LayoutTests/platform/ios/TestExpectations: * Source/WebCore/rendering/RenderTheme.cpp: (WebCore::RenderTheme::isSubmitButton const): * Source/WebCore/rendering/RenderTheme.h: * Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm: (WebCore::RenderThemeCocoa::controlSupportsTints const): (WebCore::RenderThemeCocoa::paintButtonForVectorBasedControls): (WebCore::RenderThemeCocoa::paintColorWellDecorationsForVectorBasedControls): (WebCore::RenderThemeCocoa::adjustButtonStyleForVectorBasedControls const): Canonical link: https://commits.webkit.org/298517@main
1 parent 0dded41 commit f6ee249

15 files changed

+43
-25
lines changed

LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode-expected.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta name="color-scheme" content="dark">
55
<style>
6-
input {
6+
input, button {
77
display: block;
88
}
99
</style>
@@ -16,6 +16,7 @@
1616
<input type="range" min="0" max="4" step="1" list="datalist">
1717
<input type="text" list="datalist">
1818
<input type="submit" value="Submit">
19+
<button type="submit">Submit</button>
1920
<datalist id="datalist">
2021
<option>0</option>
2122
<option>1</option>

LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta name="color-scheme" content="dark">
55
<style>
6-
input {
6+
input, button {
77
accent-color: black;
88
display: block;
99
}
@@ -17,6 +17,7 @@
1717
<input type="range" min="0" max="4" step="1" list="datalist">
1818
<input type="text" list="datalist">
1919
<input type="submit" value="Submit">
20+
<button type="submit">Submit</button>
2021
<datalist id="datalist">
2122
<option>0</option>
2223
<option>1</option>

LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode-expected.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<style>
5-
input {
5+
input, button {
66
display: block;
77
}
88
</style>
@@ -15,6 +15,7 @@
1515
<input type="range" min="0" max="4" step="1" list="datalist">
1616
<input type="text" list="datalist">
1717
<input type="submit" value="Submit">
18+
<button type="submit">Submit</button>
1819
<datalist id="datalist">
1920
<option>0</option>
2021
<option>1</option>

LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<style>
5-
input {
5+
input, button {
66
accent-color: white;
77
display: block;
88
}
@@ -16,6 +16,7 @@
1616
<input type="range" min="0" max="4" step="1" list="datalist">
1717
<input type="text" list="datalist">
1818
<input type="submit" value="Submit">
19+
<button type="submit">Submit</button>
1920
<datalist id="datalist">
2021
<option>0</option>
2122
<option>1</option>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!DOCTYPE html>
22
<html>
33
<input type="submit" style="accent-color: white; zoom:5;">
4+
<button type="submit" style="accent-color: white; zoom:5;">Submit</button>
45
</html>

LayoutTests/fast/forms/form-control-refresh/button-like-controls-text-color-matches-expected.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ This tests that buttons, submit buttons, and select buttons all have the same CS
33
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
44

55

6-
PASS select.style.color == submit.style.color && submit.style.color == button.style.color is true
6+
PASS select.style.color == input_submit.style.color is true
7+
PASS select.style.color == input_button.style.color is true
8+
PASS select.style.color == submit.style.color is true
9+
PASS select.style.color == button.style.color is true
710
PASS successfullyParsed is true
811

912
TEST COMPLETE

LayoutTests/fast/forms/form-control-refresh/button-like-controls-text-color-matches.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
<body>
44
<script src="../../../resources/js-test.js"></script>
55
<input id="select" type="select">
6-
<input id="submit" type="submit">
7-
<input id="button" type="button">
6+
<input id="input_submit" type="submit">
7+
<input id="input_button" type="button">
8+
<button id="submit" type="submit"></button>
9+
<button id="button"></button>
810
<script>
911
description("This tests that buttons, submit buttons, and select buttons all have the same CSS color.");
10-
shouldBeTrue("select.style.color == submit.style.color && submit.style.color == button.style.color");
12+
shouldBeTrue("select.style.color == input_submit.style.color");
13+
shouldBeTrue("select.style.color == input_button.style.color");
14+
shouldBeTrue("select.style.color == submit.style.color");
15+
shouldBeTrue("select.style.color == button.style.color");
1116
</script>
1217
</body>
1318
</html>

LayoutTests/fast/forms/form-control-refresh/submit-button-appearance-matches-button-window-inactive-expected.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<p>This tests that the appearance of submit buttons matches normal buttons when the window is inactive.</p>
55
<input type="button" value="Submit">
66
<input type="button" value="Submit" disabled>
7+
<input type="button" value="Submit">
8+
<input type="button" value="Submit" disabled>
79
</body>
810
<script>
911
if (window.testRunner)

LayoutTests/fast/forms/form-control-refresh/submit-button-appearance-matches-button-window-inactive.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<p>This tests that the appearance of submit buttons matches normal buttons when the window is inactive.</p>
55
<input type="submit">
66
<input type="submit" disabled>
7+
<button type="submit">Submit</button>
8+
<button type="submit" disabled>Submit</button>
79
</body>
810
<script>
911
if (window.testRunner)

LayoutTests/fast/forms/form-control-refresh/submit-button-text-color-disabled-state-expected.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html>
33
<body>
44
<p>This tests that the submit button's text color displays with the correct color when the input is disabled.</p>
5-
<input type="submit" style="color: rgba(255, 255, 255, 0.8);" disabled>
5+
<input type="submit" value="Submit" style="color: rgba(255, 255, 255, 0.6);" disabled>
6+
<button type="submit" style="color: rgba(255, 255, 255, 0.6);" disabled>Submit</button>
67
</body>
78
</html>

0 commit comments

Comments
 (0)