Title: [140308] trunk/Source/WebCore
Revision
140308
Author
[email protected]
Date
2013-01-21 00:09:21 -0800 (Mon, 21 Jan 2013)

Log Message

Use ISO8601 date/time formats as fallbacks for date/time input types
https://bugs.webkit.org/show_bug.cgi?id=107418

Reviewed by Kentaro Hara.

We obtain date/time formats from OSes to build date/time input type
UIs. If something wrong happens in the code, fallback formats are
used. Such fallback formats should not be English formats in order that
we can find defects easily.

No new tests. These formats should not be used unless the current code
has defects.

* html/DateTimeInputType.cpp:
(WebCore::DateTimeInputType::setupLayoutParameters):
Use an ISO8601 format which is same as a format used in HTML5.
* html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::setupLayoutParameters): Ditto.
* html/MonthInputType.cpp:
(WebCore::MonthInputType::setupLayoutParameters): Ditto.
* html/WeekInputType.cpp:
(WebCore::WeekInputType::setupLayoutParameters): Ditto.
* platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::dateFormat): Ditto.
* platform/text/LocaleNone.cpp:
(WebCore::LocaleNone::dateFormat): Ditto.
(WebCore::LocaleNone::dateTimeFormatWithSeconds): Ditto.
(WebCore::LocaleNone::dateTimeFormatWithoutSeconds): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140307 => 140308)


--- trunk/Source/WebCore/ChangeLog	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/ChangeLog	2013-01-21 08:09:21 UTC (rev 140308)
@@ -1,3 +1,34 @@
+2013-01-21  Kent Tamura  <[email protected]>
+
+        Use ISO8601 date/time formats as fallbacks for date/time input types
+        https://bugs.webkit.org/show_bug.cgi?id=107418
+
+        Reviewed by Kentaro Hara.
+
+        We obtain date/time formats from OSes to build date/time input type
+        UIs. If something wrong happens in the code, fallback formats are
+        used. Such fallback formats should not be English formats in order that
+        we can find defects easily.
+
+        No new tests. These formats should not be used unless the current code
+        has defects.
+
+        * html/DateTimeInputType.cpp:
+        (WebCore::DateTimeInputType::setupLayoutParameters):
+        Use an ISO8601 format which is same as a format used in HTML5.
+        * html/DateTimeLocalInputType.cpp:
+        (WebCore::DateTimeLocalInputType::setupLayoutParameters): Ditto.
+        * html/MonthInputType.cpp:
+        (WebCore::MonthInputType::setupLayoutParameters): Ditto.
+        * html/WeekInputType.cpp:
+        (WebCore::WeekInputType::setupLayoutParameters): Ditto.
+        * platform/text/LocaleICU.cpp:
+        (WebCore::LocaleICU::dateFormat): Ditto.
+        * platform/text/LocaleNone.cpp:
+        (WebCore::LocaleNone::dateFormat): Ditto.
+        (WebCore::LocaleNone::dateTimeFormatWithSeconds): Ditto.
+        (WebCore::LocaleNone::dateTimeFormatWithoutSeconds): Ditto.
+
 2013-01-20  Matt Falkenhagen  <[email protected]>
 
         Elements must be reattached when inserted/removed from top layer

Modified: trunk/Source/WebCore/html/DateTimeInputType.cpp (140307 => 140308)


--- trunk/Source/WebCore/html/DateTimeInputType.cpp	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/html/DateTimeInputType.cpp	2013-01-21 08:09:21 UTC (rev 140308)
@@ -147,10 +147,10 @@
 {
     if (shouldHaveSecondField(date)) {
         layoutParameters.dateTimeFormat = layoutParameters.locale.dateTimeFormatWithSeconds();
-        layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm:ss";
+        layoutParameters.fallbackDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'";
     } else {
         layoutParameters.dateTimeFormat = layoutParameters.locale.dateTimeFormatWithoutSeconds();
-        layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm";
+        layoutParameters.fallbackDateTimeFormat = "yyyy-MM-dd'T'HH:mm'Z'";
     }
     if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
         layoutParameters.minimum = DateComponents();

Modified: trunk/Source/WebCore/html/DateTimeLocalInputType.cpp (140307 => 140308)


--- trunk/Source/WebCore/html/DateTimeLocalInputType.cpp	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/html/DateTimeLocalInputType.cpp	2013-01-21 08:09:21 UTC (rev 140308)
@@ -153,10 +153,10 @@
 {
     if (shouldHaveSecondField(date)) {
         layoutParameters.dateTimeFormat = layoutParameters.locale.dateTimeFormatWithSeconds();
-        layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm:ss";
+        layoutParameters.fallbackDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ss";
     } else {
         layoutParameters.dateTimeFormat = layoutParameters.locale.dateTimeFormatWithoutSeconds();
-        layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm";
+        layoutParameters.fallbackDateTimeFormat = "yyyy-MM-dd'T'HH:mm";
     }
     if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
         layoutParameters.minimum = DateComponents();

Modified: trunk/Source/WebCore/html/MonthInputType.cpp (140307 => 140308)


--- trunk/Source/WebCore/html/MonthInputType.cpp	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/html/MonthInputType.cpp	2013-01-21 08:09:21 UTC (rev 140308)
@@ -155,7 +155,7 @@
 void MonthInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const
 {
     layoutParameters.dateTimeFormat = layoutParameters.locale.monthFormat();
-    layoutParameters.fallbackDateTimeFormat = "MM/yyyy";
+    layoutParameters.fallbackDateTimeFormat = "yyyy-MM";
     if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
         layoutParameters.minimum = DateComponents();
     if (!parseToDateComponents(element()->fastGetAttribute(maxAttr), &layoutParameters.maximum))

Modified: trunk/Source/WebCore/html/WeekInputType.cpp (140307 => 140308)


--- trunk/Source/WebCore/html/WeekInputType.cpp	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/html/WeekInputType.cpp	2013-01-21 08:09:21 UTC (rev 140308)
@@ -109,7 +109,7 @@
 void WeekInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents&) const
 {
     layoutParameters.dateTimeFormat = weekFormatInLDML();
-    layoutParameters.fallbackDateTimeFormat = "'Week' ww-yyyy";
+    layoutParameters.fallbackDateTimeFormat = "yyyy-'W'ww";
     if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
         layoutParameters.minimum = DateComponents();
     if (!parseToDateComponents(element()->fastGetAttribute(maxAttr), &layoutParameters.maximum))

Modified: trunk/Source/WebCore/platform/text/LocaleICU.cpp (140307 => 140308)


--- trunk/Source/WebCore/platform/text/LocaleICU.cpp	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/platform/text/LocaleICU.cpp	2013-01-21 08:09:21 UTC (rev 140308)
@@ -320,7 +320,7 @@
     if (!m_dateFormat.isNull())
         return m_dateFormat;
     if (!initializeShortDateFormat())
-        return ASCIILiteral("dd/MM/yyyy");
+        return ASCIILiteral("yyyy-MM-dd");
     m_dateFormat = getDateFormatPattern(m_shortDateFormat);
     return m_dateFormat;
 }

Modified: trunk/Source/WebCore/platform/text/LocaleNone.cpp (140307 => 140308)


--- trunk/Source/WebCore/platform/text/LocaleNone.cpp	2013-01-21 07:59:39 UTC (rev 140307)
+++ trunk/Source/WebCore/platform/text/LocaleNone.cpp	2013-01-21 08:09:21 UTC (rev 140308)
@@ -91,7 +91,7 @@
 
 String LocaleNone::dateFormat()
 {
-    return ASCIILiteral("dd/MM/yyyyy");
+    return ASCIILiteral("yyyy-MM-dd");
 }
 
 String LocaleNone::monthFormat()
@@ -111,12 +111,12 @@
 
 String LocaleNone::dateTimeFormatWithSeconds()
 {
-    return ASCIILiteral("dd/MM/yyyyy HH:mm:ss");
+    return ASCIILiteral("yyyy-MM-dd'T'HH:mm:ss");
 }
 
 String LocaleNone::dateTimeFormatWithoutSeconds()
 {
-    return ASCIILiteral("dd/MM/yyyyy HH:mm");
+    return ASCIILiteral("yyyy-MM-dd'T'HH:mm");
 }
 
 const Vector<String>& LocaleNone::shortMonthLabels()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to