Changeset 51163 in webkit


Ignore:
Timestamp:
Nov 18, 2009 6:15:17 PM (14 years ago)
Author:
tkent@chromium.org
Message:

2009-11-18 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Adler.

Tests for ValidityState.typeMismatch for the following types of INPUT element:

date, datetime, datetime-local, month, time and week

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

  • fast/forms/ValidityState-typeMismatch-date-expected.txt: Added.
  • fast/forms/ValidityState-typeMismatch-date.html: Added.
  • fast/forms/ValidityState-typeMismatch-datetime-expected.txt: Added.
  • fast/forms/ValidityState-typeMismatch-datetime.html: Added.
  • fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt: Added.
  • fast/forms/ValidityState-typeMismatch-datetimelocal.html: Added.
  • fast/forms/ValidityState-typeMismatch-month-expected.txt: Added.
  • fast/forms/ValidityState-typeMismatch-month.html: Added.
  • fast/forms/ValidityState-typeMismatch-time-expected.txt: Added.
  • fast/forms/ValidityState-typeMismatch-time.html: Added.
  • fast/forms/ValidityState-typeMismatch-week-expected.txt: Added.
  • fast/forms/ValidityState-typeMismatch-week.html: Added.
  • fast/forms/script-tests/ValidityState-typeMismatch-date.js: Added.
  • fast/forms/script-tests/ValidityState-typeMismatch-datetime.js: Added.
  • fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js: Added.
  • fast/forms/script-tests/ValidityState-typeMismatch-month.js: Added.
  • fast/forms/script-tests/ValidityState-typeMismatch-time.js: Added.
  • fast/forms/script-tests/ValidityState-typeMismatch-week.js: Added.

2009-11-18 Kent Tamura <tkent@chromium.org>

Reviewed by Darin Adler.

Add support for ValidityState.typeMismatch for the following INPUT types:

date datetime datetime-local month time week

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

Tests: fast/forms/ValidityState-typeMismatch-date.html

fast/forms/ValidityState-typeMismatch-datetime.html
fast/forms/ValidityState-typeMismatch-datetimelocal.html
fast/forms/ValidityState-typeMismatch-month.html
fast/forms/ValidityState-typeMismatch-time.html
fast/forms/ValidityState-typeMismatch-week.html

  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::formStringToISODateTime): Check the type validity of the specified type and string using the ISODateTime class.
  • html/HTMLInputElement.h:
  • html/ValidityState.cpp: (WebCore::ValidityState::typeMismatch): Check the type validity for date, datetime, datetime-local, month, time and week with HTMLInputElemtn::formStringToISODateTime()
Location:
trunk
Files:
18 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51159 r51163  
     12009-11-18  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Tests for ValidityState.typeMismatch for the following types of INPUT element:
     6            date, datetime, datetime-local, month, time and week
     7        https://bugs.webkit.org/show_bug.cgi?id=31342
     8
     9        * fast/forms/ValidityState-typeMismatch-date-expected.txt: Added.
     10        * fast/forms/ValidityState-typeMismatch-date.html: Added.
     11        * fast/forms/ValidityState-typeMismatch-datetime-expected.txt: Added.
     12        * fast/forms/ValidityState-typeMismatch-datetime.html: Added.
     13        * fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt: Added.
     14        * fast/forms/ValidityState-typeMismatch-datetimelocal.html: Added.
     15        * fast/forms/ValidityState-typeMismatch-month-expected.txt: Added.
     16        * fast/forms/ValidityState-typeMismatch-month.html: Added.
     17        * fast/forms/ValidityState-typeMismatch-time-expected.txt: Added.
     18        * fast/forms/ValidityState-typeMismatch-time.html: Added.
     19        * fast/forms/ValidityState-typeMismatch-week-expected.txt: Added.
     20        * fast/forms/ValidityState-typeMismatch-week.html: Added.
     21        * fast/forms/script-tests/ValidityState-typeMismatch-date.js: Added.
     22        * fast/forms/script-tests/ValidityState-typeMismatch-datetime.js: Added.
     23        * fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js: Added.
     24        * fast/forms/script-tests/ValidityState-typeMismatch-month.js: Added.
     25        * fast/forms/script-tests/ValidityState-typeMismatch-time.js: Added.
     26        * fast/forms/script-tests/ValidityState-typeMismatch-week.js: Added.
     27
    1282009-11-18  Kent Tamura  <tkent@chromium.org>
    229
  • trunk/WebCore/ChangeLog

    r51162 r51163  
     12009-11-18  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add support for ValidityState.typeMismatch for the following INPUT types:
     6          date datetime datetime-local month time week
     7        https://bugs.webkit.org/show_bug.cgi?id=31342
     8
     9        Tests: fast/forms/ValidityState-typeMismatch-date.html
     10               fast/forms/ValidityState-typeMismatch-datetime.html
     11               fast/forms/ValidityState-typeMismatch-datetimelocal.html
     12               fast/forms/ValidityState-typeMismatch-month.html
     13               fast/forms/ValidityState-typeMismatch-time.html
     14               fast/forms/ValidityState-typeMismatch-week.html
     15
     16        * html/HTMLInputElement.cpp:
     17        (WebCore::HTMLInputElement::formStringToISODateTime): Check the type
     18          validity of the specified type and string using the ISODateTime class.
     19        * html/HTMLInputElement.h:
     20        * html/ValidityState.cpp:
     21        (WebCore::ValidityState::typeMismatch): Check the type validity
     22          for date, datetime, datetime-local, month, time and week with
     23          HTMLInputElemtn::formStringToISODateTime()
     24
    1252009-11-18  Maciej Stachowiak  <mjs@apple.com>
    226
  • trunk/WebCore/html/HTMLInputElement.cpp

    r51159 r51163  
    4646#include "HTMLNames.h"
    4747#include "HTMLOptionElement.h"
     48#include "ISODateTime.h"
    4849#include "ScriptEventListener.h"
    4950#include "KeyboardEvent.h"
     
    20082009}
    20092010
     2011bool HTMLInputElement::formStringToISODateTime(InputType type, const String& formString, ISODateTime* out)
     2012{
     2013    ISODateTime ignoredResult;
     2014    if (!out)
     2015        out = &ignoredResult;
     2016    const UChar* characters = formString.characters();
     2017    unsigned length = formString.length();
     2018    unsigned end;
     2019
     2020    switch (type) {
     2021    case DATE:
     2022        return out->parseDate(characters, length, 0, end) && end == length;
     2023    case DATETIME:
     2024        return out->parseDateTime(characters, length, 0, end) && end == length;
     2025    case DATETIMELOCAL:
     2026        return out->parseDateTimeLocal(characters, length, 0, end) && end == length;
     2027    case MONTH:
     2028        return out->parseMonth(characters, length, 0, end) && end == length;
     2029    case WEEK:
     2030        return out->parseWeek(characters, length, 0, end) && end == length;
     2031    case TIME:
     2032        return out->parseTime(characters, length, 0, end) && end == length;
     2033    default:
     2034        ASSERT_NOT_REACHED();
     2035        return false;
     2036    }
     2037}
     2038
    20102039#if ENABLE(DATALIST)
    20112040HTMLElement* HTMLInputElement::list() const
  • trunk/WebCore/html/HTMLInputElement.h

    r51159 r51163  
    3535class HTMLImageLoader;
    3636class HTMLOptionElement;
     37class ISODateTime;
    3738class KURL;
    3839class VisibleSelection;
     
    248249    // The double* parameter may be 0.
    249250    static bool formStringToDouble(const String&, double*);
     251    // Parses the specified string as the InputType, and returns true if it is successfully parsed.
     252    // An instance pointed by the ISODateTime* parameter will have parsed values and be
     253    // modified even if the parsing fails.  The ISODateTime* parameter may be 0.
     254    static bool formStringToISODateTime(InputType, const String&, ISODateTime*);
    250255   
    251256protected:
  • trunk/WebCore/html/ValidityState.cpp

    r51159 r51163  
    7575        return false;
    7676    }
     77    case HTMLInputElement::DATE:
     78    case HTMLInputElement::DATETIME:
     79    case HTMLInputElement::DATETIMELOCAL:
     80    case HTMLInputElement::MONTH:
     81    case HTMLInputElement::TIME:
     82    case HTMLInputElement::WEEK:
     83        return !HTMLInputElement::formStringToISODateTime(input->inputType(), value, 0);
    7784    default:
    7885        return false;
Note: See TracChangeset for help on using the changeset viewer.