[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
eric at webkit.org
eric at webkit.org
Thu Feb 4 21:22:42 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit ad4fa292d7a7509e3a72007463c54b9272a97153
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 21 04:39:06 2010 +0000
2010-01-20 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
HTMLInputElement::valueAsDate setter support for type=date.
https://bugs.webkit.org/show_bug.cgi?id=33911
Add setter tests to input-valueasdate-date.js, and update the
expectation.
* fast/forms/input-valueasdate-date-expected.txt:
* fast/forms/script-tests/input-valueasdate-date.js:
2010-01-20 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
HTMLInputElement::valueAsDate setter support for type=date.
https://bugs.webkit.org/show_bug.cgi?id=33911
Introduce ISODateTime::setMillisecondsSinceEpochForDate() and add Date
type support to ISODateTime::toString().
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValueAsDate):
* html/ISODateTime.cpp:
(WebCore::ISODateTime::setMillisecondsSinceEpochForDate):
(WebCore::ISODateTime::toString):
* html/ISODateTime.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 05031e3..3e7ff9e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-20 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HTMLInputElement::valueAsDate setter support for type=date.
+ https://bugs.webkit.org/show_bug.cgi?id=33911
+
+ Add setter tests to input-valueasdate-date.js, and update the
+ expectation.
+
+ * fast/forms/input-valueasdate-date-expected.txt:
+ * fast/forms/script-tests/input-valueasdate-date.js:
+
2010-01-20 Ben Murdoch <benm at google.com>
Reviewed by Simon Hausmann.
diff --git a/LayoutTests/fast/forms/input-valueasdate-date-expected.txt b/LayoutTests/fast/forms/input-valueasdate-date-expected.txt
index 108de8b..897a0cf 100644
--- a/LayoutTests/fast/forms/input-valueasdate-date-expected.txt
+++ b/LayoutTests/fast/forms/input-valueasdate-date-expected.txt
@@ -7,6 +7,19 @@ PASS valueAsDateFor("") is null
PASS valueAsDateFor("1969-12-31").getTime() is Date.UTC(1969, 11, 31)
PASS valueAsDateFor("1970-01-01").getTime() is Date.UTC(1970, 0, 1)
PASS valueAsDateFor("2009-12-22").getTime() is Date.UTC(2009, 11, 22)
+PASS setValueAsDateAndGetValue(1969, 11, 1) is "1969-12-01"
+PASS setValueAsDateAndGetValue(1970, 0, 1) is "1970-01-01"
+PASS setValueAsDateAndGetValue(2009, 11, 31) is "2009-12-31"
+PASS setValueAsDateAndGetValue(10000, 0, 1) is "10000-01-01"
+PASS setValueAsDateAndGetValue(794, 9, 22) is ""
+PASS setValueAsDateAndGetValue(1582, 8, 30) is ""
+FAIL setValueAsDateAndGetValue(1582, 9, 1) should be 1582-10-01. Was .
+PASS setValueAsDateAndGetValue(1582, 9, 31) is "1582-10-31"
+PASS setValueAsDateAndGetValue(275760, 8, 13) is "275760-09-13"
+PASS setValueAsDateAndGetValue(275760, 8, 14) is ""
+Invalid objects:
+PASS input.value = "2010-01-01"; input.valueAsDate = document; input.value is ""
+PASS input.value = "2010-01-01"; input.valueAsDate = null; input.value is ""
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/script-tests/input-valueasdate-date.js b/LayoutTests/fast/forms/script-tests/input-valueasdate-date.js
index f07f773..0aff239 100644
--- a/LayoutTests/fast/forms/script-tests/input-valueasdate-date.js
+++ b/LayoutTests/fast/forms/script-tests/input-valueasdate-date.js
@@ -8,9 +8,32 @@ function valueAsDateFor(stringValue) {
return input.valueAsDate;
}
+function setValueAsDateAndGetValue(year, month, day) {
+ var date = new Date();
+ date.setTime(Date.UTC(year, month, day));
+ input.valueAsDate = date;
+ return input.value;
+}
+
shouldBe('valueAsDateFor("")', 'null');
shouldBe('valueAsDateFor("1969-12-31").getTime()', 'Date.UTC(1969, 11, 31)');
shouldBe('valueAsDateFor("1970-01-01").getTime()', 'Date.UTC(1970, 0, 1)');
shouldBe('valueAsDateFor("2009-12-22").getTime()', 'Date.UTC(2009, 11, 22)');
+shouldBe('setValueAsDateAndGetValue(1969, 11, 1)', '"1969-12-01"');
+shouldBe('setValueAsDateAndGetValue(1970, 0, 1)', '"1970-01-01"');
+shouldBe('setValueAsDateAndGetValue(2009, 11, 31)', '"2009-12-31"');
+shouldBe('setValueAsDateAndGetValue(10000, 0, 1)', '"10000-01-01"');
+
+shouldBe('setValueAsDateAndGetValue(794, 9, 22)', '""');
+shouldBe('setValueAsDateAndGetValue(1582, 8, 30)', '""');
+shouldBe('setValueAsDateAndGetValue(1582, 9, 1)', '"1582-10-01"');
+shouldBe('setValueAsDateAndGetValue(1582, 9, 31)', '"1582-10-31"');
+shouldBe('setValueAsDateAndGetValue(275760, 8, 13)', '"275760-09-13"');
+shouldBe('setValueAsDateAndGetValue(275760, 8, 14)', '""'); // Date of JavaScript can't represent this.
+
+debug('Invalid objects:');
+shouldBe('input.value = "2010-01-01"; input.valueAsDate = document; input.value', '""');
+shouldBe('input.value = "2010-01-01"; input.valueAsDate = null; input.value', '""');
+
var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 93fefec..63b44ef 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-20 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HTMLInputElement::valueAsDate setter support for type=date.
+ https://bugs.webkit.org/show_bug.cgi?id=33911
+
+ Introduce ISODateTime::setMillisecondsSinceEpochForDate() and add Date
+ type support to ISODateTime::toString().
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setValueAsDate):
+ * html/ISODateTime.cpp:
+ (WebCore::ISODateTime::setMillisecondsSinceEpochForDate):
+ (WebCore::ISODateTime::toString):
+ * html/ISODateTime.h:
+
2010-01-20 Ben Murdoch <benm at google.com>
Reviewed by Simon Hausmann.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index b18aa35..b5bea78 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -1398,6 +1398,9 @@ void HTMLInputElement::setValueAsDate(double value, ExceptionCode& ec)
ISODateTime dateTime;
bool success;
switch (inputType()) {
+ case DATE:
+ success = dateTime.setMillisecondsSinceEpochForDate(value);
+ break;
case MONTH:
success = dateTime.setMillisecondsSinceEpochForMonth(value);
break;
diff --git a/WebCore/html/ISODateTime.cpp b/WebCore/html/ISODateTime.cpp
index 6fbc64a..c42750b 100644
--- a/WebCore/html/ISODateTime.cpp
+++ b/WebCore/html/ISODateTime.cpp
@@ -476,6 +476,18 @@ bool ISODateTime::setMillisecondsSinceEpochForDateInternal(double ms)
return true;
}
+bool ISODateTime::setMillisecondsSinceEpochForDate(double ms)
+{
+ if (!isfinite(ms))
+ return false;
+ if (!setMillisecondsSinceEpochForDateInternal(ms))
+ return false;
+ if (beforeGregorianStartDate(m_year, m_month, m_monthDay))
+ return false;
+ m_type = Date;
+ return true;
+}
+
bool ISODateTime::setMillisecondsSinceEpochForMonth(double ms)
{
if (!isfinite(ms))
@@ -556,6 +568,8 @@ String ISODateTime::toStringForTime(SecondFormat format) const
String ISODateTime::toString(SecondFormat format) const
{
switch (m_type) {
+ case Date:
+ return String::format("%04d-%02d-%02d", m_year, m_month + 1, m_monthDay);
case Month:
return String::format("%04d-%02d", m_year, m_month + 1);
case Time:
diff --git a/WebCore/html/ISODateTime.h b/WebCore/html/ISODateTime.h
index f0dc25f..39088b4 100644
--- a/WebCore/html/ISODateTime.h
+++ b/WebCore/html/ISODateTime.h
@@ -100,12 +100,14 @@ public:
// Sets year, month, monthDay, hour, minute, second and millisecond, and adjusts timezone.
bool parseDateTime(const UChar* src, unsigned length, unsigned start, unsigned& end);
- // The following setMillisecondsSinceEpochFor*() function takes
+ // The following setMillisecondsSinceEpochFor*() functions take
// the number of milliseconds since 1970-01-01 00:00:00.000 UTC as
// the argument, and update all fields for the corresponding
- // ISODateTime type. The function returns true if it succeeds, and
- // false if it fails.
+ // ISODateTime type. The functions return true if it succeeds, and
+ // false if they fail.
+ // For Date type. Updates m_year, m_month and m_monthDay.
+ bool setMillisecondsSinceEpochForDate(double ms);
// For Month type. Updates m_year and m_month.
bool setMillisecondsSinceEpochForMonth(double ms);
// FIXME: Add setMillisecondsSinceEpochFor*() for other types.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list