-
tkent@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=39737 Reviewed by Darin Adler. WebCore: According to the latest draft of HTML5, ISO-8601 dates in HTML5 should support A.D.0001 in Gregorian calendar though Gregorian calendar started in 1582. So, we change the lower limits of date&time types to 0001-01-01T00:00. We also introduce the common higher limit, 275760-09-13T00:00. It is the higher limit of Date type of ECMAScript. * html/DateComponents.cpp: (WebCore::DateComponents::parseYear): Rejects years less than A.D.1 and years greater than 275760. (WebCore::withinHTMLDateLimits): Helper functions to check lower and higher limits. (WebCore::DateComponents::addDay): - Remove an overflow check. 'year' can't be so large number because parseYear() rejects such numbers. - Add withinHTMLDateLimits() calls. (WebCore::DateComponents::addMinute): - Add an assertion for the base date. - Add withinHTMLDateLimits() calls. (WebCore::DateComponents::parseMonth): Add withinHTMLDateLimits() call. (WebCore::DateComponents::parseDate): ditto. (WebCore::DateComponents::parseWeek): ditto. (WebCore::DateComponents::parseDateTimeLocal): ditto. (WebCore::DateComponents::parseDateTime): ditto. (WebCore::DateComponents::setMillisecondsSinceEpochForDate): ditto. (WebCore::DateComponents::setMillisecondsSinceEpochForDateTime): ditto. (WebCore::DateComponents::setMillisecondsSinceEpochForMonth): ditto. (WebCore::DateComponents::setMonthsSinceEpoch): Add year range check and withinHTMLDateLimits() call. (WebCore::DateComponents::setMillisecondsSinceEpochForWeek): Add year range check and week range check. * html/DateComponents.h: Update minimum/maximum constant values. (WebCore::DateComponents::minimumDate): (WebCore::DateComponents::minimumDateTime): (WebCore::DateComponents::minimumMonth): (WebCore::DateComponents::minimumWeek): (WebCore::DateComponents::maximumDate): (WebCore::DateComponents::maximumDateTime): (WebCore::DateComponents::maximumMonth): (WebCore::DateComponents::maximumWeek): LayoutTests: Update tests and test results for the new DateComponents behavior. * fast/forms/ValidityState-rangeOverflow-expected.txt: * fast/forms/ValidityState-stepMismatch-expected.txt: * fast/forms/ValidityState-typeMismatch-date-expected.txt: * fast/forms/ValidityState-typeMismatch-datetime-expected.txt: * fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt: * fast/forms/ValidityState-typeMismatch-month-expected.txt: * fast/forms/ValidityState-typeMismatch-week-expected.txt: * fast/forms/input-valueasdate-date-expected.txt: * fast/forms/input-valueasdate-datetime-expected.txt: * fast/forms/input-valueasdate-month-expected.txt: * fast/forms/input-valueasdate-week-expected.txt: * fast/forms/input-valueasnumber-date-expected.txt: * fast/forms/input-valueasnumber-datetime-expected.txt: * fast/forms/input-valueasnumber-datetimelocal-expected.txt: * fast/forms/input-valueasnumber-month-expected.txt: * fast/forms/input-valueasnumber-week-expected.txt: * fast/forms/script-tests/ValidityState-rangeOverflow.js: * fast/forms/script-tests/ValidityState-stepMismatch.js: * fast/forms/script-tests/ValidityState-typeMismatch-date.js: * fast/forms/script-tests/ValidityState-typeMismatch-datetime.js: * fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js: * fast/forms/script-tests/ValidityState-typeMismatch-month.js: * fast/forms/script-tests/ValidityState-typeMismatch-week.js: * fast/forms/script-tests/input-valueasdate-date.js: * fast/forms/script-tests/input-valueasdate-datetime.js: * fast/forms/script-tests/input-valueasdate-month.js: * fast/forms/script-tests/input-valueasdate-week.js: * fast/forms/script-tests/input-valueasnumber-date.js: * fast/forms/script-tests/input-valueasnumber-datetime.js: * fast/forms/script-tests/input-valueasnumber-datetimelocal.js: * fast/forms/script-tests/input-valueasnumber-month.js: * fast/forms/script-tests/input-valueasnumber-week.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
cff83f5c