Show the format indicator in a date field
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 05:57:33 +0000 (05:57 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 05:57:33 +0000 (05:57 +0000)
commit8392a0a676e0de5caef7af26c7a332f57b3a5cca
tree3c9ad3435ebda5eebb93761914f8477edd89561e
parent5ee68e3489f0f966672eea0eefd7068c22be3b3a
Show the format indicator in a date field
https://bugs.webkit.org/show_bug.cgi?id=83872

Reviewed by Hajime Morita.

Source/WebCore:

Enable the fixed placeholder feature for the date type, and show
the editable date format as the fixed placeholder.
The format string is created by the following steps.
1. Obtain a pattern string from ICU
  http://icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details
2. Replace a sequence of 'y', 'Y', 'M', or 'd' in the pattern with
  a natural language string such as "year", "month", or "day".

Test: fast/forms/date/date-fixed-placeholder.html

* html/DateInputType.cpp:
(WebCore::DateInputType::supportsPlaceholder): Added. Returns true.
(WebCore::DateInputType::usesFixedPlaceholder): Added. Returns true.
(WebCore::DateInputType::fixedPlaceholder):
Added. Calls localizedDateFormatText() provided by LocalizedDate.h.
* html/DateInputType.h:
(DateInputType): Add declarations of new override functions.
* platform/LocalizedStrings.h:
(WebCore): Add dateFormat{Year,Month,DayInMonth}Text()
* platform/text/ICULocale.cpp:
(WebCore::isICUYearSymbol): A function to improve redability.
(WebCore::isICUMonthSymbol): ditto.
(WebCore::isICUDayInMonthSymbol): ditto.
(WebCore::localizeFormat): Step 2 of the above description.
(WebCore::ICULocale::initializeLocalizedDateFormatText):
Step 1 of the above description.
(WebCore::ICULocale::localizedDateFormatText):
* platform/text/ICULocale.h:
(ICULocale): Add new functions and a data member.
* platform/text/LocalizedDate.h:
(WebCore): Add localizedDateFormatText().
* platform/text/LocalizedDateICU.cpp:
(WebCore::localizedDateFormatText):
Just call ICULocale::localizedDateFormatText().

Source/WebKit/chromium:

* src/LocalizedStrings.cpp:
(WebCore::dateFormatYearText): Added a stub.
(WebCore::dateFormatMonthText): ditto.
(WebCore::dateFormatDayInMonthText): ditto.

LayoutTests:

* fast/forms/date/date-fixed-placeholder-expected.txt: Added.
* fast/forms/date/date-fixed-placeholder.html: Added.
* platform/chromium/test_expectations.txt:
Mark date-appearance.html FAIL because of render dump change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/date/date-fixed-placeholder-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/date/date-fixed-placeholder.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/html/DateInputType.cpp
Source/WebCore/html/DateInputType.h
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/platform/text/ICULocale.cpp
Source/WebCore/platform/text/ICULocale.h
Source/WebCore/platform/text/LocalizedDate.h
Source/WebCore/platform/text/LocalizedDateICU.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/LocalizedStrings.cpp