[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:30:15 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 740361b938e898d3a7c75010eda55036ff093287
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 28 01:24:10 2010 +0000

    2010-01-27  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Darin Adler.
    
            Add valueAsNumber support for type=datetime-local.
            https://bugs.webkit.org/show_bug.cgi?id=34200
    
            The test data is equivalent to input-valueasnumber-datetime.html.
            The expectation contains two FAIL lines because they check
            unimplemented features.
    
            * fast/forms/input-valueasnumber-datetimelocal-expected.txt: Added.
            * fast/forms/input-valueasnumber-datetimelocal.html: Added.
            * fast/forms/script-tests/input-valueasnumber-datetimelocal.js: Added.
    2010-01-27  Kent Tamura  <tkent at chromium.org>
    
            Reviewed by Darin Adler.
    
            Add valueAsNumber support for type=datetime-local.
            https://bugs.webkit.org/show_bug.cgi?id=34200
    
            Implement necessary methods of ISODateTime, and call them from
            HTMLInputElement.
    
            Test: fast/forms/input-valueasnumber-datetimelocal.html
    
            * html/HTMLInputElement.cpp:
            (WebCore::HTMLInputElement::valueAsNumber):
            (WebCore::HTMLInputElement::setValueAsNumber):
            * html/ISODateTime.cpp:
            (WebCore::ISODateTime::setMillisecondsSinceEpochForDateTimeLocal):
              Implemented.  Just call setMillisecondsSinceEpochForDateTime().
            (WebCore::ISODateTime::millisecondsSinceEpochForTime):
              Accept to be called for m_type=DateTimeLocal.
            (WebCore::ISODateTime::toString): Add DateTimeLocal support.
            * html/ISODateTime.h: Declare new methods.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53964 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index bb8c5d8..63b47ae 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-27  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Add valueAsNumber support for type=datetime-local.
+        https://bugs.webkit.org/show_bug.cgi?id=34200
+
+        The test data is equivalent to input-valueasnumber-datetime.html.
+        The expectation contains two FAIL lines because they check
+        unimplemented features.
+
+        * fast/forms/input-valueasnumber-datetimelocal-expected.txt: Added.
+        * fast/forms/input-valueasnumber-datetimelocal.html: Added.
+        * fast/forms/script-tests/input-valueasnumber-datetimelocal.js: Added.
+
 2010-01-27  Brian Weinstein  <bweinstein at apple.com>
 
         Rubber-stamped by Adam Roben.
diff --git a/LayoutTests/fast/forms/input-valueasnumber-datetimelocal-expected.txt b/LayoutTests/fast/forms/input-valueasnumber-datetimelocal-expected.txt
new file mode 100644
index 0000000..4a1d709
--- /dev/null
+++ b/LayoutTests/fast/forms/input-valueasnumber-datetimelocal-expected.txt
@@ -0,0 +1,33 @@
+Tests for .valueAsNumber with <input type=datetime-local>.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS valueAsNumberFor("") is Number.NaN
+PASS valueAsNumberFor("1969-12-31T12:34:56.789") is Date.UTC(1969, 11, 31, 12, 34, 56, 789)
+PASS valueAsNumberFor("1970-01-01T00:00:00.000") is Date.UTC(1970, 0, 1, 0, 0, 0)
+PASS valueAsNumberFor("2009-12-22T11:32:11") is Date.UTC(2009, 11, 22, 11, 32, 11)
+PASS setValueAsNumberAndGetValue(1969, 11, 1, 0, 0, 0, 0) is "1969-12-01T00:00"
+PASS setValueAsNumberAndGetValue(1970, 0, 1, 10, 1, 0, 100) is "1970-01-01T10:01:00.100"
+PASS setValueAsNumberAndGetValue(2009, 11, 31, 23, 59, 59, 999) is "2009-12-31T23:59:59.999"
+PASS setValueAsNumberAndGetValue(10000, 0, 1, 12, 0, 1, 0) is "10000-01-01T12:00:01"
+PASS setValueAsNumberAndGetValue(794, 9, 22, 0, 0, 0, 0) is ""
+PASS setValueAsNumberAndGetValue(1582, 9, 14, 23, 59, 59, 999) is ""
+PASS setValueAsNumberAndGetValue(1582, 9, 15, 0, 0, 0, 0) is "1582-10-15T00:00"
+PASS setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 0) is "275760-09-13T00:00"
+PASS setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 1) is "275760-09-13T00:00:00.001"
+Tests to set invalid values to valueAsNumber:
+PASS input.value = ""; input.valueAsNumber = null; input.value is "1970-01-01T00:00"
+PASS input.valueAsNumber = "foo" threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS input.valueAsNumber = NaN threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS input.valueAsNumber = Number.NaN threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS input.valueAsNumber = Infinity threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS input.valueAsNumber = Number.POSITIVE_INFINITY threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS input.valueAsNumber = Number.NEGATIVE_INFINITY threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Step attribute value and string representation:
+FAIL input.step = "1"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0, 0) should be 2010-01-21T00:00:00. Was 2010-01-21T00:00.
+FAIL input.step = "0.001"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0, 0) should be 2010-01-21T00:00:00.000. Was 2010-01-21T00:00.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/input-valueasnumber-datetimelocal.html b/LayoutTests/fast/forms/input-valueasnumber-datetimelocal.html
new file mode 100644
index 0000000..fffcd77
--- /dev/null
+++ b/LayoutTests/fast/forms/input-valueasnumber-datetimelocal.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/input-valueasnumber-datetimelocal.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/script-tests/input-valueasnumber-datetimelocal.js b/LayoutTests/fast/forms/script-tests/input-valueasnumber-datetimelocal.js
new file mode 100644
index 0000000..61e2cd1
--- /dev/null
+++ b/LayoutTests/fast/forms/script-tests/input-valueasnumber-datetimelocal.js
@@ -0,0 +1,47 @@
+description('Tests for .valueAsNumber with &lt;input type=datetime-local>.');
+
+var input = document.createElement('input');
+input.type = 'datetime-local';
+
+function valueAsNumberFor(stringValue) {
+    input.value = stringValue;
+    return input.valueAsNumber;
+}
+
+function setValueAsNumberAndGetValue(year, month, day, hour, minute, second, msec) {
+    input.valueAsNumber = Date.UTC(year, month, day, hour, minute, second, msec);
+    return input.value;
+}
+
+shouldBe('valueAsNumberFor("")', 'Number.NaN');
+shouldBe('valueAsNumberFor("1969-12-31T12:34:56.789")', 'Date.UTC(1969, 11, 31, 12, 34, 56, 789)');
+shouldBe('valueAsNumberFor("1970-01-01T00:00:00.000")', 'Date.UTC(1970, 0, 1, 0, 0, 0)');
+shouldBe('valueAsNumberFor("2009-12-22T11:32:11")', 'Date.UTC(2009, 11, 22, 11, 32, 11)');
+
+shouldBe('setValueAsNumberAndGetValue(1969, 11, 1, 0, 0, 0, 0)', '"1969-12-01T00:00"');
+shouldBe('setValueAsNumberAndGetValue(1970, 0, 1, 10, 1, 0, 100)', '"1970-01-01T10:01:00.100"');
+shouldBe('setValueAsNumberAndGetValue(2009, 11, 31, 23, 59, 59, 999)', '"2009-12-31T23:59:59.999"');
+shouldBe('setValueAsNumberAndGetValue(10000, 0, 1, 12, 0, 1, 0)', '"10000-01-01T12:00:01"');
+
+shouldBe('setValueAsNumberAndGetValue(794, 9, 22, 0, 0, 0, 0)', '""');
+shouldBe('setValueAsNumberAndGetValue(1582, 9, 14, 23, 59, 59, 999)', '""');
+shouldBe('setValueAsNumberAndGetValue(1582, 9, 15, 0, 0, 0, 0)', '"1582-10-15T00:00"');
+shouldBe('setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 0)', '"275760-09-13T00:00"');
+shouldBe('setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 1)', '"275760-09-13T00:00:00.001"');
+
+debug('Tests to set invalid values to valueAsNumber:');
+shouldBe('input.value = ""; input.valueAsNumber = null; input.value', '"1970-01-01T00:00"');
+shouldThrow('input.valueAsNumber = "foo"', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+shouldThrow('input.valueAsNumber = NaN', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+shouldThrow('input.valueAsNumber = Number.NaN', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+shouldThrow('input.valueAsNumber = Infinity', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+shouldThrow('input.valueAsNumber = Number.POSITIVE_INFINITY', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+shouldThrow('input.valueAsNumber = Number.NEGATIVE_INFINITY', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+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"; setValueAsNumberAndGetValue(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"; setValueAsNumberAndGetValue(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 6f853f1..a000a09 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-01-27  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Add valueAsNumber support for type=datetime-local.
+        https://bugs.webkit.org/show_bug.cgi?id=34200
+
+        Implement necessary methods of ISODateTime, and call them from
+        HTMLInputElement.
+
+        Test: fast/forms/input-valueasnumber-datetimelocal.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::valueAsNumber):
+        (WebCore::HTMLInputElement::setValueAsNumber):
+        * html/ISODateTime.cpp:
+        (WebCore::ISODateTime::setMillisecondsSinceEpochForDateTimeLocal):
+          Implemented.  Just call setMillisecondsSinceEpochForDateTime().
+        (WebCore::ISODateTime::millisecondsSinceEpochForTime):
+          Accept to be called for m_type=DateTimeLocal.
+        (WebCore::ISODateTime::toString): Add DateTimeLocal support.
+        * html/ISODateTime.h: Declare new methods.
+
 2010-01-27  Steve Falkenburg  <sfalken at apple.com>
 
         Windows Debug_All build fix.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index b60cdfd..0d689cb 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -1473,6 +1473,7 @@ double HTMLInputElement::valueAsNumber() const
     switch (inputType()) {
     case DATE:
     case DATETIME:
+    case DATETIMELOCAL:
     case MONTH:
     case TIME:
     case WEEK: {
@@ -1492,7 +1493,6 @@ double HTMLInputElement::valueAsNumber() const
     case BUTTON:
     case CHECKBOX:
     case COLOR:
-    case DATETIMELOCAL: // FIXME: Unlike valueAsDate, valueAsNumber should support DATETIMELOCAL type.
     case EMAIL:
     case FILE:
     case HIDDEN:
@@ -1526,12 +1526,23 @@ void HTMLInputElement::setValueAsNumber(double newValue, ExceptionCode& ec)
     case WEEK:
         setValueAsDate(newValue, ec);
         return;
+    case DATETIMELOCAL: {
+        ISODateTime dateTime;
+        if (!dateTime.setMillisecondsSinceEpochForDateTimeLocal(newValue)) {
+            setValue(String());
+            return;
+        }
+        // FIXME: We should specify SecondFormat.
+        // e.g. If the step value is 60, use SecondFormat::None.
+        //      If the step value is 1, use SecondFormat::Second.
+        setValue(dateTime.toString());
+        return;
+    }
     case NUMBER:
     case RANGE:
         setValue(formStringFromDouble(newValue));
         return;
 
-    case DATETIMELOCAL: // FIXME: implement ISODateTime.toString()
     case BUTTON:
     case CHECKBOX:
     case COLOR:
diff --git a/WebCore/html/ISODateTime.cpp b/WebCore/html/ISODateTime.cpp
index a19e507..3ed3007 100644
--- a/WebCore/html/ISODateTime.cpp
+++ b/WebCore/html/ISODateTime.cpp
@@ -504,6 +504,15 @@ bool ISODateTime::setMillisecondsSinceEpochForDateTime(double ms)
     return true;
 }
 
+bool ISODateTime::setMillisecondsSinceEpochForDateTimeLocal(double ms)
+{
+    // Internal representation of DateTimeLocal is the same as DateTime except m_type.
+    if (!setMillisecondsSinceEpochForDateTime(ms))
+        return false;
+    m_type = DateTimeLocal;
+    return true;
+}
+
 bool ISODateTime::setMillisecondsSinceEpochForMonth(double ms)
 {
     m_type = Invalid;
@@ -571,7 +580,7 @@ bool ISODateTime::setMillisecondsSinceEpochForWeek(double ms)
 
 double ISODateTime::millisecondsSinceEpochForTime() const
 {
-    ASSERT(m_type == Time || m_type == DateTime);
+    ASSERT(m_type == Time || m_type == DateTime || m_type == DateTimeLocal);
     return ((m_hour * minutesPerHour + m_minute) * secondsPerMinute + m_second) * msPerSecond + m_millisecond;
 }
 
@@ -626,13 +635,15 @@ String ISODateTime::toString(SecondFormat format) const
     case DateTime:
         return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
             + toStringForTime(format) + String("Z");
+    case DateTimeLocal:
+        return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
+            + toStringForTime(format);
     case Month:
         return String::format("%04d-%02d", m_year, m_month + 1);
     case Time:
         return toStringForTime(format);
     case Week:
         return String::format("%04d-W%02d", m_year, m_week);
-    case DateTimeLocal:
     case Invalid:
         break;
     }
diff --git a/WebCore/html/ISODateTime.h b/WebCore/html/ISODateTime.h
index 82e3848..ced503a 100644
--- a/WebCore/html/ISODateTime.h
+++ b/WebCore/html/ISODateTime.h
@@ -114,6 +114,8 @@ public:
     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 DateTimeLocal type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
+    bool setMillisecondsSinceEpochForDateTimeLocal(double ms);
     // For Month type. Updates m_year and m_month.
     bool setMillisecondsSinceEpochForMonth(double ms);
     // For Week type. Updates m_year and m_week.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list