Title: [289075] trunk
Revision
289075
Author
[email protected]
Date
2022-02-03 13:34:50 -0800 (Thu, 03 Feb 2022)

Log Message

[Forms] Value doesn't change for stepUp()/stepDown() with out of range values
https://bugs.webkit.org/show_bug.cgi?id=235509

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt:

Source/WebCore:

For input type number, WebKit throws "invalid state" Error when the value is greater than
max when calling stepUp() or less than min when calling stepDown(). According to section 10
in https://html.spec.whatwg.org/multipage/input.html#dom-input-stepup,
we should do "return", which indicates that value doesn't change.

* html/InputType.cpp:
(WebCore::InputType::applyStep):

LayoutTests:

Update expectation files.

* 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-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt.
* platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt.
* platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289074 => 289075)


--- trunk/LayoutTests/ChangeLog	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/ChangeLog	2022-02-03 21:34:50 UTC (rev 289075)
@@ -1,3 +1,32 @@
+2022-02-03  Ziran Sun  <[email protected]>
+
+        [Forms] Value doesn't change for stepUp()/stepDown() with out of range values
+        https://bugs.webkit.org/show_bug.cgi?id=235509
+
+        Reviewed by Chris Dumez.
+
+        Update expectation files.        
+
+        * 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-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt.
+        * platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt.
+        * platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt:
+
 2022-02-03  Nikolaos Mouchtaris  <[email protected]>
 
         Implement CSS overscroll-behavior for synchronous scroll

Modified: trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -24,10 +24,10 @@
 PASS stepUp("2010-02-10", "any", null) threw exception InvalidStateError: The object is in an invalid state..
 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) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-02-10", "3.40282346e+38", null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("2010-02-10", "1", "2010-02-10") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-02-10", "1", "2010-02-10") threw exception InvalidStateError: The object is in an invalid state..
+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 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"
 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/forms/date/date-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/date/date-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/date/date-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -58,10 +58,10 @@
 shouldThrowErrorName('stepUp("2010-02-10", "any", null)', "InvalidStateError");
 shouldThrowErrorName('stepDown("2010-02-10", "any", null)', "InvalidStateError");
 debug('Overflow/underflow');
-shouldThrowErrorName('stepUp("2010-02-10", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-02-10", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepUp("2010-02-10", "1", "2010-02-10")', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-02-10", "1", "2010-02-10")', "InvalidStateError");
+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('stepUp("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
+shouldBe('stepDown("2010-02-10", "1", "2010-02-10")', '"2010-02-10"');
 
 debug('');
 </script>

Modified: trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -24,10 +24,10 @@
 PASS stepUp("2010-02-10T20:13", "any", null) threw exception InvalidStateError: The object is in an invalid state..
 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) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-02-10T20:13", "3.40282346e+38", null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13") threw exception InvalidStateError: The object is in an invalid state..
+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 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
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -58,10 +58,10 @@
 shouldThrowErrorName('stepUp("2010-02-10T20:13", "any", null)', "InvalidStateError");
 shouldThrowErrorName('stepDown("2010-02-10T20:13", "any", null)', "InvalidStateError");
 debug('Overflow/underflow');
-shouldThrowErrorName('stepUp("2010-02-10T20:13", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-02-10T20:13", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13")', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13")', "InvalidStateError");
+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('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>
 <script src=""
 </body>

Modified: trunk/LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -24,10 +24,10 @@
 PASS stepUp("2010-02", "any", null) threw exception InvalidStateError: The object is in an invalid state..
 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) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-02", "3.40282346e+38", null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("2010-02", "1", "2010-02") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-02", "1", "2010-02") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("2010-02", "3.40282346e+38", null) is "2010-02"
+PASS stepDown("2010-02", "3.40282346e+38", null) is "2010-02"
+PASS stepUp("2010-02", "1", "2010-02") is "2010-02"
+PASS stepDown("2010-02", "1", "2010-02") is "2010-02"
 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/forms/month/month-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/month/month-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/month/month-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -58,10 +58,10 @@
 shouldThrowErrorName('stepUp("2010-02", "any", null)', "InvalidStateError");
 shouldThrowErrorName('stepDown("2010-02", "any", null)', "InvalidStateError");
 debug('Overflow/underflow');
-shouldThrowErrorName('stepUp("2010-02", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-02", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepUp("2010-02", "1", "2010-02")', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-02", "1", "2010-02")', "InvalidStateError");
+shouldBe('stepUp("2010-02", "3.40282346e+38", null)', '"2010-02"');
+shouldBe('stepDown("2010-02", "3.40282346e+38", null)', '"2010-02"');
+shouldBe('stepUp("2010-02", "1", "2010-02")', '"2010-02"');
+shouldBe('stepDown("2010-02", "1", "2010-02")', '"2010-02"');
 
 debug('');
 </script>

Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -141,15 +141,15 @@
 
 Overflow/underflow
 PASS stepDown("1", "1", "0") is "0"
-PASS stepDown("0", "1", "0") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("1", "1", "0", 2) threw exception InvalidStateError: The object is in an invalid state..
+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) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepDown("1", "3.40282346e+38", "", 2) is "1"
 PASS stepUp("-1", "1", "0") is "0"
-PASS stepUp("0", "1", "0") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("-1", "1", "0", 2) threw exception InvalidStateError: The object is in an invalid state..
+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) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("1", "3.40282346e+38", "", 2) is "1"
 
 stepDown()/stepUp() for stepMismatch values
 PASS stepUp("1", "2", "") is "3"

Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -220,15 +220,15 @@
 debug('');
 debug('Overflow/underflow');
 shouldBe('stepDown("1", "1", "0")', '"0"');
-shouldThrowErrorName('stepDown("0", "1", "0")', "InvalidStateError");
-shouldThrowErrorName('stepDown("1", "1", "0", 2)', "InvalidStateError");
+shouldBe('stepDown("0", "1", "0")', '"0"');
+shouldBe('stepDown("1", "1", "0", 2)', '"1"');
 shouldBe('input.value', '"1"');
-shouldThrowErrorName('stepDown("1", "3.40282346e+38", "", 2)', "InvalidStateError");
+shouldBe('stepDown("1", "3.40282346e+38", "", 2)', '"1"'); 
 shouldBe('stepUp("-1", "1", "0")', '"0"');
-shouldThrowErrorName('stepUp("0", "1", "0")', "InvalidStateError");
-shouldThrowErrorName('stepUp("-1", "1", "0", 2)', "InvalidStateError");
+shouldBe('stepUp("0", "1", "0")', '"0"');
+shouldBe('stepUp("-1", "1", "0", 2)', '"-1"');
 shouldBe('input.value', '"-1"');
-shouldThrowErrorName('stepUp("1", "3.40282346e+38", "", 2)', "InvalidStateError");
+shouldBe('stepUp("1", "3.40282346e+38", "", 2)', '"1"');
 
 debug('');
 debug('stepDown()/stepUp() for stepMismatch values');

Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -139,21 +139,21 @@
 
 Overflow/underflow
 PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
-PASS stepUpExplicitBounds(null, "100", "1", "100") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUpExplicitBounds(null, "100", "1", "100") is "100"
 PASS input.value is "100"
-PASS stepUpExplicitBounds(null, "100", "1", "99", "2") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUpExplicitBounds(null, "100", "1", "99", "2") is "99"
 PASS input.value is "99"
 PASS stepDownExplicitBounds("0", null, "1", "1") is "0"
-PASS stepDownExplicitBounds("0", null, "1", "0") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepDownExplicitBounds("0", null, "1", "0") is "0"
 PASS input.value is "0"
-PASS stepDownExplicitBounds("0", null, "1", "1", "2") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepDownExplicitBounds("0", null, "1", "1", "2") is "1"
 PASS input.value is "1"
-PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception InvalidStateError: The object is in an invalid state..
+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) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUpExplicitBounds(null, 0, 1, 0) is "0"
+PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) is "-1"
 PASS input.value is "-1"
-PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") is "0"
 
 stepDown()/stepUp() for stepMismatch values
 PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
@@ -162,7 +162,7 @@
 PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
 
 value + step is <= max, but rounded result would be > max.
-PASS stepUpExplicitBounds(null, 99, 10, 89) threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUpExplicitBounds(null, 99, 10, 89) is "90"
 
 Huge value and small step
 PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"

Modified: trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/range/range-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -229,21 +229,21 @@
 debug('');
 debug('Overflow/underflow');
 shouldBe('stepUpExplicitBounds(null, "100", "1", "99")', '"100"');
-shouldThrowErrorName('stepUpExplicitBounds(null, "100", "1", "100")', "InvalidStateError");
+shouldBe('stepUpExplicitBounds(null, "100", "1", "100")', '"100"');
 shouldBe('input.value', '"100"');
-shouldThrowErrorName('stepUpExplicitBounds(null, "100", "1", "99", "2")', "InvalidStateError");
+shouldBe('stepUpExplicitBounds(null, "100", "1", "99", "2")', '"99"');
 shouldBe('input.value', '"99"');
 shouldBe('stepDownExplicitBounds("0", null, "1", "1")', '"0"');
-shouldThrowErrorName('stepDownExplicitBounds("0", null, "1", "0")', "InvalidStateError");
+shouldBe('stepDownExplicitBounds("0", null, "1", "0")', '"0"');
 shouldBe('input.value', '"0"');
-shouldThrowErrorName('stepDownExplicitBounds("0", null, "1", "1", "2")', "InvalidStateError");
+shouldBe('stepDownExplicitBounds("0", null, "1", "1", "2")', '"1"');
 shouldBe('input.value', '"1"');
-shouldThrowErrorName('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")', "InvalidStateError");
+shouldBe('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")', '"0"');
 shouldBe('stepUpExplicitBounds(-100, 0, 1, -1)', '"0"');
-shouldThrowErrorName('stepUpExplicitBounds(null, 0, 1, 0)', "InvalidStateError");
-shouldThrowErrorName('stepUpExplicitBounds(-100, 0, 1, -1, 2)', "InvalidStateError");
+shouldBe('stepUpExplicitBounds(null, 0, 1, 0)', '"0"');
+shouldBe('stepUpExplicitBounds(-100, 0, 1, -1, 2)', '"-1"');
 shouldBe('input.value', '"-1"');
-shouldThrowErrorName('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")', "InvalidStateError");
+shouldBe('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")', '"0"');
 
 debug('');
 debug('stepDown()/stepUp() for stepMismatch values');
@@ -254,7 +254,7 @@
 
 debug('');
 debug('value + step is <= max, but rounded result would be > max.');
-shouldThrowErrorName('stepUpExplicitBounds(null, 99, 10, 89)', "InvalidStateError");
+shouldBe('stepUpExplicitBounds(null, 99, 10, 89)', '"90"');
 
 debug('');
 debug('Huge value and small step');

Modified: trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -24,12 +24,12 @@
 PASS stepUp("20:13", "any", null) threw exception InvalidStateError: The object is in an invalid state..
 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) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("20:13", "3.40282346e+38", null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("20:13", "1", "20:13") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("20:13", "1", "20:13") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("23:59", null, null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("00:00", null, null) threw exception InvalidStateError: The object is in an invalid state..
+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 stepUp("23:59", null, null) is "23:59"
+PASS stepDown("00:00", null, null) is "00:00"
 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/time/time-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -58,12 +58,12 @@
 shouldThrowErrorName('stepUp("20:13", "any", null)', "InvalidStateError");
 shouldThrowErrorName('stepDown("20:13", "any", null)', "InvalidStateError");
 debug('Overflow/underflow');
-shouldThrowErrorName('stepUp("20:13", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("20:13", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepUp("20:13", "1", "20:13")', "InvalidStateError");
-shouldThrowErrorName('stepDown("20:13", "1", "20:13")', "InvalidStateError");
-shouldThrowErrorName('stepUp("23:59", null, null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("00:00", null, null)', "InvalidStateError");
+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('stepUp("23:59", null, null)', '"23:59"');
+shouldBe('stepDown("00:00", null, null)', '"00:00"');
 
 debug('');
 </script>

Modified: trunk/LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -24,10 +24,10 @@
 PASS stepUp("2010-W02", "any", null) threw exception InvalidStateError: The object is in an invalid state..
 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) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-W02", "3.40282346e+38", null) threw exception InvalidStateError: The object is in an invalid state..
-PASS stepUp("2010-W02", "1", "2010-W02") threw exception InvalidStateError: The object is in an invalid state..
-PASS stepDown("2010-W02", "1", "2010-W02") threw exception InvalidStateError: The object is in an invalid state..
+PASS stepUp("2010-W02", "3.40282346e+38", null) is "2010-W02"
+PASS stepDown("2010-W02", "3.40282346e+38", null) is "2010-W02"
+PASS stepUp("2010-W02", "1", "2010-W02") is "2010-W02"
+PASS stepDown("2010-W02", "1", "2010-W02") is "2010-W02"
 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/forms/week/week-stepup-stepdown.html (289074 => 289075)


--- trunk/LayoutTests/fast/forms/week/week-stepup-stepdown.html	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/fast/forms/week/week-stepup-stepdown.html	2022-02-03 21:34:50 UTC (rev 289075)
@@ -58,10 +58,10 @@
 shouldThrowErrorName('stepUp("2010-W02", "any", null)', "InvalidStateError");
 shouldThrowErrorName('stepDown("2010-W02", "any", null)', "InvalidStateError");
 debug('Overflow/underflow');
-shouldThrowErrorName('stepUp("2010-W02", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-W02", "3.40282346e+38", null)', "InvalidStateError");
-shouldThrowErrorName('stepUp("2010-W02", "1", "2010-W02")', "InvalidStateError");
-shouldThrowErrorName('stepDown("2010-W02", "1", "2010-W02")', "InvalidStateError");
+shouldBe('stepUp("2010-W02", "3.40282346e+38", null)', '"2010-W02"');
+shouldBe('stepDown("2010-W02", "3.40282346e+38", null)', '"2010-W02"');
+shouldBe('stepUp("2010-W02", "1", "2010-W02")', '"2010-W02"');
+shouldBe('stepDown("2010-W02", "1", "2010-W02")', '"2010-W02"');
 
 debug('');
 </script>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289074 => 289075)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-03 21:34:50 UTC (rev 289075)
@@ -1,3 +1,14 @@
+2022-02-03  Ziran Sun  <[email protected]>
+
+        [Forms] Value doesn't change for stepUp()/stepDown() with out of range values
+        https://bugs.webkit.org/show_bug.cgi?id=235509
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt:
+        * web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt:
+        * web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt:
+
 2022-02-03  Chris Dumez  <[email protected]>
 
         Implement AbortSignal.timeout()

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt (289074 => 289075)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -3,10 +3,10 @@
 
 
 PASS Forms
-FAIL Calling stepDown() on input - number - where value < min should not modify value. The object is in an invalid state.
-FAIL Calling stepDown() on input - date - where value < min should not modify value. The object is in an invalid state.
-FAIL Calling stepDown() on input - datetime-local - where value < min should not modify value. The object is in an invalid state.
-FAIL Calling stepDown() on input - month - where value < min should not modify value. The object is in an invalid state.
-FAIL Calling stepDown() on input - time - where value < min should not modify value. The object is in an invalid state.
-FAIL Calling stepDown() on input - week - where value < min should not modify value. The object is in an invalid state.
+PASS Calling stepDown() on input - number - where value < min should not modify value.
+PASS Calling stepDown() on input - date - where value < min should not modify value.
+PASS Calling stepDown() on input - datetime-local - where value < min should not modify value.
+PASS Calling stepDown() on input - month - where value < min should not modify value.
+PASS Calling stepDown() on input - time - where value < min should not modify value.
+PASS Calling stepDown() on input - week - where value < min should not modify value.
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt (289074 => 289075)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -4,10 +4,10 @@
 
 
 PASS Forms
-FAIL Calling stepUp() on input -number- where value > max should not modify value. The object is in an invalid state.
-FAIL Calling stepUp() on input -date- where value > max should not modify value. The object is in an invalid state.
-FAIL Calling stepUp() on input -datetime-local- where value > max should not modify value. The object is in an invalid state.
-FAIL Calling stepUp() on input -month- where value > max should not modify value. The object is in an invalid state.
-FAIL Calling stepUp() on input -time- where value > max should not modify value. The object is in an invalid state.
-FAIL Calling stepUp() on input -week- where value > max should not modify value. The object is in an invalid state.
+PASS Calling stepUp() on input -number- where value > max should not modify value.
+PASS Calling stepUp() on input -date- where value > max should not modify value.
+PASS Calling stepUp() on input -datetime-local- where value > max should not modify value.
+PASS Calling stepUp() on input -month- where value > max should not modify value.
+PASS Calling stepUp() on input -time- where value > max should not modify value.
+PASS Calling stepUp() on input -week- where value > max should not modify value.
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt (289074 => 289075)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -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 The object is in an invalid state.
-FAIL Performing stepDown() beyond the value of the min attribute The object is in an invalid state.
+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"
 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 (289074 => 289075)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -27,10 +27,10 @@
 PASS stepDown on step value with fractional seconds
 PASS stepUp argument 2 times
 PASS stepDown argument 2 times
-FAIL stepUp stop because it exceeds the maximum value The object is in an invalid state.
-FAIL stepDown stop so lower than the minimum value The object is in an invalid state.
-FAIL stop at border on stepUp The object is in an invalid state.
-FAIL stop at border on stepDown The object is in an invalid state.
+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 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 (289074 => 289075)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -27,10 +27,10 @@
 PASS stepDown on step value with fractional seconds
 PASS stepUp argument 2 times
 PASS stepDown argument 2 times
-FAIL stepUp stop because it exceeds the maximum value The object is in an invalid state.
-FAIL stepDown stop so lower than the minimum value The object is in an invalid state.
-FAIL stop at border on stepUp The object is in an invalid state.
-FAIL stop at border on stepDown The object is in an invalid state.
+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 set value on not time format value
 

Copied: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt (from rev 289074, trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt) (0 => 289075)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepdown-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -0,0 +1,12 @@
+input_stepDown
+
+
+
+PASS Forms
+PASS Calling stepDown() on input - number - where value < min should not modify value.
+FAIL Calling stepDown() on input - date - where value < min should not modify value. The object is in an invalid state.
+FAIL Calling stepDown() on input - datetime-local - where value < min should not modify value. The object is in an invalid state.
+FAIL Calling stepDown() on input - month - where value < min should not modify value. The object is in an invalid state.
+FAIL Calling stepDown() on input - time - where value < min should not modify value. The object is in an invalid state.
+FAIL Calling stepDown() on input - week - where value < min should not modify value. The object is in an invalid state.
+

Copied: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt (from rev 289074, trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt) (0 => 289075)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-stepup-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -0,0 +1,13 @@
+input_stepUp
+
+
+
+
+PASS Forms
+PASS Calling stepUp() on input -number- where value > max should not modify value.
+FAIL Calling stepUp() on input -date- where value > max should not modify value. The object is in an invalid state.
+FAIL Calling stepUp() on input -datetime-local- where value > max should not modify value. The object is in an invalid state.
+FAIL Calling stepUp() on input -month- where value > max should not modify value. The object is in an invalid state.
+FAIL Calling stepUp() on input -time- where value > max should not modify value. The object is in an invalid state.
+FAIL Calling stepUp() on input -week- where value > max should not modify value. The object is in an invalid state.
+

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt (289074 => 289075)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/time-expected.txt	2022-02-03 21:34:50 UTC (rev 289075)
@@ -27,10 +27,10 @@
 PASS stepDown on step value with fractional seconds
 PASS stepUp argument 2 times
 PASS stepDown argument 2 times
-FAIL stepUp stop because it exceeds the maximum value The object is in an invalid state.
-FAIL stepDown stop so lower than the minimum value The object is in an invalid state.
-FAIL stop at border on stepUp The object is in an invalid state.
-FAIL stop at border on stepDown The object is in an invalid state.
+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 set value on not time format value
 

Modified: trunk/Source/WebCore/ChangeLog (289074 => 289075)


--- trunk/Source/WebCore/ChangeLog	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/Source/WebCore/ChangeLog	2022-02-03 21:34:50 UTC (rev 289075)
@@ -1,3 +1,18 @@
+2022-02-03  Ziran Sun  <[email protected]>
+
+        [Forms] Value doesn't change for stepUp()/stepDown() with out of range values
+        https://bugs.webkit.org/show_bug.cgi?id=235509
+
+        Reviewed by Chris Dumez.
+
+        For input type number, WebKit throws "invalid state" Error when the value is greater than
+        max when calling stepUp() or less than min when calling stepDown(). According to section 10
+        in https://html.spec.whatwg.org/multipage/input.html#dom-input-stepup,
+        we should do "return", which indicates that value doesn't change.
+
+        * html/InputType.cpp:
+        (WebCore::InputType::applyStep):
+
 2022-02-03  Nikolaos Mouchtaris  <[email protected]>
 
         Implement CSS overscroll-behavior for synchronous scroll

Modified: trunk/Source/WebCore/html/InputType.cpp (289074 => 289075)


--- trunk/Source/WebCore/html/InputType.cpp	2022-02-03 21:32:43 UTC (rev 289074)
+++ trunk/Source/WebCore/html/InputType.cpp	2022-02-03 21:34:50 UTC (rev 289075)
@@ -935,7 +935,7 @@
 
     const Decimal acceptableErrorValue = stepRange.acceptableError();
     if (newValue - stepRange.minimum() < -acceptableErrorValue)
-        return Exception { InvalidStateError };
+        return { };
     if (newValue < stepRange.minimum())
         newValue = stepRange.minimum();
 
@@ -943,7 +943,7 @@
         newValue = stepRange.alignValueForStep(current, newValue);
 
     if (newValue - stepRange.maximum() > acceptableErrorValue)
-        return Exception { InvalidStateError };
+        return { };
     if (newValue > stepRange.maximum())
         newValue = stepRange.maximum();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to