2010-10-03 Kent Tamura <tkent@chromium.org>
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Oct 2010 05:59:15 +0000 (05:59 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Oct 2010 05:59:15 +0000 (05:59 +0000)
        Reviewed by Dimitri Glazkov.

        Refactor HTMLInputElement: Move parseToDouble() and
        parseToDateComponents() to InputType.
        https://bugs.webkit.org/show_bug.cgi?id=46965

        Introduce BaseDateAndTimeInputType, which is a super class of
        date, datetime, datetime-local, month, time, and week types.

        No new tests. Just a refactoring.

        * Android.mk: Add BaseDateAndTimeInputType.
        * CMakeLists.txt: ditto.
        * GNUmakefile.am: ditto.
        * WebCore.gypi: ditto.
        * WebCore.pro: ditto.
        * WebCore.vcproj/WebCore.vcproj: ditto.
        * WebCore.xcodeproj/project.pbxproj: ditto.
        * html/BaseDateAndTimeInputType.cpp: Added.
        (WebCore::BaseDateAndTimeInputType::parseToDouble):
        (WebCore::BaseDateAndTimeInputType::parseToDateComponents):
        * html/BaseDateAndTimeInputType.h: Added.
        (WebCore::BaseDateAndTimeInputType::BaseDateAndTimeInputType):
        * html/DateInputType.cpp:
        (WebCore::DateInputType::parseToDateComponentsInternal):
        * html/DateInputType.h:
        (WebCore::DateInputType::DateInputType):
        * html/DateTimeInputType.cpp:
        (WebCore::DateTimeInputType::parseToDateComponentsInternal):
        * html/DateTimeInputType.h:
        (WebCore::DateTimeInputType::DateTimeInputType):
        * html/DateTimeLocalInputType.cpp:
        (WebCore::DateTimeLocalInputType::parseToDateComponentsInternal):
        * html/DateTimeLocalInputType.h:
        (WebCore::DateTimeLocalInputType::DateTimeLocalInputType):
        * html/HTMLInputElement.cpp: Replace parseToD* calls with m_inputType->parseToD*.
        (WebCore::HTMLInputElement::typeMismatch):
        (WebCore::HTMLInputElement::rangeUnderflow):
        (WebCore::HTMLInputElement::rangeOverflow):
        (WebCore::HTMLInputElement::minimum):
        (WebCore::HTMLInputElement::maximum):
        (WebCore::HTMLInputElement::stepBase):
        (WebCore::HTMLInputElement::stepMismatch):
        (WebCore::HTMLInputElement::applyStep):
        (WebCore::HTMLInputElement::valueAsDate):
        (WebCore::HTMLInputElement::valueAsNumber):
        (WebCore::HTMLInputElement::handleKeyEventForRange):
        (WebCore::HTMLInputElement::stepUpFromRenderer):
        * html/HTMLInputElement.h:
        * html/InputType.cpp:
        (WebCore::InputType::parseToDouble):
        (WebCore::InputType::parseToDateComponents):
        * html/InputType.h:
        * html/MonthInputType.cpp:
        (WebCore::MonthInputType::parseToDouble):
        (WebCore::MonthInputType::parseToDateComponentsInternal):
        * html/MonthInputType.h:
        (WebCore::MonthInputType::MonthInputType):
        * html/NumberInputType.cpp:
        (WebCore::NumberInputType::parseToDouble):
        * html/NumberInputType.h:
        * html/RangeInputType.cpp:
        (WebCore::RangeInputType::parseToDouble):
        * html/RangeInputType.h:
        * html/TimeInputType.cpp:
        (WebCore::TimeInputType::parseToDateComponentsInternal):
        * html/TimeInputType.h:
        (WebCore::TimeInputType::TimeInputType):
        * html/WeekInputType.cpp:
        (WebCore::WeekInputType::parseToDateComponentsInternal):
        * html/WeekInputType.h:
        (WebCore::WeekInputType::WeekInputType):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@68996 268f45cc-cd09-0410-ab3c-d52691b4dbfc

30 files changed:
WebCore/Android.mk
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/html/BaseDateAndTimeInputType.cpp [new file with mode: 0644]
WebCore/html/BaseDateAndTimeInputType.h [new file with mode: 0644]
WebCore/html/DateInputType.cpp
WebCore/html/DateInputType.h
WebCore/html/DateTimeInputType.cpp
WebCore/html/DateTimeInputType.h
WebCore/html/DateTimeLocalInputType.cpp
WebCore/html/DateTimeLocalInputType.h
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLInputElement.h
WebCore/html/InputType.cpp
WebCore/html/InputType.h
WebCore/html/MonthInputType.cpp
WebCore/html/MonthInputType.h
WebCore/html/NumberInputType.cpp
WebCore/html/NumberInputType.h
WebCore/html/RangeInputType.cpp
WebCore/html/RangeInputType.h
WebCore/html/TimeInputType.cpp
WebCore/html/TimeInputType.h
WebCore/html/WeekInputType.cpp
WebCore/html/WeekInputType.h

index 98c6515..d151b27 100644 (file)
@@ -261,6 +261,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        history/android/HistoryItemAndroid.cpp \
        \
        html/AsyncImageResizer.cpp \
+       html/BaseDateAndTimeInputType.cpp \
        html/BaseTextInputType.cpp \
        html/ButtonInputType.cpp \
        html/CheckboxInputType.cpp \
index 3c4a1e0..217252e 100644 (file)
@@ -944,6 +944,7 @@ SET(WebCore_SOURCES
     history/PageCache.cpp
 
     html/AsyncImageResizer.cpp
+    html/BaseDateAndTimeInputType.cpp
     html/BaseTextInputType.cpp
     html/ButtonInputType.cpp
     html/CheckboxInputType.cpp
index 05b9775..10ddf97 100644 (file)
@@ -1,3 +1,78 @@
+2010-10-03  Kent Tamura  <tkent@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Refactor HTMLInputElement: Move parseToDouble() and
+        parseToDateComponents() to InputType.
+        https://bugs.webkit.org/show_bug.cgi?id=46965
+
+        Introduce BaseDateAndTimeInputType, which is a super class of
+        date, datetime, datetime-local, month, time, and week types.
+
+        No new tests. Just a refactoring.
+
+        * Android.mk: Add BaseDateAndTimeInputType.
+        * CMakeLists.txt: ditto.
+        * GNUmakefile.am: ditto.
+        * WebCore.gypi: ditto.
+        * WebCore.pro: ditto.
+        * WebCore.vcproj/WebCore.vcproj: ditto.
+        * WebCore.xcodeproj/project.pbxproj: ditto.
+        * html/BaseDateAndTimeInputType.cpp: Added.
+        (WebCore::BaseDateAndTimeInputType::parseToDouble):
+        (WebCore::BaseDateAndTimeInputType::parseToDateComponents):
+        * html/BaseDateAndTimeInputType.h: Added.
+        (WebCore::BaseDateAndTimeInputType::BaseDateAndTimeInputType):
+        * html/DateInputType.cpp:
+        (WebCore::DateInputType::parseToDateComponentsInternal):
+        * html/DateInputType.h:
+        (WebCore::DateInputType::DateInputType):
+        * html/DateTimeInputType.cpp:
+        (WebCore::DateTimeInputType::parseToDateComponentsInternal):
+        * html/DateTimeInputType.h:
+        (WebCore::DateTimeInputType::DateTimeInputType):
+        * html/DateTimeLocalInputType.cpp:
+        (WebCore::DateTimeLocalInputType::parseToDateComponentsInternal):
+        * html/DateTimeLocalInputType.h:
+        (WebCore::DateTimeLocalInputType::DateTimeLocalInputType):
+        * html/HTMLInputElement.cpp: Replace parseToD* calls with m_inputType->parseToD*.
+        (WebCore::HTMLInputElement::typeMismatch):
+        (WebCore::HTMLInputElement::rangeUnderflow):
+        (WebCore::HTMLInputElement::rangeOverflow):
+        (WebCore::HTMLInputElement::minimum):
+        (WebCore::HTMLInputElement::maximum):
+        (WebCore::HTMLInputElement::stepBase):
+        (WebCore::HTMLInputElement::stepMismatch):
+        (WebCore::HTMLInputElement::applyStep):
+        (WebCore::HTMLInputElement::valueAsDate):
+        (WebCore::HTMLInputElement::valueAsNumber):
+        (WebCore::HTMLInputElement::handleKeyEventForRange):
+        (WebCore::HTMLInputElement::stepUpFromRenderer):
+        * html/HTMLInputElement.h:
+        * html/InputType.cpp:
+        (WebCore::InputType::parseToDouble):
+        (WebCore::InputType::parseToDateComponents):
+        * html/InputType.h:
+        * html/MonthInputType.cpp:
+        (WebCore::MonthInputType::parseToDouble):
+        (WebCore::MonthInputType::parseToDateComponentsInternal):
+        * html/MonthInputType.h:
+        (WebCore::MonthInputType::MonthInputType):
+        * html/NumberInputType.cpp:
+        (WebCore::NumberInputType::parseToDouble):
+        * html/NumberInputType.h:
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::parseToDouble):
+        * html/RangeInputType.h:
+        * html/TimeInputType.cpp:
+        (WebCore::TimeInputType::parseToDateComponentsInternal):
+        * html/TimeInputType.h:
+        (WebCore::TimeInputType::TimeInputType):
+        * html/WeekInputType.cpp:
+        (WebCore::WeekInputType::parseToDateComponentsInternal):
+        * html/WeekInputType.h:
+        (WebCore::WeekInputType::WeekInputType):
+
 2010-10-03  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Holger Freyther.
index 795c926..789a90c 100644 (file)
@@ -1427,6 +1427,8 @@ webcore_sources += \
        WebCore/history/PageCache.h \
        WebCore/html/AsyncImageResizer.cpp \
        WebCore/html/AsyncImageResizer.h \
+       WebCore/html/BaseDateAndTimeInputType.cpp \
+       WebCore/html/BaseDateAndTimeInputType.h \
        WebCore/html/BaseTextInputType.cpp \
        WebCore/html/BaseTextInputType.h \
        WebCore/html/ButtonInputType.cpp \
index 6e0c396..a17f61c 100644 (file)
             'history/PageCache.h',
             'html/AsyncImageResizer.cpp',
             'html/AsyncImageResizer.h',
+            'html/BaseDateAndTimeInputType.cpp',
+            'html/BaseDateAndTimeInputType.h',
             'html/BaseTextInputType.cpp',
             'html/BaseTextInputType.h',
             'html/ButtonInputType.cpp',
index a8452e4..d769921 100644 (file)
@@ -836,6 +836,7 @@ SOURCES += \
     history/qt/HistoryItemQt.cpp \
     history/PageCache.cpp \
     html/AsyncImageResizer.cpp \
+    html/BaseDateAndTimeInputType.cpp \
     html/BaseTextInputType.cpp \
     html/ButtonInputType.cpp \
     html/CheckboxInputType.cpp \
index 659bbf7..4f847a3 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\html\BaseDateAndTimeInputType.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\html\BaseDateAndTimeInputType.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\html\BaseTextInputType.cpp"\r
                                >\r
                        </File>\r
index 98830cd..b868408 100644 (file)
                F55B3DDE1251F12D003EF269 /* URLInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DAA1251F12D003EF269 /* URLInputType.h */; };
                F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3DAB1251F12D003EF269 /* WeekInputType.cpp */; };
                F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3DAC1251F12D003EF269 /* WeekInputType.h */; };
+               F59C95FF1255B23F000623C0 /* BaseDateAndTimeInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F59C95FD1255B23F000623C0 /* BaseDateAndTimeInputType.cpp */; };
+               F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F59C95FE1255B23F000623C0 /* BaseDateAndTimeInputType.h */; };
                F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */; };
                F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */; };
                F5C041E30FFCA96D00839D4A /* DOMHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */; };
                F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = SSLKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587868402DE3B8601EA4122 /* Cursor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Cursor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrList.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               F59C95FD1255B23F000623C0 /* BaseDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseDateAndTimeInputType.cpp; sourceTree = "<group>"; };
+               F59C95FE1255B23F000623C0 /* BaseDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseDateAndTimeInputType.h; sourceTree = "<group>"; };
                F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataListElement.cpp; sourceTree = "<group>"; };
                F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDataListElement.h; sourceTree = "<group>"; };
                F5C041D90FFCA7CE00839D4A /* HTMLDataListElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLDataListElement.idl; sourceTree = "<group>"; };
                                97C1F5511228558800EDE616 /* parser */,
                                B0149E7911A4B21500196A7B /* AsyncImageResizer.cpp */,
                                B0149E7A11A4B21500196A7B /* AsyncImageResizer.h */,
+                               F59C95FD1255B23F000623C0 /* BaseDateAndTimeInputType.cpp */,
+                               F59C95FE1255B23F000623C0 /* BaseDateAndTimeInputType.h */,
                                F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */,
                                F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */,
                                F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */,
                                BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */,
                                BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */,
                                B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */,
+                               F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */,
                                F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */,
                                BC9462D8107A7B4C00857193 /* BeforeLoadEvent.h in Headers */,
                                51721FBB11D2790700638B42 /* BeforeProcessEvent.h in Headers */,
                                BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */,
                                BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */,
                                B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */,
+                               F59C95FF1255B23F000623C0 /* BaseDateAndTimeInputType.cpp in Sources */,
                                F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */,
                                5172204B11D2960500638B42 /* BeforeProcessEvent.cpp in Sources */,
                                AB23A32709BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp in Sources */,
diff --git a/WebCore/html/BaseDateAndTimeInputType.cpp b/WebCore/html/BaseDateAndTimeInputType.cpp
new file mode 100644 (file)
index 0000000..1bdece2
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BaseDateAndTimeInputType.h"
+
+#include "DateComponents.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+double BaseDateAndTimeInputType::parseToDouble(const String& src, double defaultValue) const
+{
+    DateComponents date;
+    if (!parseToDateComponents(src, &date))
+        return defaultValue;
+    double msec = date.millisecondsSinceEpoch();
+    ASSERT(isfinite(msec));
+    return msec;
+}
+
+bool BaseDateAndTimeInputType::parseToDateComponents(const String& source, DateComponents* out) const
+{
+    if (source.isEmpty())
+        return false;
+    DateComponents ignoredResult;
+    if (!out)
+        out = &ignoredResult;
+    return parseToDateComponentsInternal(source.characters(), source.length(), out);
+}
+
+} // namespace WebCore
diff --git a/WebCore/html/BaseDateAndTimeInputType.h b/WebCore/html/BaseDateAndTimeInputType.h
new file mode 100644 (file)
index 0000000..336cd83
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BaseDateAndTimeInputType_h
+#define BaseDateAndTimeInputType_h
+
+#include "TextFieldInputType.h"
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+// A super class of date, datetime, datetime-local, month, time, and week types.
+class BaseDateAndTimeInputType : public TextFieldInputType {
+protected:
+    BaseDateAndTimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    virtual bool parseToDateComponents(const String&, DateComponents*) const;
+    // A helper for parseToDateComponents().
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const = 0;
+private:
+    virtual double parseToDouble(const String&, double) const;
+};
+
+} // namespace WebCore
+
+#endif // BaseDateAndTimeInputType_h
index 0605846..3cb959d 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "DateInputType.h"
 
+#include "DateComponents.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,11 @@ const AtomicString& DateInputType::formControlType() const
     return InputTypeNames::date();
 }
 
+bool DateInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
+{
+    ASSERT(out);
+    unsigned end;
+    return out->parseDate(characters, length, 0, end) && end == length;
+}
+
 } // namespace WebCore
index e6f60d7..e37682e 100644 (file)
 #ifndef DateInputType_h
 #define DateInputType_h
 
-#include "TextFieldInputType.h"
+#include "BaseDateAndTimeInputType.h"
 
 namespace WebCore {
 
-class DateInputType : public TextFieldInputType {
+class DateInputType : public BaseDateAndTimeInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
-    DateInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    DateInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const;
 };
 
 } // namespace WebCore
index 0bf5e04..75bf1da 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "DateTimeInputType.h"
 
+#include "DateComponents.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,11 @@ const AtomicString& DateTimeInputType::formControlType() const
     return InputTypeNames::datetime();
 }
 
+bool DateTimeInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
+{
+    ASSERT(out);
+    unsigned end;
+    return out->parseDateTime(characters, length, 0, end) && end == length;
+}
+
 } // namespace WebCore
index f24ebfb..92ebc41 100644 (file)
 #ifndef DateTimeInputType_h
 #define DateTimeInputType_h
 
-#include "TextFieldInputType.h"
+#include "BaseDateAndTimeInputType.h"
 
 namespace WebCore {
 
-class DateTimeInputType : public TextFieldInputType {
+class DateTimeInputType : public BaseDateAndTimeInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
-    DateTimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    DateTimeInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const;
 };
 
 } // namespace WebCore
index 33c6cfa..916a386 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "DateTimeLocalInputType.h"
 
+#include "DateComponents.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,11 @@ const AtomicString& DateTimeLocalInputType::formControlType() const
     return InputTypeNames::datetimelocal();
 }
 
+bool DateTimeLocalInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
+{
+    ASSERT(out);
+    unsigned end;
+    return out->parseDateTimeLocal(characters, length, 0, end) && end == length;
+}
+
 } // namespace WebCore
index 1a3d866..3ec841d 100644 (file)
 #ifndef DateTimeLocalInputType_h
 #define DateTimeLocalInputType_h
 
-#include "TextFieldInputType.h"
+#include "BaseDateAndTimeInputType.h"
 
 namespace WebCore {
 
-class DateTimeLocalInputType : public TextFieldInputType {
+class DateTimeLocalInputType : public BaseDateAndTimeInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
-    DateTimeLocalInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    DateTimeLocalInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const;
 };
 
 } // namespace WebCore
index 4790ac6..dff895a 100644 (file)
@@ -283,7 +283,7 @@ bool HTMLInputElement::typeMismatch(const String& value) const
     case MONTH:
     case TIME:
     case WEEK:
-        return !parseToDateComponents(deprecatedInputType(), value, 0);
+        return !m_inputType->parseToDateComponents(value, 0);
     case BUTTON:
     case CHECKBOX:
     case FILE:
@@ -379,11 +379,11 @@ bool HTMLInputElement::rangeUnderflow(const String& value) const
     case NUMBER:
     case TIME:
     case WEEK: {
-        double doubleValue = parseToDouble(value, nan);
+        double doubleValue = m_inputType->parseToDouble(value, nan);
         return isfinite(doubleValue) && doubleValue < minimum();
     }
     case RANGE: // Guaranteed by sanitization.
-        ASSERT(parseToDouble(value, nan) >= minimum());
+        ASSERT(m_inputType->parseToDouble(value, nan) >= minimum());
     case BUTTON:
     case CHECKBOX:
     case COLOR:
@@ -416,11 +416,11 @@ bool HTMLInputElement::rangeOverflow(const String& value) const
     case NUMBER:
     case TIME:
     case WEEK: {
-        double doubleValue = parseToDouble(value, nan);
+        double doubleValue = m_inputType->parseToDouble(value, nan);
         return isfinite(doubleValue) && doubleValue > maximum();
     }
     case RANGE: // Guaranteed by sanitization.
-        ASSERT(parseToDouble(value, nan) <= maximum());
+        ASSERT(m_inputType->parseToDouble(value, nan) <= maximum());
     case BUTTON:
     case CHECKBOX:
     case COLOR:
@@ -446,20 +446,20 @@ double HTMLInputElement::minimum() const
 {
     switch (deprecatedInputType()) {
     case DATE:
-        return parseToDouble(getAttribute(minAttr), DateComponents::minimumDate());
+        return m_inputType->parseToDouble(getAttribute(minAttr), DateComponents::minimumDate());
     case DATETIME:
     case DATETIMELOCAL:
-        return parseToDouble(getAttribute(minAttr), DateComponents::minimumDateTime());
+        return m_inputType->parseToDouble(getAttribute(minAttr), DateComponents::minimumDateTime());
     case MONTH:
-        return parseToDouble(getAttribute(minAttr), DateComponents::minimumMonth());
+        return m_inputType->parseToDouble(getAttribute(minAttr), DateComponents::minimumMonth());
     case NUMBER:
-        return parseToDouble(getAttribute(minAttr), numberDefaultMinimum);
+        return m_inputType->parseToDouble(getAttribute(minAttr), numberDefaultMinimum);
     case RANGE:
-        return parseToDouble(getAttribute(minAttr), rangeDefaultMinimum);
+        return m_inputType->parseToDouble(getAttribute(minAttr), rangeDefaultMinimum);
     case TIME:
-        return parseToDouble(getAttribute(minAttr), DateComponents::minimumTime());
+        return m_inputType->parseToDouble(getAttribute(minAttr), DateComponents::minimumTime());
     case WEEK:
-        return parseToDouble(getAttribute(minAttr), DateComponents::minimumWeek());
+        return m_inputType->parseToDouble(getAttribute(minAttr), DateComponents::minimumWeek());
     case BUTTON:
     case CHECKBOX:
     case COLOR:
@@ -486,16 +486,16 @@ double HTMLInputElement::maximum() const
 {
     switch (deprecatedInputType()) {
     case DATE:
-        return parseToDouble(getAttribute(maxAttr), DateComponents::maximumDate());
+        return m_inputType->parseToDouble(getAttribute(maxAttr), DateComponents::maximumDate());
     case DATETIME:
     case DATETIMELOCAL:
-        return parseToDouble(getAttribute(maxAttr), DateComponents::maximumDateTime());
+        return m_inputType->parseToDouble(getAttribute(maxAttr), DateComponents::maximumDateTime());
     case MONTH:
-        return parseToDouble(getAttribute(maxAttr), DateComponents::maximumMonth());
+        return m_inputType->parseToDouble(getAttribute(maxAttr), DateComponents::maximumMonth());
     case NUMBER:
-        return parseToDouble(getAttribute(maxAttr), numberDefaultMaximum);
+        return m_inputType->parseToDouble(getAttribute(maxAttr), numberDefaultMaximum);
     case RANGE: {
-        double max = parseToDouble(getAttribute(maxAttr), rangeDefaultMaximum);
+        double max = m_inputType->parseToDouble(getAttribute(maxAttr), rangeDefaultMaximum);
         // A remedy for the inconsistent min/max values for RANGE.
         // Sets the maximum to the default or the minimum value.
         double min = minimum();
@@ -504,9 +504,9 @@ double HTMLInputElement::maximum() const
         return max;
     }
     case TIME:
-        return parseToDouble(getAttribute(maxAttr), DateComponents::maximumTime());
+        return m_inputType->parseToDouble(getAttribute(maxAttr), DateComponents::maximumTime());
     case WEEK:
-        return parseToDouble(getAttribute(maxAttr), DateComponents::maximumWeek());
+        return m_inputType->parseToDouble(getAttribute(maxAttr), DateComponents::maximumWeek());
     case BUTTON:
     case CHECKBOX:
     case COLOR:
@@ -540,9 +540,9 @@ double HTMLInputElement::stepBase() const
     case MONTH:
     case NUMBER:
     case TIME:
-        return parseToDouble(getAttribute(minAttr), defaultStepBase);
+        return m_inputType->parseToDouble(getAttribute(minAttr), defaultStepBase);
     case WEEK:
-        return parseToDouble(getAttribute(minAttr), weekDefaultStepBase);
+        return m_inputType->parseToDouble(getAttribute(minAttr), weekDefaultStepBase);
     case BUTTON:
     case CHECKBOX:
     case COLOR:
@@ -600,7 +600,7 @@ bool HTMLInputElement::stepMismatch(const String& value) const
     case TIME:
     case WEEK: {
         const double nan = numeric_limits<double>::quiet_NaN();
-        double doubleValue = parseToDouble(value, nan);
+        double doubleValue = m_inputType->parseToDouble(value, nan);
         doubleValue = fabs(doubleValue - stepBase());
         if (!isfinite(doubleValue))
             return false;
@@ -723,7 +723,7 @@ void HTMLInputElement::applyStep(double count, ExceptionCode& ec)
         return;
     }
     const double nan = numeric_limits<double>::quiet_NaN();
-    double current = parseToDouble(value(), nan);
+    double current = m_inputType->parseToDouble(value(), nan);
     if (!isfinite(current)) {
         ec = INVALID_STATE_ERR;
         return;
@@ -1643,60 +1643,6 @@ void HTMLInputElement::setValue(const String& value, bool sendChangeEvent)
     InputElement::notifyFormStateChanged(this);
 }
 
-double HTMLInputElement::parseToDouble(const String& src, double defaultValue) const
-{
-    switch (deprecatedInputType()) {
-    case DATE:
-    case DATETIME:
-    case DATETIMELOCAL:
-    case TIME:
-    case WEEK: {
-        DateComponents date;
-        if (!parseToDateComponents(deprecatedInputType(), src, &date))
-            return defaultValue;
-        double msec = date.millisecondsSinceEpoch();
-        ASSERT(isfinite(msec));
-        return msec;
-    }
-    case MONTH: {
-        DateComponents date;
-        if (!parseToDateComponents(deprecatedInputType(), src, &date))
-            return defaultValue;
-        double months = date.monthsSinceEpoch();
-        ASSERT(isfinite(months));
-        return months;
-    }
-    case NUMBER:
-    case RANGE: {
-        double numberValue;
-        if (!parseToDoubleForNumberType(src, &numberValue))
-            return defaultValue;
-        ASSERT(isfinite(numberValue));
-        return numberValue;
-    }
-
-    case BUTTON:
-    case CHECKBOX:
-    case COLOR:
-    case EMAIL:
-    case FILE:
-    case HIDDEN:
-    case IMAGE:
-    case ISINDEX:
-    case PASSWORD:
-    case RADIO:
-    case RESET:
-    case SEARCH:
-    case SUBMIT:
-    case TELEPHONE:
-    case TEXT:
-    case URL:
-        return defaultValue;
-    }
-    ASSERT_NOT_REACHED();
-    return defaultValue;
-}
-
 double HTMLInputElement::valueAsDate() const
 {
     switch (deprecatedInputType()) {
@@ -1704,10 +1650,10 @@ double HTMLInputElement::valueAsDate() const
     case DATETIME:
     case TIME:
     case WEEK:
-        return parseToDouble(value(), DateComponents::invalidMilliseconds());
+        return m_inputType->parseToDouble(value(), DateComponents::invalidMilliseconds());
     case MONTH: {
         DateComponents date;
-        if (!parseToDateComponents(deprecatedInputType(), value(), &date))
+        if (!m_inputType->parseToDateComponents(value(), &date))
             return DateComponents::invalidMilliseconds();
         double msec = date.millisecondsSinceEpoch();
         ASSERT(isfinite(msec));
@@ -1794,7 +1740,7 @@ double HTMLInputElement::valueAsNumber() const
     case RANGE:
     case TIME:
     case WEEK:
-        return parseToDouble(value(), nan);
+        return m_inputType->parseToDouble(value(), nan);
 
     case BUTTON:
     case CHECKBOX:
@@ -2492,7 +2438,7 @@ void HTMLInputElement::handleKeyEventForRange(KeyboardEvent* event)
         double max = maximum();
         // FIXME: Is 1/100 reasonable?
         double step = (max - min) / 100;
-        double current = parseToDouble(value(), numeric_limits<double>::quiet_NaN());
+        double current = m_inputType->parseToDouble(value(), numeric_limits<double>::quiet_NaN());
         ASSERT(isfinite(current));
         double newValue;
         if (key == "Up" || key == "Right") {
@@ -2791,36 +2737,6 @@ bool HTMLInputElement::recalcWillValidate() const
     return false;
 }
 
-bool HTMLInputElement::parseToDateComponents(DeprecatedInputType type, const String& formString, DateComponents* out)
-{
-    if (formString.isEmpty())
-        return false;
-    DateComponents ignoredResult;
-    if (!out)
-        out = &ignoredResult;
-    const UChar* characters = formString.characters();
-    unsigned length = formString.length();
-    unsigned end;
-
-    switch (type) {
-    case DATE:
-        return out->parseDate(characters, length, 0, end) && end == length;
-    case DATETIME:
-        return out->parseDateTime(characters, length, 0, end) && end == length;
-    case DATETIMELOCAL:
-        return out->parseDateTimeLocal(characters, length, 0, end) && end == length;
-    case MONTH:
-        return out->parseMonth(characters, length, 0, end) && end == length;
-    case WEEK:
-        return out->parseWeek(characters, length, 0, end) && end == length;
-    case TIME:
-        return out->parseTime(characters, length, 0, end) && end == length;
-    default:
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-}
-
 #if ENABLE(DATALIST)
 
 HTMLElement* HTMLInputElement::list() const
@@ -2912,7 +2828,7 @@ void HTMLInputElement::stepUpFromRenderer(int n)
 
     const double nan = numeric_limits<double>::quiet_NaN();
     String currentStringValue = value();
-    double current = parseToDouble(currentStringValue, nan);
+    double current = m_inputType->parseToDouble(currentStringValue, nan);
     if (!isfinite(current) || (n > 0 && current < minimum()) || (n < 0 && current > maximum()))
         setValue(serialize(n > 0 ? minimum() : maximum()));
     else {
index d2e23fa..cd98a1d 100644 (file)
@@ -330,16 +330,6 @@ private:
     // Helper for applyStepForNumberOrRange().
     double stepBase() const;
 
-    // Parses the specified string as the DeprecatedInputType, and returns true if it is successfully parsed.
-    // An instance pointed by the DateComponents* parameter will have parsed values and be
-    // modified even if the parsing fails.  The DateComponents* parameter may be 0.
-    static bool parseToDateComponents(DeprecatedInputType, const String&, DateComponents*);
-
-    // Parses the specified string for the current type, and return
-    // the double value for the parsing result if the parsing
-    // succeeds; Returns defaultValue otherwise. This function can
-    // return NaN or Infinity only if defaultValue is NaN or Infinity.
-    double parseToDouble(const String&, double defaultValue) const;
     // Create a string representation of the specified double value for the
     // current input type. If NaN or Infinity is specified, this returns an
     // emtpy string. This should not be called for types without valueAsNumber.
index c3435f7..7b83ca4 100644 (file)
@@ -122,6 +122,18 @@ bool InputType::patternMismatch(const String&) const
     return false;
 }
 
+double InputType::parseToDouble(const String&, double defaultValue) const
+{
+    return defaultValue;
+}
+
+bool InputType::parseToDateComponents(const String&, DateComponents*) const
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+
 namespace InputTypeNames {
 
 // The type names must be lowercased because they will be the return values of
index 3141f34..9ce7648 100644 (file)
@@ -36,6 +36,7 @@
 
 namespace WebCore {
 
+class DateComponents;
 class HTMLInputElement;
 
 class InputType : public Noncopyable {
@@ -50,6 +51,17 @@ public:
 
     virtual bool patternMismatch(const String&) const;
 
+    // Parses the specified string for the type, and return
+    // the double value for the parsing result if the parsing
+    // succeeds; Returns defaultValue otherwise. This function can
+    // return NaN or Infinity only if defaultValue is NaN or Infinity.
+    virtual double parseToDouble(const String&, double defaultValue) const;
+    // Parses the specified string for this InputType, and returns true if it
+    // is successfully parsed. An instance pointed by the DateComponents*
+    // parameter will have parsed values and be modified even if the parsing
+    // fails. The DateComponents* parameter may be 0.
+    virtual bool parseToDateComponents(const String&, DateComponents*) const;
+
 protected:
     InputType(HTMLInputElement* element) : m_element(element) { }
     HTMLInputElement* element() const { return m_element; }
index 54f78c6..501bdc7 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "MonthInputType.h"
 
+#include "DateComponents.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,21 @@ const AtomicString& MonthInputType::formControlType() const
     return InputTypeNames::month();
 }
 
+double MonthInputType::parseToDouble(const String& src, double defaultValue) const
+{
+    DateComponents date;
+    if (!parseToDateComponents(src, &date))
+        return defaultValue;
+    double months = date.monthsSinceEpoch();
+    ASSERT(isfinite(months));
+    return months;
+}
+
+bool MonthInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
+{
+    ASSERT(out);
+    unsigned end;
+    return out->parseMonth(characters, length, 0, end) && end == length;
+}
+
 } // namespace WebCore
index d605ffa..a7ea550 100644 (file)
 #ifndef MonthInputType_h
 #define MonthInputType_h
 
-#include "TextFieldInputType.h"
+#include "BaseDateAndTimeInputType.h"
 
 namespace WebCore {
 
-class MonthInputType : public TextFieldInputType {
+class MonthInputType : public BaseDateAndTimeInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
-    MonthInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    MonthInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual double parseToDouble(const String&, double) const;
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const;
 };
 
 } // namespace WebCore
index 9aba5c3..230ea6f 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "NumberInputType.h"
 
+#include "HTMLParserIdioms.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,13 @@ const AtomicString& NumberInputType::formControlType() const
     return InputTypeNames::number();
 }
 
+double NumberInputType::parseToDouble(const String& src, double defaultValue) const
+{
+    double numberValue;
+    if (!parseToDoubleForNumberType(src, &numberValue))
+        return defaultValue;
+    ASSERT(isfinite(numberValue));
+    return numberValue;
+}
+
 } // namespace WebCore
index 5347249..9a2e9cd 100644 (file)
@@ -42,6 +42,7 @@ public:
 private:
     NumberInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual double parseToDouble(const String&, double) const;
 };
 
 } // namespace WebCore
index f5f7322..1b07ac3 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "RangeInputType.h"
 
+#include "HTMLParserIdioms.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,13 @@ const AtomicString& RangeInputType::formControlType() const
     return InputTypeNames::range();
 }
 
+double RangeInputType::parseToDouble(const String& src, double defaultValue) const
+{
+    double numberValue;
+    if (!parseToDoubleForNumberType(src, &numberValue))
+        return defaultValue;
+    ASSERT(isfinite(numberValue));
+    return numberValue;
+}
+
 } // namespace WebCore
index d42c617..e681e5a 100644 (file)
@@ -42,6 +42,7 @@ public:
 private:
     RangeInputType(HTMLInputElement* element) : InputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual double parseToDouble(const String&, double) const;
 };
 
 } // namespace WebCore
index 1564bc5..535ab04 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "TimeInputType.h"
 
+#include "DateComponents.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,11 @@ const AtomicString& TimeInputType::formControlType() const
     return InputTypeNames::time();
 }
 
+bool TimeInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
+{
+    ASSERT(out);
+    unsigned end;
+    return out->parseTime(characters, length, 0, end) && end == length;
+}
+
 } // namespace WebCore
index 9530f7d..5f1256d 100644 (file)
 #ifndef TimeInputType_h
 #define TimeInputType_h
 
-#include "TextFieldInputType.h"
+#include "BaseDateAndTimeInputType.h"
 
 namespace WebCore {
 
-class TimeInputType : public TextFieldInputType {
+class TimeInputType : public BaseDateAndTimeInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
-    TimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    TimeInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const;
 };
 
 } // namespace WebCore
index 0b4ab30..1bdabe0 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "WeekInputType.h"
 
+#include "DateComponents.h"
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
@@ -45,4 +46,11 @@ const AtomicString& WeekInputType::formControlType() const
     return InputTypeNames::week();
 }
 
+bool WeekInputType::parseToDateComponentsInternal(const UChar* characters, unsigned length, DateComponents* out) const
+{
+    ASSERT(out);
+    unsigned end;
+    return out->parseWeek(characters, length, 0, end) && end == length;
+}
+
 } // namespace WebCore
index 7b6ee23..a190ca8 100644 (file)
 #ifndef WeekInputType_h
 #define WeekInputType_h
 
-#include "TextFieldInputType.h"
+#include "BaseDateAndTimeInputType.h"
 
 namespace WebCore {
 
-class WeekInputType : public TextFieldInputType {
+class WeekInputType : public BaseDateAndTimeInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
 
 private:
-    WeekInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
+    WeekInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { }
     virtual const AtomicString& formControlType() const;
+    virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const;
 };
 
 } // namespace WebCore