Changeset 53964 in webkit


Ignore:
Timestamp:
Jan 27, 2010 5:24:10 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-27 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Adler.

Add valueAsNumber support for type=datetime-local.
https://bugs.webkit.org/show_bug.cgi?id=34200

The test data is equivalent to input-valueasnumber-datetime.html.
The expectation contains two FAIL lines because they check
unimplemented features.

  • fast/forms/input-valueasnumber-datetimelocal-expected.txt: Added.
  • fast/forms/input-valueasnumber-datetimelocal.html: Added.
  • fast/forms/script-tests/input-valueasnumber-datetimelocal.js: Added.

2010-01-27 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Adler.

Add valueAsNumber support for type=datetime-local.
https://bugs.webkit.org/show_bug.cgi?id=34200

Implement necessary methods of ISODateTime, and call them from
HTMLInputElement.

Test: fast/forms/input-valueasnumber-datetimelocal.html

  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::valueAsNumber): (WebCore::HTMLInputElement::setValueAsNumber):
  • html/ISODateTime.cpp: (WebCore::ISODateTime::setMillisecondsSinceEpochForDateTimeLocal): Implemented. Just call setMillisecondsSinceEpochForDateTime(). (WebCore::ISODateTime::millisecondsSinceEpochForTime): Accept to be called for m_type=DateTimeLocal. (WebCore::ISODateTime::toString): Add DateTimeLocal support.
  • html/ISODateTime.h: Declare new methods.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53959 r53964  
     12010-01-27  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add valueAsNumber support for type=datetime-local.
     6        https://bugs.webkit.org/show_bug.cgi?id=34200
     7
     8        The test data is equivalent to input-valueasnumber-datetime.html.
     9        The expectation contains two FAIL lines because they check
     10        unimplemented features.
     11
     12        * fast/forms/input-valueasnumber-datetimelocal-expected.txt: Added.
     13        * fast/forms/input-valueasnumber-datetimelocal.html: Added.
     14        * fast/forms/script-tests/input-valueasnumber-datetimelocal.js: Added.
     15
    1162010-01-27  Brian Weinstein  <bweinstein@apple.com>
    217
  • trunk/WebCore/ChangeLog

    r53961 r53964  
     12010-01-27  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add valueAsNumber support for type=datetime-local.
     6        https://bugs.webkit.org/show_bug.cgi?id=34200
     7
     8        Implement necessary methods of ISODateTime, and call them from
     9        HTMLInputElement.
     10
     11        Test: fast/forms/input-valueasnumber-datetimelocal.html
     12
     13        * html/HTMLInputElement.cpp:
     14        (WebCore::HTMLInputElement::valueAsNumber):
     15        (WebCore::HTMLInputElement::setValueAsNumber):
     16        * html/ISODateTime.cpp:
     17        (WebCore::ISODateTime::setMillisecondsSinceEpochForDateTimeLocal):
     18          Implemented.  Just call setMillisecondsSinceEpochForDateTime().
     19        (WebCore::ISODateTime::millisecondsSinceEpochForTime):
     20          Accept to be called for m_type=DateTimeLocal.
     21        (WebCore::ISODateTime::toString): Add DateTimeLocal support.
     22        * html/ISODateTime.h: Declare new methods.
     23
    1242010-01-27  Steve Falkenburg  <sfalken@apple.com>
    225
  • trunk/WebCore/html/HTMLInputElement.cpp

    r53893 r53964  
    14741474    case DATE:
    14751475    case DATETIME:
     1476    case DATETIMELOCAL:
    14761477    case MONTH:
    14771478    case TIME:
     
    14931494    case CHECKBOX:
    14941495    case COLOR:
    1495     case DATETIMELOCAL: // FIXME: Unlike valueAsDate, valueAsNumber should support DATETIMELOCAL type.
    14961496    case EMAIL:
    14971497    case FILE:
     
    15271527        setValueAsDate(newValue, ec);
    15281528        return;
     1529    case DATETIMELOCAL: {
     1530        ISODateTime dateTime;
     1531        if (!dateTime.setMillisecondsSinceEpochForDateTimeLocal(newValue)) {
     1532            setValue(String());
     1533            return;
     1534        }
     1535        // FIXME: We should specify SecondFormat.
     1536        // e.g. If the step value is 60, use SecondFormat::None.
     1537        //      If the step value is 1, use SecondFormat::Second.
     1538        setValue(dateTime.toString());
     1539        return;
     1540    }
    15291541    case NUMBER:
    15301542    case RANGE:
     
    15321544        return;
    15331545
    1534     case DATETIMELOCAL: // FIXME: implement ISODateTime.toString()
    15351546    case BUTTON:
    15361547    case CHECKBOX:
  • trunk/WebCore/html/ISODateTime.cpp

    r53787 r53964  
    505505}
    506506
     507bool ISODateTime::setMillisecondsSinceEpochForDateTimeLocal(double ms)
     508{
     509    // Internal representation of DateTimeLocal is the same as DateTime except m_type.
     510    if (!setMillisecondsSinceEpochForDateTime(ms))
     511        return false;
     512    m_type = DateTimeLocal;
     513    return true;
     514}
     515
    507516bool ISODateTime::setMillisecondsSinceEpochForMonth(double ms)
    508517{
     
    572581double ISODateTime::millisecondsSinceEpochForTime() const
    573582{
    574     ASSERT(m_type == Time || m_type == DateTime);
     583    ASSERT(m_type == Time || m_type == DateTime || m_type == DateTimeLocal);
    575584    return ((m_hour * minutesPerHour + m_minute) * secondsPerMinute + m_second) * msPerSecond + m_millisecond;
    576585}
     
    627636        return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
    628637            + toStringForTime(format) + String("Z");
     638    case DateTimeLocal:
     639        return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
     640            + toStringForTime(format);
    629641    case Month:
    630642        return String::format("%04d-%02d", m_year, m_month + 1);
     
    633645    case Week:
    634646        return String::format("%04d-W%02d", m_year, m_week);
    635     case DateTimeLocal:
    636647    case Invalid:
    637648        break;
  • trunk/WebCore/html/ISODateTime.h

    r53787 r53964  
    115115    // For DateTime type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
    116116    bool setMillisecondsSinceEpochForDateTime(double ms);
     117    // For DateTimeLocal type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
     118    bool setMillisecondsSinceEpochForDateTimeLocal(double ms);
    117119    // For Month type. Updates m_year and m_month.
    118120    bool setMillisecondsSinceEpochForMonth(double ms);
Note: See TracChangeset for help on using the changeset viewer.