Use localized date-time format in datetime input
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Nov 2012 08:16:35 +0000 (08:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Nov 2012 08:16:35 +0000 (08:16 +0000)
commit633d8cd7292ec5b4ea54a0547ac1d52830f021f2
tree91d5d68c67be234bd3f084222a4161073164bdf0
parentdd073e981752bb24e69c4c18f8b35914187da402
Use localized date-time format in datetime input
https://bugs.webkit.org/show_bug.cgi?id=102769

Patch by Kunihiko Sakamoto <ksakamoto@chromium.org> on 2012-11-20
Reviewed by Kent Tamura.

Source/WebCore:

Move the implementation of Locale::dateTimeFormatWithSeconds and Locale::dateTimeFormatWithoutSeconds
to its subclasses and use platform-specific methods to get date-time pattern.
Because Windows does not provide an API to get date-time pattern. We use fixed "{date} {time}"
pattern for Windows.

Test: fast/forms/datetime/datetime-appearance-l10n.html

* platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::initializeDateTimeFormat): Retrieve datetime formats too.
(WebCore::LocaleICU::dateTimeFormatWithSeconds): Added.
(WebCore):
(WebCore::LocaleICU::dateTimeFormatWithoutSeconds): Added.
* platform/text/LocaleICU.h:
(LocaleICU): Add m_dateTimeFormatWithSeconds and m_dateTimeFormatWithoutSeconds.
* platform/text/LocaleNone.cpp:
(LocaleNone):
(WebCore::LocaleNone::dateTimeFormatWithSeconds): Added. Always returns "dd/MM/yyyyy HH:mm:ss".
(WebCore):
(WebCore::LocaleNone::dateTimeFormatWithoutSeconds): Added. Always returns "dd/MM/yyyyy HH:mm".
* platform/text/PlatformLocale.cpp:
(WebCore): Remove dateTimeFormatWithSeconds() and dateTimeFormatWithoutSeconds() as these are now pure virtual.
* platform/text/PlatformLocale.h:
(Locale): Make dateTimeFormatWithSeconds() and dateTimeFormatWithoutSeconds() pure virtual.
* platform/text/mac/LocaleMac.h:
(LocaleMac): Add m_dateTimeFormatWithSeconds and m_dateTimeFormatWithoutSeconds.
* platform/text/mac/LocaleMac.mm:
(WebCore::LocaleMac::dateTimeFormatterWithSeconds): Added.
(WebCore):
(WebCore::LocaleMac::dateTimeFormatterWithoutSeconds): Added.
(WebCore::LocaleMac::dateTimeFormatWithSeconds): Added.
(WebCore::LocaleMac::dateTimeFormatWithoutSeconds): Added.
* platform/text/win/LocaleWin.cpp:
(WebCore::LocaleWin::dateTimeFormatWithSeconds): Copied from original Locale::dateTimeFormatWithSeconds().
(WebCore):
(WebCore::LocaleWin::dateTimeFormatWithoutSeconds): Copied from original Locale::dateTimeFormatWithoutSeconds().
* platform/text/win/LocaleWin.h:
(LocaleWin): Add m_dateTimeFormatWithSeconds and m_dateTimeFormatWithoutSeconds.

LayoutTests:

* fast/forms/datetime/datetime-appearance-l10n-expected.txt: Added.
* fast/forms/datetime/datetime-appearance-l10n.html: Added. We can confirm vi-vn have time-date ordering.
* platform/chromium-mac/fast/forms/datetime/datetime-appearance-l10n-expected.png: Added.
* platform/chromium/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135263 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/datetime/datetime-appearance-l10n-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/datetime/datetime-appearance-l10n.html [new file with mode: 0644]
LayoutTests/platform/chromium-mac/fast/forms/datetime/datetime-appearance-l10n-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/text/LocaleICU.cpp
Source/WebCore/platform/text/LocaleICU.h
Source/WebCore/platform/text/LocaleNone.cpp
Source/WebCore/platform/text/PlatformLocale.cpp
Source/WebCore/platform/text/PlatformLocale.h
Source/WebCore/platform/text/mac/LocaleMac.h
Source/WebCore/platform/text/mac/LocaleMac.mm
Source/WebCore/platform/text/win/LocaleWin.cpp
Source/WebCore/platform/text/win/LocaleWin.h