Diff
Modified: trunk/LayoutTests/ChangeLog (290123 => 290124)
--- trunk/LayoutTests/ChangeLog 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/ChangeLog 2022-02-18 15:39:39 UTC (rev 290124)
@@ -1,3 +1,15 @@
+2022-02-18 Ziran Sun <z...@igalia.com>
+
+ [InputElement] Return empty string for an invalid floating-point number that ends with "."
+ https://bugs.webkit.org/show_bug.cgi?id=236700
+
+ Reviewed by Chris Dumez.
+
+ * fast/forms/number/number-stepup-stepdown-expected.txt:
+ * fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt:
+ * fast/forms/number/number-stepup-stepdown-from-renderer.html:
+ * fast/forms/number/number-stepup-stepdown.html:
+
2022-02-18 Antoine Quint <grao...@webkit.org>
[frame-rate] allow setting frameRate as an option passed to Element.animate()
Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt (290123 => 290124)
--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt 2022-02-18 15:39:39 UTC (rev 290124)
@@ -56,23 +56,23 @@
PASS stepUp(".1", 1, null) is "1.1"
PASS stepUp(".2", 1, null) is "1.2"
-PASS stepUp("1.", 1, null) is "2"
-PASS stepUp("2.", 1, null) is "3"
+PASS stepUp("1.", 1, null) is "1"
+PASS stepUp("2.", 1, null) is "1"
PASS stepUp("-.1", 1, null) is "0.9"
PASS stepUp("-.2", 1, null) is "0.8"
-PASS stepUp("-1.", 1, null) is "0"
-PASS stepUp("-2.", 1, null) is "-1"
+PASS stepUp("-1.", 1, null) is "1"
+PASS stepUp("-2.", 1, null) is "1"
PASS stepDown(".1", 1, null) is "-0.9"
PASS stepDown(".2", 1, null) is "-0.8"
-PASS stepDown("1.", 1, null) is "0"
-PASS stepDown("2.", 1, null) is "1"
+PASS stepDown("1.", 1, null) is "-1"
+PASS stepDown("2.", 1, null) is "-1"
PASS stepDown("-.1", 1, null) is "-1.1"
PASS stepDown("-.2", 1, null) is "-1.2"
-PASS stepDown("-1.", 1, null) is "-2"
-PASS stepDown("-2.", 1, null) is "-3"
+PASS stepDown("-1.", 1, null) is "-1"
+PASS stepDown("-2.", 1, null) is "-1"
PASS stepUp("0.1", .1, null) is "0.2"
PASS stepUp("0.2", .1, null) is "0.3"
@@ -104,23 +104,23 @@
PASS stepUp(".1", .1, null) is "0.2"
PASS stepUp(".2", .1, null) is "0.3"
-PASS stepUp("1.", .1, null) is "1.1"
-PASS stepUp("2.", .1, null) is "2.1"
+PASS stepUp("1.", .1, null) is "0.1"
+PASS stepUp("2.", .1, null) is "0.1"
PASS stepUp("-.1", .1, null) is "0"
PASS stepUp("-.2", .1, null) is "-0.1"
-PASS stepUp("-1.", .1, null) is "-0.9"
-PASS stepUp("-2.", .1, null) is "-1.9"
+PASS stepUp("-1.", .1, null) is "0.1"
+PASS stepUp("-2.", .1, null) is "0.1"
PASS stepDown(".1", .1, null) is "0"
PASS stepDown(".2", .1, null) is "0.1"
-PASS stepDown("1.", .1, null) is "0.9"
-PASS stepDown("2.", .1, null) is "1.9"
+PASS stepDown("1.", .1, null) is "-0.1"
+PASS stepDown("2.", .1, null) is "-0.1"
PASS stepDown("-.1", .1, null) is "-0.2"
PASS stepDown("-.2", .1, null) is "-0.3"
-PASS stepDown("-1.", .1, null) is "-1.1"
-PASS stepDown("-2.", .1, null) is "-2.1"
+PASS stepDown("-1.", .1, null) is "-0.1"
+PASS stepDown("-2.", .1, null) is "-0.1"
Extra arguments
PASS input.value = "0"; input.min = null; input.step = null; input.stepUp(1, 2); input.value is "1"
Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt (290123 => 290124)
--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt 2022-02-18 15:39:39 UTC (rev 290124)
@@ -59,23 +59,23 @@
PASS stepUp(".1", 1, null) is "1"
PASS stepUp(".2", 1, null) is "1"
-PASS stepUp("1.", 1, null) is "2"
-PASS stepUp("2.", 1, null) is "3"
+PASS stepUp("1.", 1, null) is "1"
+PASS stepUp("2.", 1, null) is "1"
PASS stepUp("-.1", 1, null) is "0"
PASS stepUp("-.2", 1, null) is "0"
-PASS stepUp("-1.", 1, null) is "0"
-PASS stepUp("-2.", 1, null) is "-1"
+PASS stepUp("-1.", 1, null) is "1"
+PASS stepUp("-2.", 1, null) is "1"
PASS stepDown(".1", 1, null) is "0"
PASS stepDown(".2", 1, null) is "0"
-PASS stepDown("1.", 1, null) is "0"
-PASS stepDown("2.", 1, null) is "1"
+PASS stepDown("1.", 1, null) is "-1"
+PASS stepDown("2.", 1, null) is "-1"
PASS stepDown("-.1", 1, null) is "-1"
PASS stepDown("-.2", 1, null) is "-1"
-PASS stepDown("-1.", 1, null) is "-2"
-PASS stepDown("-2.", 1, null) is "-3"
+PASS stepDown("-1.", 1, null) is "-1"
+PASS stepDown("-2.", 1, null) is "-1"
PASS stepUp("0.1", .1, null) is "0.2"
PASS stepUp("0.2", .1, null) is "0.3"
@@ -107,22 +107,22 @@
PASS stepUp(".1", .1, null) is "0.2"
PASS stepUp(".2", .1, null) is "0.3"
-PASS stepUp("1.", .1, null) is "1.1"
-PASS stepUp("2.", .1, null) is "2.1"
+PASS stepUp("1.", .1, null) is "0.1"
+PASS stepUp("2.", .1, null) is "0.1"
PASS stepUp("-.1", .1, null) is "0"
PASS stepUp("-.2", .1, null) is "-0.1"
-PASS stepUp("-1.", .1, null) is "-0.9"
-PASS stepUp("-2.", .1, null) is "-1.9"
+PASS stepUp("-1.", .1, null) is "0.1"
+PASS stepUp("-2.", .1, null) is "0.1"
PASS stepDown(".1", .1, null) is "0"
PASS stepDown(".2", .1, null) is "0.1"
-PASS stepDown("1.", .1, null) is "0.9"
-PASS stepDown("2.", .1, null) is "1.9"
+PASS stepDown("1.", .1, null) is "-0.1"
+PASS stepDown("2.", .1, null) is "-0.1"
PASS stepDown("-.1", .1, null) is "-0.2"
PASS stepDown("-.2", .1, null) is "-0.3"
-PASS stepDown("-1.", .1, null) is "-1.1"
-PASS stepDown("-2.", .1, null) is "-2.1"
+PASS stepDown("-1.", .1, null) is "-0.1"
+PASS stepDown("-2.", .1, null) is "-0.1"
Invalid step value
PASS stepUp("0", "foo", null) is "1"
Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html (290123 => 290124)
--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html 2022-02-18 15:39:39 UTC (rev 290124)
@@ -171,26 +171,26 @@
debug('');
shouldBe('stepUp(".1", 1, null)', '"1"'); // Is 1.1 in non-render test
shouldBe('stepUp(".2", 1, null)', '"1"'); // Is 1.2 in non-render test
-shouldBe('stepUp("1.", 1, null)', '"2"');
-shouldBe('stepUp("2.", 1, null)', '"3"');
+shouldBe('stepUp("1.", 1, null)', '"1"');
+shouldBe('stepUp("2.", 1, null)', '"1"');
debug('');
shouldBe('stepUp("-.1", 1, null)', '"0"'); // Is 0.9 in non-render test
shouldBe('stepUp("-.2", 1, null)', '"0"'); // Is 0.8 in non-render test
-shouldBe('stepUp("-1.", 1, null)', '"0"');
-shouldBe('stepUp("-2.", 1, null)', '"-1"');
+shouldBe('stepUp("-1.", 1, null)', '"1"');
+shouldBe('stepUp("-2.", 1, null)', '"1"');
debug('');
shouldBe('stepDown(".1", 1, null)', '"0"'); // Is -0.9 in non-render test
shouldBe('stepDown(".2", 1, null)', '"0"'); // Is -0.8 in non-render test
-shouldBe('stepDown("1.", 1, null)', '"0"');
-shouldBe('stepDown("2.", 1, null)', '"1"');
+shouldBe('stepDown("1.", 1, null)', '"-1"');
+shouldBe('stepDown("2.", 1, null)', '"-1"');
debug('');
shouldBe('stepDown("-.1", 1, null)', '"-1"'); // Is -1.1 in non-render test
shouldBe('stepDown("-.2", 1, null)', '"-1"'); // Is -1.2 in non-render test
-shouldBe('stepDown("-1.", 1, null)', '"-2"');
-shouldBe('stepDown("-2.", 1, null)', '"-3"');
+shouldBe('stepDown("-1.", 1, null)', '"-1"');
+shouldBe('stepDown("-2.", 1, null)', '"-1"');
// Same as above, but stepping by .1 rather than 1.
debug('');
@@ -228,25 +228,25 @@
debug('');
shouldBe('stepUp(".1", .1, null)', '"0.2"');
shouldBe('stepUp(".2", .1, null)', '"0.3"');
-shouldBe('stepUp("1.", .1, null)', '"1.1"');
-shouldBe('stepUp("2.", .1, null)', '"2.1"');
+shouldBe('stepUp("1.", .1, null)', '"0.1"');
+shouldBe('stepUp("2.", .1, null)', '"0.1"');
debug('');
shouldBe('stepUp("-.1", .1, null)', '"0"');
shouldBe('stepUp("-.2", .1, null)', '"-0.1"');
-shouldBe('stepUp("-1.", .1, null)', '"-0.9"');
-shouldBe('stepUp("-2.", .1, null)', '"-1.9"');
+shouldBe('stepUp("-1.", .1, null)', '"0.1"');
+shouldBe('stepUp("-2.", .1, null)', '"0.1"');
shouldBe('stepDown(".1", .1, null)', '"0"');
shouldBe('stepDown(".2", .1, null)', '"0.1"');
-shouldBe('stepDown("1.", .1, null)', '"0.9"');
-shouldBe('stepDown("2.", .1, null)', '"1.9"');
+shouldBe('stepDown("1.", .1, null)', '"-0.1"');
+shouldBe('stepDown("2.", .1, null)', '"-0.1"');
debug('');
shouldBe('stepDown("-.1", .1, null)', '"-0.2"');
shouldBe('stepDown("-.2", .1, null)', '"-0.3"');
-shouldBe('stepDown("-1.", .1, null)', '"-1.1"');
-shouldBe('stepDown("-2.", .1, null)', '"-2.1"');
+shouldBe('stepDown("-1.", .1, null)', '"-0.1"');
+shouldBe('stepDown("-2.", .1, null)', '"-0.1"');
debug('');
debug('Invalid step value');
Modified: trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html (290123 => 290124)
--- trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/fast/forms/number/number-stepup-stepdown.html 2022-02-18 15:39:39 UTC (rev 290124)
@@ -118,26 +118,26 @@
debug('');
shouldBe('stepUp(".1", 1, null)', '"1.1"');
shouldBe('stepUp(".2", 1, null)', '"1.2"');
-shouldBe('stepUp("1.", 1, null)', '"2"');
-shouldBe('stepUp("2.", 1, null)', '"3"');
+shouldBe('stepUp("1.", 1, null)', '"1"');
+shouldBe('stepUp("2.", 1, null)', '"1"');
debug('');
shouldBe('stepUp("-.1", 1, null)', '"0.9"');
shouldBe('stepUp("-.2", 1, null)', '"0.8"');
-shouldBe('stepUp("-1.", 1, null)', '"0"');
-shouldBe('stepUp("-2.", 1, null)', '"-1"');
+shouldBe('stepUp("-1.", 1, null)', '"1"');
+shouldBe('stepUp("-2.", 1, null)', '"1"');
debug('');
shouldBe('stepDown(".1", 1, null)', '"-0.9"');
shouldBe('stepDown(".2", 1, null)', '"-0.8"');
-shouldBe('stepDown("1.", 1, null)', '"0"');
-shouldBe('stepDown("2.", 1, null)', '"1"');
+shouldBe('stepDown("1.", 1, null)', '"-1"');
+shouldBe('stepDown("2.", 1, null)', '"-1"');
debug('');
shouldBe('stepDown("-.1", 1, null)', '"-1.1"');
shouldBe('stepDown("-.2", 1, null)', '"-1.2"');
-shouldBe('stepDown("-1.", 1, null)', '"-2"');
-shouldBe('stepDown("-2.", 1, null)', '"-3"');
+shouldBe('stepDown("-1.", 1, null)', '"-1"');
+shouldBe('stepDown("-2.", 1, null)', '"-1"');
// Same as above, but stepping by .1 rather than 1.
debug('');
@@ -175,26 +175,26 @@
debug('');
shouldBe('stepUp(".1", .1, null)', '"0.2"');
shouldBe('stepUp(".2", .1, null)', '"0.3"');
-shouldBe('stepUp("1.", .1, null)', '"1.1"');
-shouldBe('stepUp("2.", .1, null)', '"2.1"');
+shouldBe('stepUp("1.", .1, null)', '"0.1"');
+shouldBe('stepUp("2.", .1, null)', '"0.1"');
debug('');
shouldBe('stepUp("-.1", .1, null)', '"0"');
shouldBe('stepUp("-.2", .1, null)', '"-0.1"');
-shouldBe('stepUp("-1.", .1, null)', '"-0.9"');
-shouldBe('stepUp("-2.", .1, null)', '"-1.9"');
+shouldBe('stepUp("-1.", .1, null)', '"0.1"');
+shouldBe('stepUp("-2.", .1, null)', '"0.1"');
debug('');
shouldBe('stepDown(".1", .1, null)', '"0"');
shouldBe('stepDown(".2", .1, null)', '"0.1"');
-shouldBe('stepDown("1.", .1, null)', '"0.9"');
-shouldBe('stepDown("2.", .1, null)', '"1.9"');
+shouldBe('stepDown("1.", .1, null)', '"-0.1"');
+shouldBe('stepDown("2.", .1, null)', '"-0.1"');
debug('');
shouldBe('stepDown("-.1", .1, null)', '"-0.2"');
shouldBe('stepDown("-.2", .1, null)', '"-0.3"');
-shouldBe('stepDown("-1.", .1, null)', '"-1.1"');
-shouldBe('stepDown("-2.", .1, null)', '"-2.1"');
+shouldBe('stepDown("-1.", .1, null)', '"-0.1"');
+shouldBe('stepDown("-2.", .1, null)', '"-0.1"');
debug('');
debug('Extra arguments');
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290123 => 290124)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-18 15:39:39 UTC (rev 290124)
@@ -1,3 +1,12 @@
+2022-02-18 Ziran Sun <z...@igalia.com>
+
+ [InputElement] Return empty string for an invalid floating-point number that ends with "."
+ https://bugs.webkit.org/show_bug.cgi?id=236700
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/html/semantics/forms/the-input-element/number-expected.txt:
+
2022-02-18 Jon Lee <jon...@apple.com>
Unreviewed gardening for GPU Process bots. Update fuzzy data.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/number-expected.txt (290123 => 290124)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/number-expected.txt 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/number-expected.txt 2022-02-18 15:39:39 UTC (rev 290124)
@@ -15,7 +15,7 @@
PASS Value <= max attribute
PASS Value > max attribute
PASS value with a leading '.'
-FAIL value ending with '.' assert_equals: expected "" but got "1."
+PASS value ending with '.'
PASS value = -0
PASS value = Infinity
PASS value = -Infinity
Modified: trunk/Source/WebCore/ChangeLog (290123 => 290124)
--- trunk/Source/WebCore/ChangeLog 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/Source/WebCore/ChangeLog 2022-02-18 15:39:39 UTC (rev 290124)
@@ -1,3 +1,17 @@
+2022-02-18 Ziran Sun <z...@igalia.com>
+
+ [InputElement] Return empty string for an invalid floating-point number that ends with "."
+ https://bugs.webkit.org/show_bug.cgi?id=236700
+
+ Reviewed by Chris Dumez.
+
+ As per specs https://html.spec.whatwg.org/multipage/input.html#number-state-(type%3Dnumber),
+ "If the value of the element is not a valid floating-point number, then set it to the empty
+ string instead".
+
+ * html/parser/HTMLParserIdioms.cpp:
+ (WebCore::parseToDoubleForNumberType):
+
2022-02-18 Antoine Quint <grao...@webkit.org>
[frame-rate] allow setting frameRate as an option passed to Element.animate()
Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (290123 => 290124)
--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp 2022-02-18 15:38:23 UTC (rev 290123)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp 2022-02-18 15:39:39 UTC (rev 290124)
@@ -130,6 +130,9 @@
if (firstCharacter != '-' && firstCharacter != '.' && !isASCIIDigit(firstCharacter))
return fallbackValue;
+ if (string.endsWith('.'))
+ return fallbackValue;
+
bool valid = false;
double value = string.toDouble(&valid);
if (!valid)