Commit 4e5f0476 authored by yosin@chromium.org's avatar yosin@chromium.org
Browse files

[Forms] Multiple fields datetime/datetime-local input UI

https://bugs.webkit.org/show_bug.cgi?id=97997

Reviewed by Kent Tamura.

Source/WebCore:

This patch introduces multiple fields "datetime" and "datetime-local"
input UI in DRT. We'll enable these features once we add tests.

No new tests. To reduce size of this patch, other patches add tests
for multiple fields datetime/datetime-local input UI.

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

* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore):
* css/html.css:
(input::-webkit-datetime-edit-day-field): Added for field appearance.
(input::-webkit-datetime-edit-day-field:focus):  Added to remove focus ring.
* html/DateTimeInputType.cpp:
(WebCore::DateTimeInputType::formatDateTimeFieldsState): Added to format numeric value to string value as specified in HTML5 specification.
(WebCore::DateTimeInputType::setupLayoutParameters): Added to set layout of multiple fields.
* html/DateTimeInputType.h: Changed to include BaseMultipleFieldsDateAndTimeInputType.h and introduce BaseDateTimeInputType typedef.
(WebCore::DateTimeInputType::DateTimeInputType): Changed base class name to BaseDateTimeInputType.
(DateTimeInputType): Changed to add declarations for formatDateTimeFieldsState() and setupLayoutParameters().
* html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::formatDateTimeFieldsState): Added to format numeric value to string value as specified in HTML5 specification.
(WebCore::DateTimeLocalInputType::setupLayoutParameters):  Added to set layout of multiple fields.
* html/DateTimeLocalInputType.h: Changed to include BaseMultipleFieldsDateAndTimeInputType.h and introduce BaseDateTimeLocalInputType typedef.
(WebCore::DateTimeLocalInputType::DateTimeLocalInputType): Changed base class name to BaseDateTimeLocalInputType.
(DateTimeLocalInputType): Changed to add declarations for formatDateTimeFieldsState() and setupLayoutParameters().
* html/shadow/DateTimeEditElement.cpp:
(DateTimeEditBuilder): Changed to add member variable m_placeholderForDay.
(WebCore::DateTimeEditBuilder::DateTimeEditBuilder): Changed to initialize m_placeholderForDay.
(WebCore::DateTimeEditBuilder::visitField): Changed to support week field.
* html/shadow/DateTimeEditElement.h:
(LayoutParameters): Changed to add placeholderForDay member variable.

LayoutTests:

This patch adds Chromium port specific expectations for "datetime" and
"datetime-local" input type tests for multiple fields datetime input UI.

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 55a7711e
2012-10-02 Yoshifumi Inoue <yosin@chromium.org>
[Forms] Multiple fields datetime/datetime-local input UI
https://bugs.webkit.org/show_bug.cgi?id=97997
Reviewed by Kent Tamura.
This patch adds Chromium port specific expectations for "datetime" and
"datetime-local" input type tests for multiple fields datetime input UI.
* platform/chromium/fast/forms/datetime/datetime-input-visible-string-expected.txt: Added. Multiple fields datetime input UI doesn't have selection.
* platform/chromium/fast/forms/datetime/datetime-stepup-stepdown-from-renderer-expected.txt: Added. On multiple fields datetime input UI, step down/up decrement/increment a field rather than whole value.
* platform/chromium/fast/forms/datetimelocal/datetimelocal-input-visible-string-expected.txt: Added. Multiple fields datetime-local input UI doesn't have selection.
* platform/chromium/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-from-renderer-expected.txt: Added. On multiple fields datetime-local input UI, step down/up decrement/increment a field rather than whole value.
2012-10-02 Zan Dobersek <zandobersek@gmail.com>
 
Unreviewed GTK gardening.
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.
datetime: value='2011-04-27T01:56:20.391Z' 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
Check stepping-up and -down for datetime input fields from renderer. No cases of empty initial values.
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-02-10T20:13Z", null, null) should be 2010-02-10T20:14Z. Was 2010-02-10T20:13Z.
FAIL stepDown("2010-02-10T20:13Z", null, null) should be 2010-02-10T20:12Z. Was 2010-02-10T20:13Z.
FAIL stepUp("2010-02-10T20:13Z", null, null, 10) should be 2010-02-10T20:23Z. Was 2010-02-10T20:13Z.
FAIL stepDown("2010-02-10T20:13Z", null, null, 11) should be 2010-02-10T20:02Z. Was 2010-02-10T20:13Z.
FAIL stepUp("1970-01-01T20:13Z", "4", null, 2) should be 1970-01-01T20:13:08Z. Was 1970-01-01T20:13Z.
FAIL stepDown("1970-01-01T20:13Z", "4", null, 3) should be 1970-01-01T20:12:48Z. Was 1970-01-01T20:13Z.
Step=any
FAIL stepUp("2010-02-10T20:13Z", "any", null) should be 2010-02-10T20:14Z. Was 2010-02-10T20:13Z.
FAIL stepDown("2010-02-10T20:13Z", "any", null) should be 2010-02-10T20:12Z. Was 2010-02-10T20:13Z.
Overflow/underflow
FAIL stepUp("2010-02-10T20:13Z", "3.40282346e+38", null) should be 275760-09-13T00:00:00Z. Was 2010-02-10T20:13Z.
FAIL stepDown("2010-02-10T20:13Z", "3.40282346e+38", null) should be 1970-01-01T00:00:00Z. Was 2010-02-10T20:13Z.
PASS stepUp("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") is "2010-02-10T20:13Z"
PASS stepDown("2010-02-10T20:13Z", "1", "2010-02-10T20:13Z") is "2010-02-10T20:13Z"
stepDown()/stepUp() for stepMismatch values
FAIL stepDown("2010-02-10T20:13Z", "3", "2010-02-10T20:12:56Z") should be 2010-02-10T20:12:59Z. Was 2010-02-10T20:13Z.
FAIL stepUp("1970-01-01T00:13Z", "7", "") should be 1970-01-01T00:13:04Z. Was 1970-01-01T00:13Z.
PASS successfullyParsed is true
TEST COMPLETE
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.
datetime-local: value='2011-04-27T01:56:20.391' 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
Check stepping-up and -down for datetime-local input fields from renderer. No cases of empty initial values.
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-02-10T20:13", null, null) should be 2010-02-10T20:14. Was 2010-02-10T20:13.
FAIL stepDown("2010-02-10T20:13", null, null) should be 2010-02-10T20:12. Was 2010-02-10T20:13.
FAIL stepUp("2010-02-10T20:13", null, null, 10) should be 2010-02-10T20:23. Was 2010-02-10T20:13.
FAIL stepDown("2010-02-10T20:13", null, null, 11) should be 2010-02-10T20:02. Was 2010-02-10T20:13.
FAIL stepUp("1970-01-01T20:13", "4", null, 2) should be 1970-01-01T20:13:08. Was 1970-01-01T20:13.
FAIL stepDown("1970-01-01T20:13", "4", null, 3) should be 1970-01-01T20:12:48. Was 1970-01-01T20:13.
Step=any
FAIL stepUp("2010-02-10T20:13", "any", null) should be 2010-02-10T20:14. Was 2010-02-10T20:13.
FAIL stepDown("2010-02-10T20:13", "any", null) should be 2010-02-10T20:12. Was 2010-02-10T20:13.
Overflow/underflow
FAIL stepUp("2010-02-10T20:13", "3.40282346e+38", null) should be 275760-09-13T00:00:00. Was 2010-02-10T20:13.
FAIL stepDown("2010-02-10T20:13", "3.40282346e+38", null) should be 1970-01-01T00:00:00. Was 2010-02-10T20:13.
PASS stepUp("2010-02-10T20:13", "1", "2010-02-10T20:13") is "2010-02-10T20:13"
PASS stepDown("2010-02-10T20:13", "1", "2010-02-10T20:13") is "2010-02-10T20:13"
stepDown()/stepUp() for stepMismatch values
FAIL stepDown("2010-02-10T20:13", "3", "2010-02-10T20:12:56") should be 2010-02-10T20:12:59. Was 2010-02-10T20:13.
FAIL stepUp("1970-01-01T00:13", "7", "") should be 1970-01-01T00:13:04. Was 1970-01-01T00:13.
PASS successfullyParsed is true
TEST COMPLETE
2012-10-02 Yoshifumi Inoue <yosin@chromium.org>
[Forms] Multiple fields datetime/datetime-local input UI
https://bugs.webkit.org/show_bug.cgi?id=97997
Reviewed by Kent Tamura.
This patch introduces multiple fields "datetime" and "datetime-local"
input UI in DRT. We'll enable these features once we add tests.
No new tests. To reduce size of this patch, other patches add tests
for multiple fields datetime/datetime-local input UI.
Note: Actual outputs of four tests
- fast/forms/datetime/datetime-input-visible-string.html
- fast/forms/datetime/datetime-stepup-stepdown-from-renderer.html
- fast/forms/datetimelocal/datetimelocal-input-visible-string.html
- fast/forms/datetimelocal/datetimelocal-stepup-stepdown-from-renderer.html
are different.
* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore):
* css/html.css:
(input::-webkit-datetime-edit-day-field): Added for field appearance.
(input::-webkit-datetime-edit-day-field:focus): Added to remove focus ring.
* html/DateTimeInputType.cpp:
(WebCore::DateTimeInputType::formatDateTimeFieldsState): Added to format numeric value to string value as specified in HTML5 specification.
(WebCore::DateTimeInputType::setupLayoutParameters): Added to set layout of multiple fields.
* html/DateTimeInputType.h: Changed to include BaseMultipleFieldsDateAndTimeInputType.h and introduce BaseDateTimeInputType typedef.
(WebCore::DateTimeInputType::DateTimeInputType): Changed base class name to BaseDateTimeInputType.
(DateTimeInputType): Changed to add declarations for formatDateTimeFieldsState() and setupLayoutParameters().
* html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::formatDateTimeFieldsState): Added to format numeric value to string value as specified in HTML5 specification.
(WebCore::DateTimeLocalInputType::setupLayoutParameters): Added to set layout of multiple fields.
* html/DateTimeLocalInputType.h: Changed to include BaseMultipleFieldsDateAndTimeInputType.h and introduce BaseDateTimeLocalInputType typedef.
(WebCore::DateTimeLocalInputType::DateTimeLocalInputType): Changed base class name to BaseDateTimeLocalInputType.
(DateTimeLocalInputType): Changed to add declarations for formatDateTimeFieldsState() and setupLayoutParameters().
* html/shadow/DateTimeEditElement.cpp:
(DateTimeEditBuilder): Changed to add member variable m_placeholderForDay.
(WebCore::DateTimeEditBuilder::DateTimeEditBuilder): Changed to initialize m_placeholderForDay.
(WebCore::DateTimeEditBuilder::visitField): Changed to support week field.
* html/shadow/DateTimeEditElement.h:
(LayoutParameters): Changed to add placeholderForDay member variable.
2012-10-02 Vsevolod Vlasov <vsevik@chromium.org>
 
Web Inspector: [Regression] Breakpoints restored from storage are not set in debugger.
......@@ -477,6 +477,8 @@ datalist {
#endif
#if defined(ENABLE_INPUT_MULTIPLE_FIELDS_UI) && ENABLE_INPUT_MULTIPLE_FIELDS_UI
input[type="datetime"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="week"] {
......@@ -497,6 +499,14 @@ input::-webkit-datetime-edit-ampm-field {
text-align: center;
}
input::-webkit-datetime-edit-day-field {
-webkit-user-modify: read-only !important;
display: inline-block;
border: none;
text-align: center;
padding: 0.15em;
}
input::-webkit-datetime-edit-hour-field {
-webkit-user-modify: read-only !important;
display: inline-block;
......@@ -560,6 +570,7 @@ input::-webkit-datetime-edit-year-field {
/* Remove focus ring from fields and use highlight color */
input::-webkit-datetime-edit-ampm-field:focus,
input::-webkit-datetime-edit-day-field:focus,
input::-webkit-datetime-edit-hour-field:focus,
input::-webkit-datetime-edit-millisecond-field:focus,
input::-webkit-datetime-edit-minute-field:focus,
......
......@@ -40,6 +40,14 @@
#if ENABLE(INPUT_TYPE_DATETIME)
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
#include "DateTimeFieldsState.h"
#include "LocalizedStrings.h"
#include "Localizer.h"
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
#endif
namespace WebCore {
using namespace HTMLNames;
......@@ -97,6 +105,66 @@ bool DateTimeInputType::isDateTimeField() const
return true;
}
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
// FIXME: It is better to share code for DateTimeInputType::formatDateTimeFieldsState()
// and DateTimeInputLocalType::formatDateTimeFieldsState().
String DateTimeInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
{
if (!dateTimeFieldsState.hasDayOfMonth() || !dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear()
|| !dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM())
return emptyString();
if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond()) {
return String::format("%04u-%02u-%02uT%02u:%02u:%02u.%03uZ",
dateTimeFieldsState.year(),
dateTimeFieldsState.month() + 1,
dateTimeFieldsState.dayOfMonth(),
dateTimeFieldsState.hour23(),
dateTimeFieldsState.minute(),
dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0,
dateTimeFieldsState.millisecond());
}
if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second()) {
return String::format("%04u-%02u-%02uT%02u:%02u:%02uZ",
dateTimeFieldsState.year(),
dateTimeFieldsState.month() + 1,
dateTimeFieldsState.dayOfMonth(),
dateTimeFieldsState.hour23(),
dateTimeFieldsState.minute(),
dateTimeFieldsState.second());
}
return String::format("%04u-%02u-%02uT%02u:%02uZ",
dateTimeFieldsState.year(),
dateTimeFieldsState.month() + 1,
dateTimeFieldsState.dayOfMonth(),
dateTimeFieldsState.hour23(),
dateTimeFieldsState.minute());
}
void DateTimeInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const
{
// FIXME: It is better to have Localizer::dateTimeFormat() and use it
// here rather than constructing from dateFormat() and timeFormat().
StringBuilder builder;
builder.append(layoutParameters.localizer.dateFormat());
builder.append(' ');
if (date.second() || layoutParameters.shouldHaveSecondField()) {
builder.append(layoutParameters.localizer.timeFormat());
layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm:ss";
} else {
builder.append(layoutParameters.localizer.shortTimeFormat());
layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm";
}
layoutParameters.dateTimeFormat = builder.toString();
layoutParameters.placeholderForDay = placeholderForDayOfMonthField();
layoutParameters.placeholderForMonth = placeholderForMonthField();
layoutParameters.placeholderForYear = placeholderForYearField();
}
#endif
} // namespace WebCore
#endif
......@@ -34,15 +34,22 @@
#include "BaseDateAndTimeInputType.h"
#if ENABLE(INPUT_TYPE_DATETIME)
#include "BaseMultipleFieldsDateAndTimeInputType.h"
namespace WebCore {
class DateTimeInputType : public BaseDateAndTimeInputType {
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
typedef BaseMultipleFieldsDateAndTimeInputType BaseDateTimeInputType;
#else
typedef BaseDateAndTimeInputType BaseDateTimeInputType;
#endif
class DateTimeInputType : public BaseDateTimeInputType {
public:
static PassOwnPtr<InputType> create(HTMLInputElement*);
private:
DateTimeInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
DateTimeInputType(HTMLInputElement* element) : BaseDateTimeInputType(element) { }
virtual const AtomicString& formControlType() const OVERRIDE;
virtual DateComponents::Type dateType() const OVERRIDE;
virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE;
......@@ -50,6 +57,12 @@ private:
virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE;
virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE;
virtual bool isDateTimeField() const OVERRIDE;
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
// BaseMultipleFieldsDateAndTimeInputType functions
virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL;
virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL;
#endif
};
} // namespace WebCore
......
......@@ -39,6 +39,14 @@
#if ENABLE(INPUT_TYPE_DATETIMELOCAL)
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
#include "DateTimeFieldsState.h"
#include "LocalizedStrings.h"
#include "Localizer.h"
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
#endif
namespace WebCore {
using namespace HTMLNames;
......@@ -103,6 +111,66 @@ bool DateTimeLocalInputType::isDateTimeLocalField() const
return true;
}
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
// FIXME: It is better to share code for DateTimeInputType::formatDateTimeFieldsState()
// and DateTimeInputLocalType::formatDateTimeFieldsState().
String DateTimeLocalInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
{
if (!dateTimeFieldsState.hasDayOfMonth() || !dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear()
|| !dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM())
return emptyString();
if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond()) {
return String::format("%04u-%02u-%02uT%02u:%02u:%02u.%03u",
dateTimeFieldsState.year(),
dateTimeFieldsState.month() + 1,
dateTimeFieldsState.dayOfMonth(),
dateTimeFieldsState.hour23(),
dateTimeFieldsState.minute(),
dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0,
dateTimeFieldsState.millisecond());
}
if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second()) {
return String::format("%04u-%02u-%02uT%02u:%02u:%02u",
dateTimeFieldsState.year(),
dateTimeFieldsState.month() + 1,
dateTimeFieldsState.dayOfMonth(),
dateTimeFieldsState.hour23(),
dateTimeFieldsState.minute(),
dateTimeFieldsState.second());
}
return String::format("%04u-%02u-%02uT%02u:%02u",
dateTimeFieldsState.year(),
dateTimeFieldsState.month() + 1,
dateTimeFieldsState.dayOfMonth(),
dateTimeFieldsState.hour23(),
dateTimeFieldsState.minute());
}
void DateTimeLocalInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const
{
// FIXME: It is better to have Localizer::dateTimeFormat() and use it
// here rather than constructing from dateFormat() and timeFormat().
StringBuilder builder;
builder.append(layoutParameters.localizer.dateFormat());
builder.append(' ');
if (date.second() || layoutParameters.shouldHaveSecondField()) {
builder.append(layoutParameters.localizer.timeFormat());
layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm:ss";
} else {
builder.append(layoutParameters.localizer.shortTimeFormat());
layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm";
}
layoutParameters.dateTimeFormat = builder.toString();
layoutParameters.placeholderForDay = placeholderForDayOfMonthField();
layoutParameters.placeholderForMonth = placeholderForMonthField();
layoutParameters.placeholderForYear = placeholderForYearField();
}
#endif
} // namespace WebCore
#endif
......@@ -31,18 +31,23 @@
#ifndef DateTimeLocalInputType_h
#define DateTimeLocalInputType_h
#include "BaseDateAndTimeInputType.h"
#if ENABLE(INPUT_TYPE_DATETIMELOCAL)
#include "BaseMultipleFieldsDateAndTimeInputType.h"
namespace WebCore {
class DateTimeLocalInputType : public BaseDateAndTimeInputType {
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
typedef BaseMultipleFieldsDateAndTimeInputType BaseDateTimeLocalInputType;
#else
typedef BaseDateAndTimeInputType BaseDateTimeLocalInputType;
#endif
class DateTimeLocalInputType : public BaseDateTimeLocalInputType {
public:
static PassOwnPtr<InputType> create(HTMLInputElement*);
private:
DateTimeLocalInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
DateTimeLocalInputType(HTMLInputElement* element) : BaseDateTimeLocalInputType(element) { }
virtual const AtomicString& formControlType() const OVERRIDE;
virtual DateComponents::Type dateType() const OVERRIDE;
virtual double valueAsDate() const OVERRIDE;
......@@ -51,6 +56,12 @@ private:
virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE;
virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE;
virtual bool isDateTimeLocalField() const OVERRIDE;
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
// BaseMultipleFieldsDateAndTimeInputType functions
virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL;
virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL;
#endif
};
} // namespace WebCore
......
......@@ -67,6 +67,7 @@ private:
const DateComponents m_dateValue;
const StepRange m_stepRange;
Localizer& m_localizer;
const String m_placeholderForDay;
const String m_placeholderForMonth;
const String m_placeholderForYear;
};
......@@ -76,6 +77,7 @@ DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& elemnt, const Date
, m_dateValue(dateValue)
, m_stepRange(layoutParameters.stepRange)
, m_localizer(layoutParameters.localizer)
, m_placeholderForDay(layoutParameters.placeholderForDay)
, m_placeholderForMonth(layoutParameters.placeholderForMonth)
, m_placeholderForYear(layoutParameters.placeholderForYear)
{
......@@ -99,6 +101,10 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int)
Document* const document = m_editElement.document();
switch (fieldType) {
case DateTimeFormat::FieldTypeDayOfMonth:
m_editElement.addField(DateTimeDayFieldElement::create(document, m_editElement, m_placeholderForDay));
return;
case DateTimeFormat::FieldTypeHour11:
m_editElement.addField(DateTimeHourFieldElement::create(document, m_editElement, 0, 11));
return;
......
......@@ -66,6 +66,7 @@ public:
String fallbackDateTimeFormat;
Localizer& localizer;
const StepRange stepRange;
String placeholderForDay;
String placeholderForMonth;
String placeholderForYear;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment