Title: [121019] trunk
Revision
121019
Author
[email protected]
Date
2012-06-22 05:54:04 -0700 (Fri, 22 Jun 2012)

Log Message

REGRESSION(r117738):[Forms] validationMessage IDL attribute should not have range overflow message if value isn't range overflow
https://bugs.webkit.org/show_bug.cgi?id=89736

Reviewed by Kent Tamura.

Source/WebCore:

Tests: fast/forms/date/input-date-validation-message.html
       fast/forms/number/input-number-validation-message.html
       fast/forms/range/input-range-validation-message.html

This patch changes comparison operator for range overflow message in
InputType::validationMessage().

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

LayoutTests:

Tests for HTMLInputElement.validationMessage attribute.

* fast/forms/date/input-date-validation-message-expected.txt: Added.
* fast/forms/date/input-date-validation-message.html: Added.
* fast/forms/number/input-number-validation-message-expected.txt: Added.
* fast/forms/number/input-number-validation-message.html: Added.
* fast/forms/range/input-range-validation-message-expected.txt: Added.
* fast/forms/range/input-range-validation-message.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121018 => 121019)


--- trunk/LayoutTests/ChangeLog	2012-06-22 12:41:24 UTC (rev 121018)
+++ trunk/LayoutTests/ChangeLog	2012-06-22 12:54:04 UTC (rev 121019)
@@ -1,3 +1,19 @@
+2012-06-22  Yoshifumi Inoue  <[email protected]>
+
+        REGRESSION(r117738):[Forms] validationMessage IDL attribute should not have range overflow message if value isn't range overflow
+        https://bugs.webkit.org/show_bug.cgi?id=89736
+
+        Reviewed by Kent Tamura.
+
+        Tests for HTMLInputElement.validationMessage attribute.
+
+        * fast/forms/date/input-date-validation-message-expected.txt: Added.
+        * fast/forms/date/input-date-validation-message.html: Added.
+        * fast/forms/number/input-number-validation-message-expected.txt: Added.
+        * fast/forms/number/input-number-validation-message.html: Added.
+        * fast/forms/range/input-range-validation-message-expected.txt: Added.
+        * fast/forms/range/input-range-validation-message.html: Added.
+
 2012-06-21  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Support separate script compilation and execution.

Added: trunk/LayoutTests/fast/forms/date/input-date-validation-message-expected.txt (0 => 121019)


--- trunk/LayoutTests/fast/forms/date/input-date-validation-message-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date/input-date-validation-message-expected.txt	2012-06-22 12:54:04 UTC (rev 121019)
@@ -0,0 +1,21 @@
+Test for validationMessage IDL attribute for <input type=date>
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+No message
+PASS testIt("", "", "") is ""
+Value missing
+PASS testIt("", "", "") is "value missing"
+Type mismatch
+PASS testIt("foo", "", "") is ""
+Range overflow
+PASS testIt("1982-11-02", "", "1970-12-31") is "range overflow"
+Range underflow
+PASS testIt("1982-11-02", "1990-05-25", "1990-12-24") is "range underflow"
+Step mismatch
+PASS testIt("1982-11-02", "", "", "123") is "step mismatch"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/date/input-date-validation-message.html (0 => 121019)


--- trunk/LayoutTests/fast/forms/date/input-date-validation-message.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date/input-date-validation-message.html	2012-06-22 12:54:04 UTC (rev 121019)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Test for validationMessage IDL attribute for &lt;input type=date>');
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type=date id=date maxlength=1 pattern=x>';
+var input = document.getElementById('date');
+
+function testIt(value, min, max, step)
+{
+    input.setAttribute("max", max);
+    input.setAttribute("min", min);
+    input.setAttribute("step", step);
+    input.setAttribute("value", value);
+    return input.validationMessage;
+}
+
+debug('No message')
+shouldBeEqualToString('testIt("", "", "")', '');
+
+debug('Value missing')
+input.setAttribute("required", "");
+shouldBeEqualToString('testIt("", "", "")', 'value missing');
+input.removeAttribute("required");
+
+debug('Type mismatch');
+shouldBeEqualToString('testIt("foo", "", "")', '');
+
+debug('Range overflow')
+shouldBeEqualToString('testIt("1982-11-02", "", "1970-12-31")', 'range overflow');
+
+debug('Range underflow')
+shouldBeEqualToString('testIt("1982-11-02", "1990-05-25", "1990-12-24")', 'range underflow');
+
+debug('Step mismatch')
+shouldBeEqualToString('testIt("1982-11-02", "", "", "123")', 'step mismatch');
+
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/number/input-number-validation-message-expected.txt (0 => 121019)


--- trunk/LayoutTests/fast/forms/number/input-number-validation-message-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/number/input-number-validation-message-expected.txt	2012-06-22 12:54:04 UTC (rev 121019)
@@ -0,0 +1,21 @@
+Test for validationMessage IDL attribute for <input type=number>
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+No message
+PASS testIt("", "", "") is ""
+Value missing
+PASS testIt("", "", "") is "value missing"
+Type mismatch
+PASS testIt("foo", "", "") is ""
+Range overflow
+PASS testIt("200", "", "100") is "range overflow"
+Range underflow
+PASS testIt("10", "50", "100") is "range underflow"
+Step mismatch
+PASS testIt("55", "0", "100", "10") is "step mismatch"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/number/input-number-validation-message.html (0 => 121019)


--- trunk/LayoutTests/fast/forms/number/input-number-validation-message.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/number/input-number-validation-message.html	2012-06-22 12:54:04 UTC (rev 121019)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Test for validationMessage IDL attribute for &lt;input type=number>');
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type=number id=number maxlength=1 pattern=x>';
+var input = document.getElementById('number');
+
+function testIt(value, min, max, step)
+{
+    input.setAttribute("max", max);
+    input.setAttribute("min", min);
+    input.setAttribute("step", step);
+    input.setAttribute("value", value);
+    return input.validationMessage;
+}
+
+debug('No message')
+shouldBeEqualToString('testIt("", "", "")', '');
+
+debug('Value missing')
+input.setAttribute("required", "");
+shouldBeEqualToString('testIt("", "", "")', 'value missing');
+input.removeAttribute("required");
+
+debug('Type mismatch');
+shouldBeEqualToString('testIt("foo", "", "")', '');
+
+debug('Range overflow')
+shouldBeEqualToString('testIt("200", "", "100")', 'range overflow');
+
+debug('Range underflow')
+shouldBeEqualToString('testIt("10", "50", "100")', 'range underflow');
+
+debug('Step mismatch')
+shouldBeEqualToString('testIt("55", "0", "100", "10")', 'step mismatch');
+
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/range/input-range-validation-message-expected.txt (0 => 121019)


--- trunk/LayoutTests/fast/forms/range/input-range-validation-message-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/range/input-range-validation-message-expected.txt	2012-06-22 12:54:04 UTC (rev 121019)
@@ -0,0 +1,21 @@
+Test for validationMessage IDL attribute for <input type=range>
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+No message
+PASS testIt("", "", "") is ""
+Value missing
+PASS testIt("", "", "") is ""
+Type mismatch
+PASS testIt("foo", "", "") is ""
+Range overflow
+PASS testIt("200", "", "100") is ""
+Range underflow
+PASS testIt("10", "50", "100") is ""
+Step mismatch
+PASS testIt("55", "0", "100", "10") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/range/input-range-validation-message.html (0 => 121019)


--- trunk/LayoutTests/fast/forms/range/input-range-validation-message.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/range/input-range-validation-message.html	2012-06-22 12:54:04 UTC (rev 121019)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Test for validationMessage IDL attribute for &lt;input type=range>');
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type=range id=range maxlength=1 pattern=x>';
+var input = document.getElementById('range');
+
+function testIt(value, min, max, step)
+{
+    input.setAttribute("max", max);
+    input.setAttribute("min", min);
+    input.setAttribute("step", step);
+    input.setAttribute("value", value);
+    return input.validationMessage;
+}
+
+debug('No message')
+shouldBeEqualToString('testIt("", "", "")', '');
+
+debug('Value missing')
+input.setAttribute("required", "");
+shouldBeEqualToString('testIt("", "", "")', '');
+input.removeAttribute("required");
+
+debug('Type mismatch');
+shouldBeEqualToString('testIt("foo", "", "")', '');
+
+debug('Range overflow')
+shouldBeEqualToString('testIt("200", "", "100")', '');
+
+debug('Range underflow')
+shouldBeEqualToString('testIt("10", "50", "100")', '');
+
+debug('Step mismatch')
+shouldBeEqualToString('testIt("55", "0", "100", "10")', '');
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (121018 => 121019)


--- trunk/Source/WebCore/ChangeLog	2012-06-22 12:41:24 UTC (rev 121018)
+++ trunk/Source/WebCore/ChangeLog	2012-06-22 12:54:04 UTC (rev 121019)
@@ -1,3 +1,20 @@
+2012-06-22  Yoshifumi Inoue  <[email protected]>
+
+        REGRESSION(r117738):[Forms] validationMessage IDL attribute should not have range overflow message if value isn't range overflow
+        https://bugs.webkit.org/show_bug.cgi?id=89736
+
+        Reviewed by Kent Tamura.
+
+        Tests: fast/forms/date/input-date-validation-message.html
+               fast/forms/number/input-number-validation-message.html
+               fast/forms/range/input-range-validation-message.html
+
+        This patch changes comparison operator for range overflow message in
+        InputType::validationMessage().
+
+        * html/InputType.cpp:
+        (WebCore::InputType::validationMessage):
+
 2012-06-22  Taiju Tsuiki  <[email protected]>
 
         Web Inspector: Add frontend-side Entry object to FileSystemModel

Modified: trunk/Source/WebCore/html/InputType.cpp (121018 => 121019)


--- trunk/Source/WebCore/html/InputType.cpp	2012-06-22 12:41:24 UTC (rev 121018)
+++ trunk/Source/WebCore/html/InputType.cpp	2012-06-22 12:54:04 UTC (rev 121019)
@@ -374,7 +374,7 @@
     if (numericValue < stepRange.minimum())
         return validationMessageRangeUnderflowText(serialize(stepRange.minimum()));
 
-    if (numericValue < stepRange.maximum())
+    if (numericValue > stepRange.maximum())
         return validationMessageRangeOverflowText(serialize(stepRange.maximum()));
 
     if (stepRange.stepMismatch(numericValue)) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to