Diff
Modified: trunk/LayoutTests/ChangeLog (289464 => 289465)
--- trunk/LayoutTests/ChangeLog 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/ChangeLog 2022-02-09 10:37:47 UTC (rev 289465)
@@ -1,3 +1,29 @@
+2022-02-09 Ziran Sun <z...@igalia.com>
+
+ [Forms] Improving applyStep() to be in line with specs
+ https://bugs.webkit.org/show_bug.cgi?id=236134
+
+ Reviewed by Chris Dumez.
+
+ Update test expectations.
+ * fast/forms/date/date-stepup-stepdown-expected.txt:
+ * fast/forms/date/date-stepup-stepdown.html:
+ * fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt:
+ * fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html:
+ * fast/forms/month/month-stepup-stepdown-expected.txt:
+ * fast/forms/month/month-stepup-stepdown.html:
+ * fast/forms/number/number-stepup-stepdown-expected.txt:
+ * fast/forms/number/number-stepup-stepdown.html:
+ * fast/forms/range/range-stepup-stepdown-expected.txt:
+ * fast/forms/range/range-stepup-stepdown.html:
+ * fast/forms/time/time-stepup-stepdown-expected.txt:
+ * fast/forms/time/time-stepup-stepdown.html:
+ * fast/forms/week/week-stepup-stepdown-expected.txt:
+ * fast/forms/week/week-stepup-stepdown.html:
+ * platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt:
+ * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt:
+ * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt:
+
2022-02-09 Diego Pino Garcia <dp...@igalia.com>
[GLIB] Garden several WPT tests that are now passing
Modified: trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -4,8 +4,8 @@
Invalid value
-PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("", null, null) is "1970-01-02"
+PASS stepDown("", null, null) is "1969-12-31"
Non-number arguments
PASS stepUp("2010-02-10", null, null, "0") is "2010-02-10"
PASS stepDown("2010-02-10", null, null, "0") is "2010-02-10"
@@ -25,7 +25,7 @@
PASS stepDown("2010-02-10", "any", null) threw exception InvalidStateError: The object is in an invalid state..
Overflow/underflow
PASS stepUp("2010-02-10", "3.40282346e+38", null) is "2010-02-10"
-PASS stepDown("2010-02-10", "3.40282346e+38", null) is "2010-02-10"
+PASS stepDown("2010-02-10", "3.40282346e+38", null) is "1970-01-01"
PASS stepUp("2010-02-10", "1", "2010-02-10") is "2010-02-10"
PASS stepDown("2010-02-10", "1", "2010-02-10") is "2010-02-10"
Modified: trunk/LayoutTests/fast/forms/date/date-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/date/date-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/date/date-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -38,8 +38,8 @@
input.type = 'date';
debug('Invalid value');
-shouldThrowErrorName('stepUp("", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("", null, null)', "InvalidStateError");
+shouldBe('stepUp("", null, null)', '"1970-01-02"');
+shouldBe('stepDown("", null, null)', '"1969-12-31"');
debug('Non-number arguments');
shouldBe('stepUp("2010-02-10", null, null, "0")', '"2010-02-10"');
shouldBe('stepDown("2010-02-10", null, null, "0")', '"2010-02-10"');
@@ -59,7 +59,7 @@
shouldThrowErrorName('stepDown("2010-02-10", "any", null)', "InvalidStateError");
debug('Overflow/underflow');
shouldBe('stepUp("2010-02-10", "3.40282346e+38", null)', '"2010-02-10"');
-shouldBe('stepDown("2010-02-10", "3.40282346e+38", null)', '"2010-02-10"');
+shouldBe('stepDown("2010-02-10", "3.40282346e+38", null)', '"1970-01-01"');
shouldBe('stepUp("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
shouldBe('stepDown("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
Modified: trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -4,8 +4,8 @@
Invalid value
-PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("", null, null) is "1970-01-01T00:01"
+PASS stepDown("", null, null) is "1969-12-31T23:59"
Non-number arguments
PASS stepUp("2010-02-10T20:13", null, null, "0") is "2010-02-10T20:13"
PASS stepDown("2010-02-10T20:13", null, null, "0") is "2010-02-10T20:13"
@@ -25,7 +25,7 @@
PASS stepDown("2010-02-10T20:13", "any", null) threw exception InvalidStateError: The object is in an invalid state..
Overflow/underflow
PASS stepUp("2010-02-10T20:13", "3.40282346e+38", null) is "2010-02-10T20:13"
-PASS stepDown("2010-02-10T20:13", "3.40282346e+38", null) is "2010-02-10T20:13"
+PASS stepDown("2010-02-10T20:13", "3.40282346e+38", null) is "1970-01-01T00:00"
PASS stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13") is "2010-02-10T20:13"
PASS stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13") is "2010-02-10T20:13"
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -38,8 +38,8 @@
input.type = 'datetime-local';
debug('Invalid value');
-shouldThrowErrorName('stepUp("", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("", null, null)', "InvalidStateError");
+shouldBe('stepUp("", null, null)', '"1970-01-01T00:01"');
+shouldBe('stepDown("", null, null)', '"1969-12-31T23:59"');
debug('Non-number arguments');
shouldBe('stepUp("2010-02-10T20:13", null, null, "0")', '"2010-02-10T20:13"');
shouldBe('stepDown("2010-02-10T20:13", null, null, "0")', '"2010-02-10T20:13"');
@@ -59,7 +59,7 @@
shouldThrowErrorName('stepDown("2010-02-10T20:13", "any", null)', "InvalidStateError");
debug('Overflow/underflow');
shouldBe('stepUp("2010-02-10T20:13", "3.40282346e+38", null)', '"2010-02-10T20:13"');
-shouldBe('stepDown("2010-02-10T20:13", "3.40282346e+38", null)', '"2010-02-10T20:13"');
+shouldBe('stepDown("2010-02-10T20:13", "3.40282346e+38", null)', '"1970-01-01T00:00"');
shouldBe('stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13")', '"2010-02-10T20:13"');
shouldBe('stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13")', '"2010-02-10T20:13"');
</script>
Modified: trunk/LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -4,8 +4,8 @@
Invalid value
-PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("", null, null) is "1970-02"
+PASS stepDown("", null, null) is "1969-12"
Non-number arguments
PASS stepUp("2010-02", null, null, "0") is "2010-02"
PASS stepDown("2010-02", null, null, "0") is "2010-02"
@@ -25,7 +25,7 @@
PASS stepDown("2010-02", "any", null) threw exception InvalidStateError: The object is in an invalid state..
Overflow/underflow
PASS stepUp("2010-02", "3.40282346e+38", null) is "2010-02"
-PASS stepDown("2010-02", "3.40282346e+38", null) is "2010-02"
+PASS stepDown("2010-02", "3.40282346e+38", null) is "1970-01"
PASS stepUp("2010-02", "1", "2010-02") is "2010-02"
PASS stepDown("2010-02", "1", "2010-02") is "2010-02"
Modified: trunk/LayoutTests/fast/forms/month/month-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/month/month-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/month/month-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -38,8 +38,8 @@
input.type = 'month';
debug('Invalid value');
-shouldThrowErrorName('stepUp("", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("", null, null)', "InvalidStateError");
+shouldBe('stepUp("", null, null)', '"1970-02"');
+shouldBe('stepDown("", null, null)', '"1969-12"');
debug('Non-number arguments');
shouldBe('stepUp("2010-02", null, null, "0")', '"2010-02"');
shouldBe('stepDown("2010-02", null, null, "0")', '"2010-02"');
@@ -59,7 +59,7 @@
shouldThrowErrorName('stepDown("2010-02", "any", null)', "InvalidStateError");
debug('Overflow/underflow');
shouldBe('stepUp("2010-02", "3.40282346e+38", null)', '"2010-02"');
-shouldBe('stepDown("2010-02", "3.40282346e+38", null)', '"2010-02"');
+shouldBe('stepDown("2010-02", "3.40282346e+38", null)', '"1970-01"');
shouldBe('stepUp("2010-02", "1", "2010-02")', '"2010-02"');
shouldBe('stepDown("2010-02", "1", "2010-02")', '"2010-02"');
Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -6,8 +6,8 @@
Number type
Invalid value
-PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("", null, null) is "1"
+PASS stepDown("", null, null) is "-1"
Non-number arguments
PASS stepUp("0", null, null, "0") is "0"
@@ -142,14 +142,14 @@
Overflow/underflow
PASS stepDown("1", "1", "0") is "0"
PASS stepDown("0", "1", "0") is "0"
-PASS stepDown("1", "1", "0", 2) is "1"
-PASS input.value is "1"
-PASS stepDown("1", "3.40282346e+38", "", 2) is "1"
+PASS stepDown("1", "1", "0", 2) is "0"
+PASS input.value is "0"
+PASS stepDown("1", "3.40282346e+38", "", 2) is "-3.40282346e+38"
PASS stepUp("-1", "1", "0") is "0"
PASS stepUp("0", "1", "0") is "0"
-PASS stepUp("-1", "1", "0", 2) is "-1"
-PASS input.value is "-1"
-PASS stepUp("1", "3.40282346e+38", "", 2) is "1"
+PASS stepUp("-1", "1", "0", 2) is "0"
+PASS input.value is "0"
+PASS stepUp("1", "3.40282346e+38", "", 2) is "3.40282346e+38"
stepDown()/stepUp() for stepMismatch values
PASS stepUp("1", "2", "") is "3"
Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -57,8 +57,8 @@
debug('');
debug('Invalid value');
-shouldThrowErrorName('stepUp("", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("", null, null)', "InvalidStateError");
+shouldBe('stepUp("", null, null)', '"1"');
+shouldBe('stepDown("", null, null)', '"-1"');
debug('');
debug('Non-number arguments');
@@ -221,14 +221,14 @@
debug('Overflow/underflow');
shouldBe('stepDown("1", "1", "0")', '"0"');
shouldBe('stepDown("0", "1", "0")', '"0"');
-shouldBe('stepDown("1", "1", "0", 2)', '"1"');
-shouldBe('input.value', '"1"');
-shouldBe('stepDown("1", "3.40282346e+38", "", 2)', '"1"');
+shouldBe('stepDown("1", "1", "0", 2)', '"0"');
+shouldBe('input.value', '"0"');
+shouldBe('stepDown("1", "3.40282346e+38", "", 2)', '"-3.40282346e+38"');
shouldBe('stepUp("-1", "1", "0")', '"0"');
shouldBe('stepUp("0", "1", "0")', '"0"');
-shouldBe('stepUp("-1", "1", "0", 2)', '"-1"');
-shouldBe('input.value', '"-1"');
-shouldBe('stepUp("1", "3.40282346e+38", "", 2)', '"1"');
+shouldBe('stepUp("-1", "1", "0", 2)', '"0"');
+shouldBe('input.value', '"0"');
+shouldBe('stepUp("1", "3.40282346e+38", "", 2)', '"3.40282346e+38"');
debug('');
debug('stepDown()/stepUp() for stepMismatch values');
Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -141,18 +141,18 @@
PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
PASS stepUpExplicitBounds(null, "100", "1", "100") is "100"
PASS input.value is "100"
-PASS stepUpExplicitBounds(null, "100", "1", "99", "2") is "99"
-PASS input.value is "99"
+PASS stepUpExplicitBounds(null, "100", "1", "99", "2") is "100"
+PASS input.value is "100"
PASS stepDownExplicitBounds("0", null, "1", "1") is "0"
PASS stepDownExplicitBounds("0", null, "1", "0") is "0"
PASS input.value is "0"
-PASS stepDownExplicitBounds("0", null, "1", "1", "2") is "1"
-PASS input.value is "1"
+PASS stepDownExplicitBounds("0", null, "1", "1", "2") is "0"
+PASS input.value is "0"
PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2") is "0"
PASS stepUpExplicitBounds(-100, 0, 1, -1) is "0"
PASS stepUpExplicitBounds(null, 0, 1, 0) is "0"
-PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) is "-1"
-PASS input.value is "-1"
+PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) is "0"
+PASS input.value is "0"
PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") is "0"
stepDown()/stepUp() for stepMismatch values
Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -231,18 +231,18 @@
shouldBe('stepUpExplicitBounds(null, "100", "1", "99")', '"100"');
shouldBe('stepUpExplicitBounds(null, "100", "1", "100")', '"100"');
shouldBe('input.value', '"100"');
-shouldBe('stepUpExplicitBounds(null, "100", "1", "99", "2")', '"99"');
-shouldBe('input.value', '"99"');
+shouldBe('stepUpExplicitBounds(null, "100", "1", "99", "2")', '"100"');
+shouldBe('input.value', '"100"');
shouldBe('stepDownExplicitBounds("0", null, "1", "1")', '"0"');
shouldBe('stepDownExplicitBounds("0", null, "1", "0")', '"0"');
shouldBe('input.value', '"0"');
-shouldBe('stepDownExplicitBounds("0", null, "1", "1", "2")', '"1"');
-shouldBe('input.value', '"1"');
+shouldBe('stepDownExplicitBounds("0", null, "1", "1", "2")', '"0"');
+shouldBe('input.value', '"0"');
shouldBe('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")', '"0"');
shouldBe('stepUpExplicitBounds(-100, 0, 1, -1)', '"0"');
shouldBe('stepUpExplicitBounds(null, 0, 1, 0)', '"0"');
-shouldBe('stepUpExplicitBounds(-100, 0, 1, -1, 2)', '"-1"');
-shouldBe('input.value', '"-1"');
+shouldBe('stepUpExplicitBounds(-100, 0, 1, -1, 2)', '"0"');
+shouldBe('input.value', '"0"');
shouldBe('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")', '"0"');
debug('');
Modified: trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -4,8 +4,8 @@
Invalid value
-PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("", null, null) is "00:01"
+PASS stepDown("", null, null) is "00:00"
Non-number arguments
PASS stepUp("20:13", null, null, "0") is "20:13"
PASS stepDown("20:13", null, null, "0") is "20:13"
@@ -25,9 +25,9 @@
PASS stepDown("20:13", "any", null) threw exception InvalidStateError: The object is in an invalid state..
Overflow/underflow
PASS stepUp("20:13", "3.40282346e+38", null) is "20:13"
-PASS stepDown("20:13", "3.40282346e+38", null) is "20:13"
-PASS stepUp("20:13", "1", "20:13") is "20:13"
-PASS stepDown("20:13", "1", "20:13") is "20:13"
+PASS stepDown("20:13", "3.40282346e+38", null) is "00:00:00"
+PASS stepUp("20:13", "1", "20:13") is "20:13:00"
+PASS stepDown("20:13", "1", "20:13") is "20:13:00"
PASS stepUp("23:59", null, null) is "23:59"
PASS stepDown("00:00", null, null) is "00:00"
Modified: trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -38,8 +38,8 @@
input.type = 'time';
debug('Invalid value');
-shouldThrowErrorName('stepUp("", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("", null, null)', "InvalidStateError");
+shouldBe('stepUp("", null, null)', '"00:01"');
+shouldBe('stepDown("", null, null)', '"00:00"');
debug('Non-number arguments');
shouldBe('stepUp("20:13", null, null, "0")', '"20:13"');
shouldBe('stepDown("20:13", null, null, "0")', '"20:13"');
@@ -59,9 +59,9 @@
shouldThrowErrorName('stepDown("20:13", "any", null)', "InvalidStateError");
debug('Overflow/underflow');
shouldBe('stepUp("20:13", "3.40282346e+38", null)', '"20:13"');
-shouldBe('stepDown("20:13", "3.40282346e+38", null)', '"20:13"');
-shouldBe('stepUp("20:13", "1", "20:13")', '"20:13"');
-shouldBe('stepDown("20:13", "1", "20:13")', '"20:13"');
+shouldBe('stepDown("20:13", "3.40282346e+38", null)', '"00:00:00"');
+shouldBe('stepUp("20:13", "1", "20:13")', '"20:13:00"');
+shouldBe('stepDown("20:13", "1", "20:13")', '"20:13:00"');
shouldBe('stepUp("23:59", null, null)', '"23:59"');
shouldBe('stepDown("00:00", null, null)', '"00:00"');
Modified: trunk/LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt (289464 => 289465)
--- trunk/LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -4,8 +4,8 @@
Invalid value
-PASS stepUp("", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("", null, null) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("", null, null) is "1970-W02"
+PASS stepDown("", null, null) is "1969-W52"
Non-number arguments
PASS stepUp("2010-W02", null, null, "0") is "2010-W02"
PASS stepDown("2010-W02", null, null, "0") is "2010-W02"
@@ -25,7 +25,7 @@
PASS stepDown("2010-W02", "any", null) threw exception InvalidStateError: The object is in an invalid state..
Overflow/underflow
PASS stepUp("2010-W02", "3.40282346e+38", null) is "2010-W02"
-PASS stepDown("2010-W02", "3.40282346e+38", null) is "2010-W02"
+PASS stepDown("2010-W02", "3.40282346e+38", null) is "1970-W01"
PASS stepUp("2010-W02", "1", "2010-W02") is "2010-W02"
PASS stepDown("2010-W02", "1", "2010-W02") is "2010-W02"
Modified: trunk/LayoutTests/fast/forms/week/week-stepup-stepdown.html (289464 => 289465)
--- trunk/LayoutTests/fast/forms/week/week-stepup-stepdown.html 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/fast/forms/week/week-stepup-stepdown.html 2022-02-09 10:37:47 UTC (rev 289465)
@@ -38,8 +38,8 @@
input.type = 'week';
debug('Invalid value');
-shouldThrowErrorName('stepUp("", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("", null, null)', "InvalidStateError");
+shouldBe('stepUp("", null, null)', '"1970-W02"');
+shouldBe('stepDown("", null, null)', '"1969-W52"');
debug('Non-number arguments');
shouldBe('stepUp("2010-W02", null, null, "0")', '"2010-W02"');
shouldBe('stepDown("2010-W02", null, null, "0")', '"2010-W02"');
@@ -59,7 +59,7 @@
shouldThrowErrorName('stepDown("2010-W02", "any", null)', "InvalidStateError");
debug('Overflow/underflow');
shouldBe('stepUp("2010-W02", "3.40282346e+38", null)', '"2010-W02"');
-shouldBe('stepDown("2010-W02", "3.40282346e+38", null)', '"2010-W02"');
+shouldBe('stepDown("2010-W02", "3.40282346e+38", null)', '"1970-W01"');
shouldBe('stepUp("2010-W02", "1", "2010-W02")', '"2010-W02"');
shouldBe('stepDown("2010-W02", "1", "2010-W02")', '"2010-W02"');
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289464 => 289465)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-09 10:37:47 UTC (rev 289465)
@@ -1,3 +1,12 @@
+2022-02-09 Ziran Sun <z...@igalia.com>
+
+ [Forms] Improving applyStep() to be in line with specs
+ https://bugs.webkit.org/show_bug.cgi?id=236134
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt:
+
2022-02-08 Antoine Quint <grao...@webkit.org>
[web-animations] additive and accumulation interpolation does not work correctly with implicit 0% and 100% keyframes
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt (289464 => 289465)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -21,8 +21,8 @@
PASS Solving the step mismatch
PASS Performing stepUp()
PASS Performing stepDown()
-FAIL Performing stepUp() beyond the value of the max attribute assert_equals: expected "12" but got "9"
-FAIL Performing stepDown() beyond the value of the min attribute assert_equals: expected "3" but got "6"
+PASS Performing stepUp() beyond the value of the max attribute
+PASS Performing stepDown() beyond the value of the min attribute
FAIL Skip ASCII whitespace within input assert_equals: expected "123" but got "50"
PASS Multiply value by ten raised to the exponentth power with `e`
PASS Multiply value by ten raised to the exponentth power with `E`
Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt (289464 => 289465)
--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -29,8 +29,8 @@
PASS stepDown argument 2 times
PASS stepUp stop because it exceeds the maximum value
PASS stepDown stop so lower than the minimum value
-FAIL stop at border on stepUp assert_in_array: a valid time string representing 1 minute after 3pm value "15:00" not in array ["15:01", "15:01:00", "15:01:00.0", "15:01:00.00", "15:01:00.000"]
-FAIL stop at border on stepDown assert_in_array: a valid time string representing 1 minute before 2pm value "13:00" not in array ["12:59", "12:59:00", "12:59:00.0", "12:59:00.00", "12:59:00.000"]
-FAIL empty value of stepUp The object is in an invalid state.
+PASS stop at border on stepUp
+PASS stop at border on stepDown
+PASS empty value of stepUp
PASS set value on not time format value
Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt (289464 => 289465)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -29,8 +29,8 @@
PASS stepDown argument 2 times
PASS stepUp stop because it exceeds the maximum value
PASS stepDown stop so lower than the minimum value
-FAIL stop at border on stepUp assert_in_array: a valid time string representing 1 minute after 3pm value "15:00" not in array ["15:01", "15:01:00", "15:01:00.0", "15:01:00.00", "15:01:00.000"]
-FAIL stop at border on stepDown assert_in_array: a valid time string representing 1 minute before 2pm value "13:00" not in array ["12:59", "12:59:00", "12:59:00.0", "12:59:00.00", "12:59:00.000"]
-FAIL empty value of stepUp The object is in an invalid state.
+PASS stop at border on stepUp
+PASS stop at border on stepDown
+PASS empty value of stepUp
PASS set value on not time format value
Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt (289464 => 289465)
--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt 2022-02-09 10:37:47 UTC (rev 289465)
@@ -29,8 +29,8 @@
PASS stepDown argument 2 times
PASS stepUp stop because it exceeds the maximum value
PASS stepDown stop so lower than the minimum value
-FAIL stop at border on stepUp assert_in_array: a valid time string representing 1 minute after 3pm value "15:00" not in array ["15:01", "15:01:00", "15:01:00.0", "15:01:00.00", "15:01:00.000"]
-FAIL stop at border on stepDown assert_in_array: a valid time string representing 1 minute before 2pm value "13:00" not in array ["12:59", "12:59:00", "12:59:00.0", "12:59:00.00", "12:59:00.000"]
-FAIL empty value of stepUp The object is in an invalid state.
+PASS stop at border on stepUp
+PASS stop at border on stepDown
+PASS empty value of stepUp
PASS set value on not time format value
Modified: trunk/Source/WebCore/ChangeLog (289464 => 289465)
--- trunk/Source/WebCore/ChangeLog 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/Source/WebCore/ChangeLog 2022-02-09 10:37:47 UTC (rev 289465)
@@ -1,3 +1,26 @@
+2022-02-09 Ziran Sun <z...@igalia.com>
+
+ [Forms] Improving applyStep() to be in line with specs
+ https://bugs.webkit.org/show_bug.cgi?id=236134
+
+ Reviewed by Chris Dumez.
+
+ This is to improve applyStep() func to follow specs at
+ https://html.spec.whatwg.org/multipage/input.html#dom-input-stepup
+
+ Since Chromium implementation follows the specs steps, this patch imports the
+ Chromium implmentation.
+
+ This is a further patch after https://bugs.webkit.org/show_bug.cgi?id=235509. It has corrected
+ some changes on test files in fast/form directory in the previous patch submitted for Bug
+ 235509. With this CL a few more sub-tests are now passing.
+
+ * html/InputType.cpp:
+ (WebCore::InputType::applyStep):
+ * html/StepRange.cpp:
+ (WebCore::StepRange::stepSnappedMaximum const):
+ * html/StepRange.h:
+
2022-02-09 Saam Barati <sbar...@apple.com>
Don't return an empty value from AbortController.signal.reason and make it harder to return empty values from JSValueInWrappedObject
Modified: trunk/Source/WebCore/html/InputType.cpp (289464 => 289465)
--- trunk/Source/WebCore/html/InputType.cpp 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/Source/WebCore/html/InputType.cpp 2022-02-09 10:37:47 UTC (rev 289465)
@@ -921,32 +921,51 @@
ExceptionOr<void> InputType::applyStep(int count, AnyStepHandling anyStepHandling, TextFieldEventBehavior eventBehavior)
{
+ // https://html.spec.whatwg.org/C/#dom-input-stepup
+
StepRange stepRange(createStepRange(anyStepHandling));
if (!stepRange.hasStep())
return Exception { InvalidStateError };
+ // 3. If the element has a minimum and a maximum and the minimum is greater than the maximum, then abort these steps.
+ if (stepRange.minimum() > stepRange.maximum())
+ return { };
+
+ // 4. If the element has a minimum and a maximum and there is no value greater than or equal to the element's minimum and less than or equal to
+ // the element's maximum that, when subtracted from the step base, is an integral multiple of the allowed value step, then abort these steps.
+ Decimal alignedMaximum = stepRange.stepSnappedMaximum();
+ if (!alignedMaximum.isFinite())
+ return { };
+
ASSERT(element());
- const Decimal current = parseToNumberOrNaN(element()->value());
- if (!current.isFinite())
- return Exception { InvalidStateError };
- Decimal newValue = current + stepRange.step() * count;
- if (!newValue.isFinite())
- return Exception { InvalidStateError };
+ const Decimal current = parseToNumber(element()->value(), 0);
+ Decimal base = stepRange.stepBase();
+ Decimal step = stepRange.step();
+ Decimal newValue = current;
- const Decimal acceptableErrorValue = stepRange.acceptableError();
- if (newValue - stepRange.minimum() < -acceptableErrorValue)
- return { };
- if (newValue < stepRange.minimum())
- newValue = stepRange.minimum();
-
- if (!equalLettersIgnoringASCIICase(element()->attributeWithoutSynchronization(stepAttr), "any"))
+ newValue = newValue + stepRange.step() * Decimal::fromDouble(count);
+ const AtomString& stepString = element()->getAttribute(HTMLNames::stepAttr);
+ if (!equalIgnoringASCIICase(stepString, "any"))
newValue = stepRange.alignValueForStep(current, newValue);
- if (newValue - stepRange.maximum() > acceptableErrorValue)
- return { };
+ // 8. If the element has a minimum, and value is less than that minimum, then set value to the smallest value that, when subtracted from the step
+ // base, is an integral multiple of the allowed value step, and that is more than or equal to minimum.
+ if (newValue < stepRange.minimum()) {
+ const Decimal alignedMinimum = base + ((stepRange.minimum() - base) / step).ceiling() * step;
+ ASSERT(alignedMinimum >= stepRange.minimum());
+ newValue = alignedMinimum;
+ }
+
+ // 9. If the element has a maximum, and value is greater than that maximum, then set value to the largest value that, when subtracted from the step
+ // base, is an integral multiple of the allowed value step, and that is less than or equal to maximum.
if (newValue > stepRange.maximum())
- newValue = stepRange.maximum();
+ newValue = alignedMaximum;
+ // 10. If either the method invoked was the stepDown() method and value is greater than valueBeforeStepping, or the method invoked was the stepUp()
+ // method and value is less than valueBeforeStepping, then return.
+ if ((count < 0 && current < newValue) || (count > 0 && current > newValue))
+ return { };
+
Ref protectedThis { *this };
auto result = setValueAsDecimal(newValue, eventBehavior);
if (result.hasException() || !element())
Modified: trunk/Source/WebCore/html/StepRange.cpp (289464 => 289465)
--- trunk/Source/WebCore/html/StepRange.cpp 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/Source/WebCore/html/StepRange.cpp 2022-02-09 10:37:47 UTC (rev 289465)
@@ -142,6 +142,20 @@
return base + ((value - base) / m_step).round() * m_step;
}
+Decimal StepRange::stepSnappedMaximum() const
+{
+ Decimal base = stepBase();
+ Decimal step = m_step;
+ if (base - step == base || !(base / step).isFinite())
+ return Decimal::nan();
+ Decimal alignedMaximum = base + ((maximum() - base) / step).floor() * step;
+ if (alignedMaximum > maximum())
+ alignedMaximum -= step;
+ if (alignedMaximum < minimum())
+ return Decimal::nan();
+ return alignedMaximum;
+}
+
bool StepRange::stepMismatch(const Decimal& valueForCheck) const
{
if (!m_hasStep)
Modified: trunk/Source/WebCore/html/StepRange.h (289464 => 289465)
--- trunk/Source/WebCore/html/StepRange.h 2022-02-09 09:52:42 UTC (rev 289464)
+++ trunk/Source/WebCore/html/StepRange.h 2022-02-09 10:37:47 UTC (rev 289465)
@@ -73,6 +73,7 @@
bool hasRangeLimitations() const { return m_hasRangeLimitations; }
Decimal maximum() const { return m_maximum; }
Decimal minimum() const { return m_minimum; }
+ Decimal stepSnappedMaximum() const;
static Decimal parseStep(AnyStepHandling, const StepDescription&, const String&);
Decimal step() const { return m_step; }
Decimal stepBase() const { return m_stepBase; }