[Forms] Multiple fields week input UI
https://bugs.webkit.org/show_bug.cgi?id=97877

Reviewed by Kent Tamura.

Source/WebCore:

This patch introduces multiple fields "week" input UI in DRT. We'll
enable this feature once we add tests.

Note: This patch affects ports which enable both ENABLE_INPUT_TYPE_WEEK
and ENABLE_INPUT_MULTIPLE_FIELDS_UI.

No new tests. To reduce size of this patch, other patches add tests
for multiple fields week input UI.

Note: Actual outputs of two tests
  - fast/forms/week/week-input-visible-string.html
  - fast/forms/week/week-stepup-stepdown-from-renderer.html
are different.

* css/thml.css:
(input::-webkit-datetime-edit-week-field): Added for field appearance.
(input::-webkit-datetime-edit-week-field:focus): Added to remove focus ring.
* html/WeekInputType.cpp:
(WebCore::WeekInputType::formatDateTimeFieldsState): Added to format numeric value to string value as specified in HTML5 specification.
(WebCore::WeekInputType::setupLayoutParameters):  Added to set layout of multiple fields.
* html/WeekInputType.h: Changed to include BaseMultipleFieldsDateAndTimeInputType.h and introduce BaseWeekInputType typedef.
(WebCore::WeekInputType::WeekInputType): Changed base class name to BaseWeekInputType.
(WeekInputType): Changed to add declarations for formatDateTimeFieldsState() and setupLayoutParameters().
* html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditBuilder::visitField): Changed to support week field.

LayoutTests:

This patch adds Chromium port specific expectations for "week" input
type tests for multiple fields week input UI.

Note: This patch affects ports which enable both ENABLE_INPUT_TYPE_WEEK
and ENABLE_INPUT_MULTIPLE_FIELDS_UI.

* platform/chromium/fast/forms/week/week-input-visible-string-expected.txt: Added. Multiple fields week input UI doesn't have selection.
* platform/chromium/fast/forms/week/week-stepup-stepdown-from-renderer-expected.txt: Added. On multiple fields week input UI, step down/up decrement/increment a field rather than whole value.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk/LayoutTests@130024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index a0aca49..d1820db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2012-10-01  Yoshifumi Inoue  <yosin@chromium.org>
+
+        [Forms] Multiple fields week input UI
+        https://bugs.webkit.org/show_bug.cgi?id=97877
+
+        Reviewed by Kent Tamura.
+
+        This patch adds Chromium port specific expectations for "week" input
+        type tests for multiple fields week input UI.
+
+        Note: This patch affects ports which enable both ENABLE_INPUT_TYPE_WEEK
+        and ENABLE_INPUT_MULTIPLE_FIELDS_UI.
+
+        * platform/chromium/fast/forms/week/week-input-visible-string-expected.txt: Added. Multiple fields week input UI doesn't have selection.
+        * platform/chromium/fast/forms/week/week-stepup-stepdown-from-renderer-expected.txt: Added. On multiple fields week input UI, step down/up decrement/increment a field rather than whole value.
+
 2012-10-01  Andrey Kosyakov  <caseq@chromium.org>
 
         Unreviewed gardening -- removed TestExpectation entries for passing tests.
diff --git a/platform/chromium/fast/forms/week/week-input-visible-string-expected.txt b/platform/chromium/fast/forms/week/week-input-visible-string-expected.txt
new file mode 100644
index 0000000..a2ce7bd
--- /dev/null
+++ b/platform/chromium/fast/forms/week/week-input-visible-string-expected.txt
@@ -0,0 +1,9 @@
+The user-visible values of week input fields should be localized if the platform has a LocalizedDate implementation. Otherwise, they should be in the HTML5 formats.
+
+week: value='2011-W17' visible='The user-visible values of week input fields should be localized if the platform has a LocalizedDate implementation. Otherwise, they should be in the HTML5 formats.
+
+'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/platform/chromium/fast/forms/week/week-stepup-stepdown-from-renderer-expected.txt b/platform/chromium/fast/forms/week/week-stepup-stepdown-from-renderer-expected.txt
new file mode 100644
index 0000000..616743d
--- /dev/null
+++ b/platform/chromium/fast/forms/week/week-stepup-stepdown-from-renderer-expected.txt
@@ -0,0 +1,29 @@
+Check stepping-up and -down for  from renderer. No cases of empty initial values for type=week.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Function arguments are (value, step, {min or max}, [stepCount]).
+Normal cases
+FAIL stepUp("2010-W02", null, null) should be 2010-W03. Was 2010-W02.
+FAIL stepDown("2010-W02", null, null) should be 2010-W01. Was 2010-W02.
+FAIL stepUp("2010-W02", null, null, 10) should be 2010-W12. Was 2010-W02.
+FAIL stepDown("2010-W02", null, null, 11) should be 2009-W44. Was 2010-W02.
+FAIL stepUp("1970-W01", "4", null, 2) should be 1970-W09. Was 1970-W01.
+FAIL stepDown("1970-W01", "4", null, 3) should be 1969-W41. Was 1970-W01.
+Step=any
+FAIL stepUp("2010-W02", "any", null) should be 2010-W03. Was 2010-W02.
+FAIL stepDown("2010-W02", "any", null) should be 2010-W01. Was 2010-W02.
+Overflow/underflow
+FAIL stepUp("2010-W02", "3.40282346e+38", null) should be 275760-W37. Was 2010-W02.
+FAIL stepDown("2010-W02", "3.40282346e+38", null) should be 1970-W01. Was 2010-W02.
+PASS stepUp("2010-W02", "1", "2010-W02") is "2010-W02"
+PASS stepDown("2010-W02", "1", "2010-W02") is "2010-W02"
+stepDown()/stepUp() for stepMismatch values
+FAIL stepDown("2010-W02", "2", "2009-W52") should be 2010-W01. Was 2010-W02.
+FAIL stepUp("1970-W02", "4", "") should be 1970-W05. Was 1970-W02.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+