Title: [114092] trunk
Revision
114092
Author
[email protected]
Date
2012-04-13 00:35:40 -0700 (Fri, 13 Apr 2012)

Log Message

Should clear an invalid string in a date field on blur
https://bugs.webkit.org/show_bug.cgi?id=83863

Reviewed by Kentaro Hara.

Source/WebCore:

Test: fast/forms/date/input-date-commit-valid-only.html

* html/DateInputType.cpp:
(WebCore::DateInputType::handleBlurEvent):
Reset the visible value. The code is same as NumberInputType::handleBlurEvent().

LayoutTests:

* fast/forms/date/input-date-commit-valid-only-expected.txt: Added.
* fast/forms/date/input-date-commit-valid-only.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114091 => 114092)


--- trunk/LayoutTests/ChangeLog	2012-04-13 07:30:57 UTC (rev 114091)
+++ trunk/LayoutTests/ChangeLog	2012-04-13 07:35:40 UTC (rev 114092)
@@ -1,5 +1,15 @@
 2012-04-13  Kent Tamura  <[email protected]>
 
+        Should clear an invalid string in a date field on blur
+        https://bugs.webkit.org/show_bug.cgi?id=83863
+
+        Reviewed by Kentaro Hara.
+
+        * fast/forms/date/input-date-commit-valid-only-expected.txt: Added.
+        * fast/forms/date/input-date-commit-valid-only.html: Added.
+
+2012-04-13  Kent Tamura  <[email protected]>
+
         [Chromium] <input type=date> tests should pass.
 
         * platform/chromium/test_expectations.txt:

Added: trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt (0 => 114092)


--- trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt	2012-04-13 07:35:40 UTC (rev 114092)
@@ -0,0 +1,12 @@
+Type=date field should not accept invalid date strings though a user can type such strings
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.value is "2012-04-13"
+PASS document.getSelection().toString() == "+++" is false
+PASS input.value is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only.html (0 => 114092)


--- trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only.html	2012-04-13 07:35:40 UTC (rev 114092)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Type=date field should not accept invalid date strings though a user can type such strings');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type="date" id="date" value="2012-04-13">';
+
+var input = document.getElementById('date');
+input.focus();
+document.execCommand('SelectAll', false, null);
+document.execCommand('InsertText', false, '+++');
+input.blur();
+shouldBe('input.value', '"2012-04-13"');
+input.focus();
+document.execCommand('SelectAll', false, null);
+shouldBeFalse('document.getSelection().toString() == "+++"');
+
+input.focus();
+document.execCommand('SelectAll', false, null);
+document.execCommand('InsertText', false, '');
+input.blur();
+shouldBe('input.value', '""');
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/date/input-date-commit-valid-only.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (114091 => 114092)


--- trunk/Source/WebCore/ChangeLog	2012-04-13 07:30:57 UTC (rev 114091)
+++ trunk/Source/WebCore/ChangeLog	2012-04-13 07:35:40 UTC (rev 114092)
@@ -1,3 +1,16 @@
+2012-04-13  Kent Tamura  <[email protected]>
+
+        Should clear an invalid string in a date field on blur
+        https://bugs.webkit.org/show_bug.cgi?id=83863
+
+        Reviewed by Kentaro Hara.
+
+        Test: fast/forms/date/input-date-commit-valid-only.html
+
+        * html/DateInputType.cpp:
+        (WebCore::DateInputType::handleBlurEvent):
+        Reset the visible value. The code is same as NumberInputType::handleBlurEvent().
+
 2012-04-12  Kent Tamura  <[email protected]>
 
         Calendar Picker: remove unnecessary code from calendarPicker.{css,js}

Modified: trunk/Source/WebCore/html/DateInputType.cpp (114091 => 114092)


--- trunk/Source/WebCore/html/DateInputType.cpp	2012-04-13 07:30:57 UTC (rev 114091)
+++ trunk/Source/WebCore/html/DateInputType.cpp	2012-04-13 07:35:40 UTC (rev 114092)
@@ -132,6 +132,12 @@
 {
     if (m_pickerElement)
         m_pickerElement->closePopup();
+
+    // Reset the renderer value, which might be unmatched with the element value.
+    element()->setFormControlValueMatchesRenderer(false);
+    // We need to reset the renderer value explicitly because an unacceptable
+    // renderer value should be purged before style calculation.
+    element()->updateInnerTextValue();
 }
 #endif // ENABLE(CALENDAR_PICKER)
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to