[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
tkent at chromium.org
tkent at chromium.org
Thu Feb 4 21:24:14 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit c7ca4b6f621e0a3102198d2a5d5f62bf111bbc63
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 22 03:29:30 2010 +0000
2010-01-21 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
HTMLInputElement::valueAsDate setter support for type=datetime.
https://bugs.webkit.org/show_bug.cgi?id=33939
Add setter tests to input-valueasdate-datetime.js, and update the
expectation.
Note: the expectation file contains some FAIL lines. They are
intentional because they test a unimplemented feature.
* fast/forms/input-valueasdate-datetime-expected.txt:
* fast/forms/script-tests/input-valueasdate-datetime.js:
2010-01-21 Kent Tamura <tkent at chromium.org>
Reviewed by Darin Adler.
HTMLInputElement::valueAsDate setter support for type=datetime.
https://bugs.webkit.org/show_bug.cgi?id=33939
Introduce ISODateTime::setMillisecondsSinceEpochForDateTime() and add
DateTime type support to ISODateTime::toString().
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValueAsDate):
* html/ISODateTime.cpp:
(WebCore::ISODateTime::setMillisecondsSinceEpochForDate):
Set Invalid to m_type.
(WebCore::ISODateTime::setMillisecondsSinceEpochForDateTime):
(WebCore::ISODateTime::setMillisecondsSinceEpochForMonth):
Set Invalid to m_type.
(WebCore::ISODateTime::setMillisecondsSinceMidnight):
Set Invalid to m_type.
(WebCore::ISODateTime::toString):
Support DateTime type. This always produces UTC representation.
* html/ISODateTime.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a864f48..2b6575d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-01-21 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HTMLInputElement::valueAsDate setter support for type=datetime.
+ https://bugs.webkit.org/show_bug.cgi?id=33939
+
+ Add setter tests to input-valueasdate-datetime.js, and update the
+ expectation.
+
+ Note: the expectation file contains some FAIL lines. They are
+ intentional because they test a unimplemented feature.
+
+ * fast/forms/input-valueasdate-datetime-expected.txt:
+ * fast/forms/script-tests/input-valueasdate-datetime.js:
+
2010-01-21 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/forms/input-valueasdate-datetime-expected.txt b/LayoutTests/fast/forms/input-valueasdate-datetime-expected.txt
index 95e5fe8..b872c1f 100644
--- a/LayoutTests/fast/forms/input-valueasdate-datetime-expected.txt
+++ b/LayoutTests/fast/forms/input-valueasdate-datetime-expected.txt
@@ -7,6 +7,21 @@ PASS valueAsDateFor("") is null
PASS valueAsDateFor("1969-12-31T12:34:56.789Z").getTime() is Date.UTC(1969, 11, 31, 12, 34, 56, 789)
PASS valueAsDateFor("1970-01-01T00:00:00.000Z").getTime() is Date.UTC(1970, 0, 1, 0, 0, 0)
PASS valueAsDateFor("2009-12-22T11:32:11Z").getTime() is Date.UTC(2009, 11, 22, 11, 32, 11)
+PASS setValueAsDateAndGetValue(1969, 11, 1, 0, 0, 0, 0) is "1969-12-01T00:00Z"
+PASS setValueAsDateAndGetValue(1970, 0, 1, 10, 1, 0, 100) is "1970-01-01T10:01:00.100Z"
+PASS setValueAsDateAndGetValue(2009, 11, 31, 23, 59, 59, 999) is "2009-12-31T23:59:59.999Z"
+PASS setValueAsDateAndGetValue(10000, 0, 1, 12, 0, 1, 0) is "10000-01-01T12:00:01Z"
+PASS setValueAsDateAndGetValue(794, 9, 22, 0, 0, 0, 0) is ""
+PASS setValueAsDateAndGetValue(1582, 9, 14, 23, 59, 59, 999) is ""
+PASS setValueAsDateAndGetValue(1582, 9, 15, 0, 0, 0, 0) is "1582-10-15T00:00Z"
+PASS setValueAsDateAndGetValue(275760, 8, 13, 0, 0, 0, 0) is "275760-09-13T00:00Z"
+PASS setValueAsDateAndGetValue(275760, 8, 13, 0, 0, 0, 1) is ""
+Invalid objects:
+PASS input.value = "2010-01-01T00:00Z"; input.valueAsDate = document; input.value is ""
+PASS input.value = "2010-01-01T00:00Z"; input.valueAsDate = null; input.value is ""
+Step attribute value and string representation:
+FAIL input.step = "1"; setValueAsDateAndGetValue(2010, 0, 21, 0, 0, 0, 0) should be 2010-01-21T00:00:00. Was 2010-01-21T00:00Z.
+FAIL input.step = "0.001"; setValueAsDateAndGetValue(2010, 0, 21, 0, 0, 0, 0) should be 2010-01-21T00:00:00.000. Was 2010-01-21T00:00Z.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/script-tests/input-valueasdate-datetime.js b/LayoutTests/fast/forms/script-tests/input-valueasdate-datetime.js
index c264f87..cb0f9e1 100644
--- a/LayoutTests/fast/forms/script-tests/input-valueasdate-datetime.js
+++ b/LayoutTests/fast/forms/script-tests/input-valueasdate-datetime.js
@@ -8,9 +8,37 @@ function valueAsDateFor(stringValue) {
return input.valueAsDate;
}
+function setValueAsDateAndGetValue(year, month, day, hour, minute, second, msec) {
+ var date = new Date();
+ date.setTime(Date.UTC(year, month, day, hour, minute, second, msec));
+ input.valueAsDate = date;
+ return input.value;
+}
+
shouldBe('valueAsDateFor("")', 'null');
shouldBe('valueAsDateFor("1969-12-31T12:34:56.789Z").getTime()', 'Date.UTC(1969, 11, 31, 12, 34, 56, 789)');
shouldBe('valueAsDateFor("1970-01-01T00:00:00.000Z").getTime()', 'Date.UTC(1970, 0, 1, 0, 0, 0)');
shouldBe('valueAsDateFor("2009-12-22T11:32:11Z").getTime()', 'Date.UTC(2009, 11, 22, 11, 32, 11)');
+shouldBe('setValueAsDateAndGetValue(1969, 11, 1, 0, 0, 0, 0)', '"1969-12-01T00:00Z"');
+shouldBe('setValueAsDateAndGetValue(1970, 0, 1, 10, 1, 0, 100)', '"1970-01-01T10:01:00.100Z"');
+shouldBe('setValueAsDateAndGetValue(2009, 11, 31, 23, 59, 59, 999)', '"2009-12-31T23:59:59.999Z"');
+shouldBe('setValueAsDateAndGetValue(10000, 0, 1, 12, 0, 1, 0)', '"10000-01-01T12:00:01Z"');
+
+shouldBe('setValueAsDateAndGetValue(794, 9, 22, 0, 0, 0, 0)', '""');
+shouldBe('setValueAsDateAndGetValue(1582, 9, 14, 23, 59, 59, 999)', '""');
+shouldBe('setValueAsDateAndGetValue(1582, 9, 15, 0, 0, 0, 0)', '"1582-10-15T00:00Z"');
+shouldBe('setValueAsDateAndGetValue(275760, 8, 13, 0, 0, 0, 0)', '"275760-09-13T00:00Z"');
+shouldBe('setValueAsDateAndGetValue(275760, 8, 13, 0, 0, 0, 1)', '""'); // Date of JavaScript can't represent this.
+
+debug('Invalid objects:');
+shouldBe('input.value = "2010-01-01T00:00Z"; input.valueAsDate = document; input.value', '""');
+shouldBe('input.value = "2010-01-01T00:00Z"; input.valueAsDate = null; input.value', '""');
+
+debug('Step attribute value and string representation:');
+// If the step attribute value is 1 second and the second part is 0, we should show the second part.
+shouldBe('input.step = "1"; setValueAsDateAndGetValue(2010, 0, 21, 0, 0, 0, 0)', '"2010-01-21T00:00:00"');
+// If the step attribute value is 0.001 second and the millisecond part is 0, we should show the millisecond part.
+shouldBe('input.step = "0.001"; setValueAsDateAndGetValue(2010, 0, 21, 0, 0, 0, 0)', '"2010-01-21T00:00:00.000"');
+
var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 34dfe47..52ac0a0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-01-21 Kent Tamura <tkent at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ HTMLInputElement::valueAsDate setter support for type=datetime.
+ https://bugs.webkit.org/show_bug.cgi?id=33939
+
+ Introduce ISODateTime::setMillisecondsSinceEpochForDateTime() and add
+ DateTime type support to ISODateTime::toString().
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setValueAsDate):
+ * html/ISODateTime.cpp:
+ (WebCore::ISODateTime::setMillisecondsSinceEpochForDate):
+ Set Invalid to m_type.
+ (WebCore::ISODateTime::setMillisecondsSinceEpochForDateTime):
+ (WebCore::ISODateTime::setMillisecondsSinceEpochForMonth):
+ Set Invalid to m_type.
+ (WebCore::ISODateTime::setMillisecondsSinceMidnight):
+ Set Invalid to m_type.
+ (WebCore::ISODateTime::toString):
+ Support DateTime type. This always produces UTC representation.
+ * html/ISODateTime.h:
+
2010-01-21 Geoffrey Garen <ggaren at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index b5bea78..78d1784 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -1401,6 +1401,9 @@ void HTMLInputElement::setValueAsDate(double value, ExceptionCode& ec)
case DATE:
success = dateTime.setMillisecondsSinceEpochForDate(value);
break;
+ case DATETIME:
+ success = dateTime.setMillisecondsSinceEpochForDateTime(value);
+ break;
case MONTH:
success = dateTime.setMillisecondsSinceEpochForMonth(value);
break;
diff --git a/WebCore/html/ISODateTime.cpp b/WebCore/html/ISODateTime.cpp
index c42750b..f9b45b0 100644
--- a/WebCore/html/ISODateTime.cpp
+++ b/WebCore/html/ISODateTime.cpp
@@ -478,9 +478,10 @@ bool ISODateTime::setMillisecondsSinceEpochForDateInternal(double ms)
bool ISODateTime::setMillisecondsSinceEpochForDate(double ms)
{
+ m_type = Invalid;
if (!isfinite(ms))
return false;
- if (!setMillisecondsSinceEpochForDateInternal(ms))
+ if (!setMillisecondsSinceEpochForDateInternal(round(ms)))
return false;
if (beforeGregorianStartDate(m_year, m_month, m_monthDay))
return false;
@@ -488,12 +489,28 @@ bool ISODateTime::setMillisecondsSinceEpochForDate(double ms)
return true;
}
-bool ISODateTime::setMillisecondsSinceEpochForMonth(double ms)
+bool ISODateTime::setMillisecondsSinceEpochForDateTime(double ms)
{
+ m_type = Invalid;
if (!isfinite(ms))
return false;
+ ms = round(ms);
+ setMillisecondsSinceMidnightInternal(positiveFmod(ms, msPerDay));
if (!setMillisecondsSinceEpochForDateInternal(ms))
return false;
+ if (beforeGregorianStartDate(m_year, m_month, m_monthDay))
+ return false;
+ m_type = DateTime;
+ return true;
+}
+
+bool ISODateTime::setMillisecondsSinceEpochForMonth(double ms)
+{
+ m_type = Invalid;
+ if (!isfinite(ms))
+ return false;
+ if (!setMillisecondsSinceEpochForDateInternal(round(ms)))
+ return false;
// Ignore m_monthDay updated by setMillisecondsSinceEpochForDateInternal().
if (beforeGregorianStartDate(m_year, m_month, gregorianStartDay))
return false;
@@ -503,6 +520,7 @@ bool ISODateTime::setMillisecondsSinceEpochForMonth(double ms)
bool ISODateTime::setMillisecondsSinceMidnight(double ms)
{
+ m_type = Invalid;
if (!isfinite(ms))
return false;
setMillisecondsSinceMidnightInternal(positiveFmod(round(ms), msPerDay));
@@ -570,6 +588,9 @@ 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 DateTime:
+ return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
+ + toStringForTime(format) + String("Z");
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 39088b4..e526eb9 100644
--- a/WebCore/html/ISODateTime.h
+++ b/WebCore/html/ISODateTime.h
@@ -78,6 +78,10 @@ public:
// The format argument is valid for DateTime, DateTimeLocal, and Time types.
String toString(SecondFormat format = None) const;
+ // parse*() and setMillisecondsSince*() functions are initializers for an
+ // ISODateTime instance. If these functions return false, the instance
+ // might be invalid.
+
// The following six functions parse the input 'src' whose length is
// 'length', and updates some fields of this instance. The parsing starts at
// src[start] and examines characters before src[length].
@@ -108,6 +112,8 @@ public:
// For Date type. Updates m_year, m_month and m_monthDay.
bool setMillisecondsSinceEpochForDate(double ms);
+ // For DateTime type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
+ bool setMillisecondsSinceEpochForDateTime(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