From: tkent@chromium.org Date: Fri, 13 Apr 2012 07:35:40 +0000 (+0000) Subject: Should clear an invalid string in a date field on blur X-Git-Tag: 070512121124~7082 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae8dbf702f59cfd2c7fa23280bb08b606d7fecd3;p=profile%2Fivi%2Fwebkit-efl.git 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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114092 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index dac35e8..32bcf58 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,5 +1,15 @@ 2012-04-13 Kent Tamura + 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 + [Chromium] tests should pass. * platform/chromium/test_expectations.txt: diff --git a/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt b/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt new file mode 100644 index 0000000..6934545 --- /dev/null +++ b/LayoutTests/fast/forms/date/input-date-commit-valid-only-expected.txt @@ -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 + diff --git a/LayoutTests/fast/forms/date/input-date-commit-valid-only.html b/LayoutTests/fast/forms/date/input-date-commit-valid-only.html new file mode 100644 index 0000000..a17dfde --- /dev/null +++ b/LayoutTests/fast/forms/date/input-date-commit-valid-only.html @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 993b703..576c799 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2012-04-13 Kent Tamura + + 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 Calendar Picker: remove unnecessary code from calendarPicker.{css,js} diff --git a/Source/WebCore/html/DateInputType.cpp b/Source/WebCore/html/DateInputType.cpp index 5abdc24..11b2c99 100644 --- a/Source/WebCore/html/DateInputType.cpp +++ b/Source/WebCore/html/DateInputType.cpp @@ -132,6 +132,12 @@ void DateInputType::handleBlurEvent() { 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)