Title: [145362] trunk
Revision
145362
Author
[email protected]
Date
2013-03-11 07:43:40 -0700 (Mon, 11 Mar 2013)

Log Message

Inappropriate validation message for required number/date input elements
https://bugs.webkit.org/show_bug.cgi?id=111982

Reviewed by Kentaro Hara.

Source/WebCore:

For validation message, badInput messages should take precedence
over valueMissing messages because users already filled out the
field with a bad value.

Tests: Update fast/forms/validationMessage.html

* html/InputType.cpp:
(WebCore::InputType::validationMessage):
Check badInput first.

LayoutTests:

* fast/forms/validationMessage-expected.txt:
* fast/forms/validationMessage.html:
* platform/chromium/fast/forms/validationMessage-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145361 => 145362)


--- trunk/LayoutTests/ChangeLog	2013-03-11 14:19:29 UTC (rev 145361)
+++ trunk/LayoutTests/ChangeLog	2013-03-11 14:43:40 UTC (rev 145362)
@@ -1,3 +1,14 @@
+2013-03-11  Kent Tamura  <[email protected]>
+
+        Inappropriate validation message for required number/date input elements
+        https://bugs.webkit.org/show_bug.cgi?id=111982
+
+        Reviewed by Kentaro Hara.
+
+        * fast/forms/validationMessage-expected.txt:
+        * fast/forms/validationMessage.html:
+        * platform/chromium/fast/forms/validationMessage-expected.txt:
+
 2013-03-11  Christophe Dumez  <[email protected]>
 
         Unreviewed EFL gardening.

Modified: trunk/LayoutTests/fast/forms/validationMessage-expected.txt (145361 => 145362)


--- trunk/LayoutTests/fast/forms/validationMessage-expected.txt	2013-03-11 14:19:29 UTC (rev 145361)
+++ trunk/LayoutTests/fast/forms/validationMessage-expected.txt	2013-03-11 14:43:40 UTC (rev 145362)
@@ -9,6 +9,8 @@
 select valueMissing: value missing
 input typeMismatch: type mismatch
 input badInput: type mismatch
+badInput and valueMissing:
+PASS numberInput.validationMessage is nonRequiredBadInputMessage
 PASS but.validationMessage is ''
 PASS anoninput.validationMessage is ''
 PASS happyFieldset.validationMessage is ''

Modified: trunk/LayoutTests/fast/forms/validationMessage.html (145361 => 145362)


--- trunk/LayoutTests/fast/forms/validationMessage.html	2013-03-11 14:19:29 UTC (rev 145361)
+++ trunk/LayoutTests/fast/forms/validationMessage.html	2013-03-11 14:43:40 UTC (rev 145362)
@@ -55,7 +55,12 @@
 numberInput.focus();
 document.execCommand("InsertText", false, "abc");
 debug("input badInput: " + numberInput.validationMessage);
+var nonRequiredBadInputMessage = numberInput.validationMessage;
 
+debug("badInput and valueMissing:");
+numberInput.required = true;
+shouldBe("numberInput.validationMessage", "nonRequiredBadInputMessage");
+
 // A button can't be valited and, thus, has a blank validationMessage
 var but = document.createElement("button");
 but.name = "button";

Modified: trunk/LayoutTests/platform/chromium/fast/forms/validationMessage-expected.txt (145361 => 145362)


--- trunk/LayoutTests/platform/chromium/fast/forms/validationMessage-expected.txt	2013-03-11 14:19:29 UTC (rev 145361)
+++ trunk/LayoutTests/platform/chromium/fast/forms/validationMessage-expected.txt	2013-03-11 14:43:40 UTC (rev 145362)
@@ -9,6 +9,8 @@
 select valueMissing: value missing
 input typeMismatch: type mismatch
 input badInput: Please enter a number.
+badInput and valueMissing:
+PASS numberInput.validationMessage is nonRequiredBadInputMessage
 PASS but.validationMessage is ''
 PASS anoninput.validationMessage is ''
 PASS happyFieldset.validationMessage is ''

Modified: trunk/Source/WebCore/ChangeLog (145361 => 145362)


--- trunk/Source/WebCore/ChangeLog	2013-03-11 14:19:29 UTC (rev 145361)
+++ trunk/Source/WebCore/ChangeLog	2013-03-11 14:43:40 UTC (rev 145362)
@@ -1,3 +1,20 @@
+2013-03-11  Kent Tamura  <[email protected]>
+
+        Inappropriate validation message for required number/date input elements
+        https://bugs.webkit.org/show_bug.cgi?id=111982
+
+        Reviewed by Kentaro Hara.
+
+        For validation message, badInput messages should take precedence
+        over valueMissing messages because users already filled out the
+        field with a bad value.
+
+        Tests: Update fast/forms/validationMessage.html
+
+        * html/InputType.cpp:
+        (WebCore::InputType::validationMessage):
+        Check badInput first.
+
 2013-03-11  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: extract common parts of native profiles

Modified: trunk/Source/WebCore/html/InputType.cpp (145361 => 145362)


--- trunk/Source/WebCore/html/InputType.cpp	2013-03-11 14:19:29 UTC (rev 145361)
+++ trunk/Source/WebCore/html/InputType.cpp	2013-03-11 14:43:40 UTC (rev 145362)
@@ -374,16 +374,16 @@
     const String value = element()->value();
 
     // The order of the following checks is meaningful. e.g. We'd like to show the
-    // valueMissing message even if the control has other validation errors.
+    // badInput message even if the control has other validation errors.
+    if (hasBadInput())
+        return badInputText();
+
     if (valueMissing(value))
         return valueMissingText();
 
     if (typeMismatch())
         return typeMismatchText();
 
-    if (hasBadInput())
-        return badInputText();
-
     if (patternMismatch(value))
         return validationMessagePatternMismatchText();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to