Changeset 130024 in webkit


Ignore:
Timestamp:
Oct 1, 2012 3:23:21 AM (12 years ago)
Author:
yosin@chromium.org
Message:

[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.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130023 r130024  
     12012-10-01  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] Multiple fields week input UI
     4        https://bugs.webkit.org/show_bug.cgi?id=97877
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch adds Chromium port specific expectations for "week" input
     9        type tests for multiple fields week input UI.
     10
     11        Note: This patch affects ports which enable both ENABLE_INPUT_TYPE_WEEK
     12        and ENABLE_INPUT_MULTIPLE_FIELDS_UI.
     13
     14        * platform/chromium/fast/forms/week/week-input-visible-string-expected.txt: Added. Multiple fields week input UI doesn't have selection.
     15        * 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.
     16
    1172012-10-01  Andrey Kosyakov  <caseq@chromium.org>
    218
  • trunk/Source/WebCore/ChangeLog

    r130021 r130024  
     12012-10-01  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] Multiple fields week input UI
     4        https://bugs.webkit.org/show_bug.cgi?id=97877
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch introduces multiple fields "week" input UI in DRT. We'll
     9        enable this feature once we add tests.
     10
     11        Note: This patch affects ports which enable both ENABLE_INPUT_TYPE_WEEK
     12        and ENABLE_INPUT_MULTIPLE_FIELDS_UI.
     13
     14        No new tests. To reduce size of this patch, other patches add tests
     15        for multiple fields week input UI.
     16
     17        Note: Actual outputs of two tests
     18          - fast/forms/week/week-input-visible-string.html
     19          - fast/forms/week/week-stepup-stepdown-from-renderer.html
     20        are different.
     21
     22        * css/thml.css:
     23        (input::-webkit-datetime-edit-week-field): Added for field appearance.
     24        (input::-webkit-datetime-edit-week-field:focus): Added to remove focus ring.
     25        * html/WeekInputType.cpp:
     26        (WebCore::WeekInputType::formatDateTimeFieldsState): Added to format numeric value to string value as specified in HTML5 specification.
     27        (WebCore::WeekInputType::setupLayoutParameters):  Added to set layout of multiple fields.
     28        * html/WeekInputType.h: Changed to include BaseMultipleFieldsDateAndTimeInputType.h and introduce BaseWeekInputType typedef.
     29        (WebCore::WeekInputType::WeekInputType): Changed base class name to BaseWeekInputType.
     30        (WeekInputType): Changed to add declarations for formatDateTimeFieldsState() and setupLayoutParameters().
     31        * html/shadow/DateTimeEditElement.cpp:
     32        (WebCore::DateTimeEditBuilder::visitField): Changed to support week field.
     33
    1342012-10-01  Pavel Feldman  <pfeldman@chromium.org>
    235
  • trunk/Source/WebCore/css/html.css

    r129867 r130024  
    479479#if defined(ENABLE_INPUT_MULTIPLE_FIELDS_UI) && ENABLE_INPUT_MULTIPLE_FIELDS_UI
    480480input[type="month"],
    481 input[type="time"] {
     481input[type="time"],
     482input[type="week"] {
    482483    font-family: monospace;
    483484}
     
    535536
    536537input::-webkit-datetime-edit-second-field {
     538    -webkit-user-modify: read-only !important;
     539    display: inline-block;
     540    border: none;
     541    text-align: center;
     542    padding: 0.15em;
     543}
     544
     545input::-webkit-datetime-edit-week-field {
    537546    -webkit-user-modify: read-only !important;
    538547    display: inline-block;
     
    557566input::-webkit-datetime-edit-month-field:focus,
    558567input::-webkit-datetime-edit-second-field:focus,
     568input::-webkit-datetime-edit-week-field:focus,
    559569input::-webkit-datetime-edit-year-field:focus {
    560570  background-color: highlight;
  • trunk/Source/WebCore/html/WeekInputType.cpp

    r128149 r130024  
    3939
    4040#if ENABLE(INPUT_TYPE_WEEK)
     41
     42#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
     43#include "DateTimeFieldsState.h"
     44#include "LocalizedStrings.h"
     45#include <wtf/text/WTFString.h>
     46#endif
    4147
    4248namespace WebCore {
     
    9298}
    9399
     100
     101#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
     102String WeekInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
     103{
     104    if (!dateTimeFieldsState.hasYear() || !dateTimeFieldsState.hasWeekOfYear())
     105        return emptyString();
     106    return String::format("%04u-W%02u", dateTimeFieldsState.year(), dateTimeFieldsState.weekOfYear());
     107}
     108
     109void WeekInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents&) const
     110{
     111    layoutParameters.dateTimeFormat = weekFormatInLDML();
     112    layoutParameters.fallbackDateTimeFormat = "'Week' WW-yyyy";
     113    layoutParameters.placeholderForYear = "----";
     114}
     115#endif
     116
    94117} // namespace WebCore
    95118
  • trunk/Source/WebCore/html/WeekInputType.h

    r117738 r130024  
    3232#define WeekInputType_h
    3333
    34 #include "BaseDateAndTimeInputType.h"
     34#include "BaseMultipleFieldsDateAndTimeInputType.h"
    3535
    3636#if ENABLE(INPUT_TYPE_WEEK)
     
    3838namespace WebCore {
    3939
    40 class WeekInputType : public BaseDateAndTimeInputType {
     40#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
     41typedef BaseMultipleFieldsDateAndTimeInputType BaseWeekInputType;
     42#else
     43typedef BaseDateAndTimeInputType BaseWeekInputType;
     44#endif
     45
     46class WeekInputType : public BaseWeekInputType {
    4147public:
    4248    static PassOwnPtr<InputType> create(HTMLInputElement*);
    4349
    4450private:
    45     WeekInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     51    WeekInputType(HTMLInputElement* element) : BaseWeekInputType(element) { }
    4652    virtual const AtomicString& formControlType() const OVERRIDE;
    4753    virtual DateComponents::Type dateType() const OVERRIDE;
     
    5056    virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE;
    5157    virtual bool isWeekField() const OVERRIDE;
     58
     59#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
     60    // BaseMultipleFieldsDateAndTimeInputType functions
     61    virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL;
     62    virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL;
     63#endif
    5264};
    5365
  • trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp

    r129867 r130024  
    154154    }
    155155
     156    case DateTimeFormat::FieldTypeWeekOfYear:
     157        m_editElement.addField(DateTimeWeekFieldElement::create(document, m_editElement));
     158        return;
     159
    156160    case DateTimeFormat::FieldTypeYear:
    157161        m_editElement.addField(DateTimeYearFieldElement::create(document, m_editElement, m_placeholderForYear));
Note: See TracChangeset for help on using the changeset viewer.