Title: [139424] trunk/Source/WebCore
Revision
139424
Author
[email protected]
Date
2013-01-11 03:24:43 -0800 (Fri, 11 Jan 2013)

Log Message

BaseDateAndTimeInputType should not inherit from TextFieldInputType
https://bugs.webkit.org/show_bug.cgi?id=106306

Reviewed by Hajime Morita.

Date/time input types don't need text-field features at all.

No new tests. This should not make any behavior changes except reduction
of memory usage.

* html/BaseDateAndTimeInputType.h:
Inherit InputType instead of TextFieldInputType.
(WebCore::BaseDateAndTimeInputType::BaseDateAndTimeInputType):
(BaseDateAndTimeInputType): Update function declarations.
* html/BaseDateAndTimeInputType.cpp:
Remove handleKeydownEvent and convertFromVisibleValue, which are for
TextFieldInputType.
(WebCore::BaseDateAndTimeInputType::shouldRespectListAttribute):
Added. This is necessary for <datalist> support. TextFieldInputType has
the same code.
(WebCore::BaseDateAndTimeInputType::valueMissing):
Added. This is necessary for validity.valueMissing. TextFieldInputType
has the same code.

* html/BaseChooserOnlyDateAndTimeInputType.cpp:
Remove unnecessary functions which cancel TextFieldInputType behavior.
* html/BaseChooserOnlyDateAndTimeInputType.h:
(BaseChooserOnlyDateAndTimeInputType): Remove declarations for them.

* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
Remove unnecessary functions which cancel TextFieldInputType behavior.
* html/BaseMultipleFieldsDateAndTimeInputType.h:
(BaseMultipleFieldsDateAndTimeInputType):
Add SpinButtonOwner interface. We didn't need it because
TextFieldInputType implements it.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139423 => 139424)


--- trunk/Source/WebCore/ChangeLog	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/ChangeLog	2013-01-11 11:24:43 UTC (rev 139424)
@@ -1,3 +1,41 @@
+2013-01-11  Kent Tamura  <[email protected]>
+
+        BaseDateAndTimeInputType should not inherit from TextFieldInputType
+        https://bugs.webkit.org/show_bug.cgi?id=106306
+
+        Reviewed by Hajime Morita.
+
+        Date/time input types don't need text-field features at all.
+
+        No new tests. This should not make any behavior changes except reduction
+        of memory usage.
+
+        * html/BaseDateAndTimeInputType.h:
+        Inherit InputType instead of TextFieldInputType.
+        (WebCore::BaseDateAndTimeInputType::BaseDateAndTimeInputType):
+        (BaseDateAndTimeInputType): Update function declarations.
+        * html/BaseDateAndTimeInputType.cpp:
+        Remove handleKeydownEvent and convertFromVisibleValue, which are for
+        TextFieldInputType.
+        (WebCore::BaseDateAndTimeInputType::shouldRespectListAttribute):
+        Added. This is necessary for <datalist> support. TextFieldInputType has
+        the same code.
+        (WebCore::BaseDateAndTimeInputType::valueMissing):
+        Added. This is necessary for validity.valueMissing. TextFieldInputType
+        has the same code.
+
+        * html/BaseChooserOnlyDateAndTimeInputType.cpp:
+        Remove unnecessary functions which cancel TextFieldInputType behavior.
+        * html/BaseChooserOnlyDateAndTimeInputType.h:
+        (BaseChooserOnlyDateAndTimeInputType): Remove declarations for them.
+
+        * html/BaseMultipleFieldsDateAndTimeInputType.cpp:
+        Remove unnecessary functions which cancel TextFieldInputType behavior.
+        * html/BaseMultipleFieldsDateAndTimeInputType.h:
+        (BaseMultipleFieldsDateAndTimeInputType):
+        Add SpinButtonOwner interface. We didn't need it because
+        TextFieldInputType implements it.
+
 2013-01-11  Mary Wu  <[email protected]>
 
         [BlackBerry] Enable concatenating headers with same field name

Modified: trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp (139423 => 139424)


--- trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp	2013-01-11 11:24:43 UTC (rev 139424)
@@ -59,25 +59,6 @@
     m_dateTimeChooser = chrome->openDateTimeChooser(this, parameters);
 }
 
-RenderObject* BaseChooserOnlyDateAndTimeInputType::createRenderer(RenderArena* arena, RenderStyle* style) const
-{
-    // Cancel the override by TextFieldInputType.
-    // FIXME: Remove this function when we stop inheriting TextFieldInputType.
-    return InputType::createRenderer(arena, style);
-}
-
-void BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue()
-{
-    // Cancel the override by TextFieldInputType.
-    // FIXME: Remove this function when we stop inheriting TextFieldInputType.
-}
-
-void BaseChooserOnlyDateAndTimeInputType::forwardEvent(Event*)
-{
-    // Cancel the override by TextFieldInputType.
-    // FIXME: Remove this function when we stop inheriting TextFieldInputType.
-}
-
 void BaseChooserOnlyDateAndTimeInputType::createShadowSubtree()
 {
     DEFINE_STATIC_LOCAL(AtomicString, valueContainerPseudo, ("-webkit-date-and-time-value", AtomicString::ConstructFromLiteral));

Modified: trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h (139423 => 139424)


--- trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h	2013-01-11 11:24:43 UTC (rev 139424)
@@ -44,9 +44,6 @@
     void closeDateTimeChooser();
 
     // InputType functions:
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE;
-    virtual void updateInnerTextValue() OVERRIDE;
-    void forwardEvent(Event*) OVERRIDE;
     virtual void createShadowSubtree() OVERRIDE;
     virtual void detach() OVERRIDE;
     virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE;

Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp (139423 => 139424)


--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp	2013-01-11 11:24:43 UTC (rev 139424)
@@ -96,14 +96,6 @@
     return true;
 }
 
-void BaseDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event)
-{
-    if (shouldHaveSpinButton())
-        handleKeydownEventForSpinButton(event);
-    if (!event->defaultHandled())
-        TextFieldInputType::handleKeydownEvent(event);
-}
-
 Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const
 {
     DateComponents date;
@@ -166,15 +158,6 @@
     return localizeValue(element()->value());
 }
 
-String BaseDateAndTimeInputType::convertFromVisibleValue(const String& visibleValue) const
-{
-    // convertFromVisibleValue is used in the textfield UI. Though this class
-    // inherits TextFieldInputType, users are unable to edit visible values, and
-    // this function is never called.
-    ASSERT_NOT_REACHED();
-    return visibleValue;
-}
-
 String BaseDateAndTimeInputType::sanitizeValue(const String& proposedValue) const
 {
     return typeMismatchFor(proposedValue) ? String() : proposedValue;
@@ -185,5 +168,15 @@
     return true;
 }
 
+bool BaseDateAndTimeInputType::shouldRespectListAttribute()
+{
+    return InputType::themeSupportsDataListUI(this);
+}
+
+bool BaseDateAndTimeInputType::valueMissing(const String& value) const
+{
+    return element()->isRequired() && value.isEmpty();
+}
+
 } // namespace WebCore
 #endif

Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.h (139423 => 139424)


--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.h	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.h	2013-01-11 11:24:43 UTC (rev 139424)
@@ -33,17 +33,15 @@
 
 #if ENABLE(DATE_AND_TIME_INPUT_TYPES)
 #include "DateComponents.h"
-#include "TextFieldInputType.h"
+#include "InputType.h"
 #include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
 // A super class of date, datetime, datetime-local, month, time, and week types.
-// FIXME: Don't inherit TextFieldInputType. webkit.org/b/100935
-class BaseDateAndTimeInputType : public TextFieldInputType {
+class BaseDateAndTimeInputType : public InputType {
 protected:
-    BaseDateAndTimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { }
-    virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
+    BaseDateAndTimeInputType(HTMLInputElement* element) : InputType(element) { }
     virtual Decimal parseToNumber(const String&, const Decimal&) const OVERRIDE;
     virtual bool parseToDateComponents(const String&, DateComponents*) const OVERRIDE;
     virtual String sanitizeValue(const String&) const OVERRIDE;
@@ -61,12 +59,13 @@
     virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
     virtual bool typeMismatchFor(const String&) const OVERRIDE;
     virtual bool typeMismatch() const OVERRIDE;
+    virtual bool valueMissing(const String&) const OVERRIDE;
     virtual Decimal defaultValueForStepUp() const OVERRIDE;
     virtual bool isSteppable() const OVERRIDE;
     virtual String serializeWithMilliseconds(double) const;
     virtual String localizeValue(const String&) const OVERRIDE;
-    virtual String convertFromVisibleValue(const String&) const OVERRIDE;
     virtual bool supportsReadOnly() const OVERRIDE;
+    virtual bool shouldRespectListAttribute() OVERRIDE;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp (139423 => 139424)


--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2013-01-11 11:24:43 UTC (rev 139424)
@@ -181,11 +181,6 @@
         m_dateTimeEditElement->blurByOwner();
 }
 
-RenderObject* BaseMultipleFieldsDateAndTimeInputType::createRenderer(RenderArena* arena, RenderStyle* style) const
-{
-    return InputType::createRenderer(arena, style);
-}
-
 void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
 {
     DEFINE_STATIC_LOCAL(AtomicString, dateAndTimeInputContainerPseudoId, ("-webkit-date-and-time-container", AtomicString::ConstructFromLiteral));
@@ -312,11 +307,6 @@
         m_dateTimeEditElement->readOnlyStateChanged();
 }
 
-bool BaseMultipleFieldsDateAndTimeInputType::isTextField() const
-{
-    return false;
-}
-
 void BaseMultipleFieldsDateAndTimeInputType::restoreFormControlState(const FormControlState& state)
 {
     if (!m_dateTimeEditElement)

Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h (139423 => 139424)


--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h	2013-01-11 11:12:18 UTC (rev 139423)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h	2013-01-11 11:24:43 UTC (rev 139424)
@@ -42,7 +42,11 @@
 
 struct DateTimeChooserParameters;
 
-class BaseMultipleFieldsDateAndTimeInputType : public BaseDateAndTimeInputType, protected DateTimeEditElement::EditControlOwner, protected PickerIndicatorElement::PickerIndicatorOwner {
+class BaseMultipleFieldsDateAndTimeInputType
+    : public BaseDateAndTimeInputType
+    , protected DateTimeEditElement::EditControlOwner
+    , protected PickerIndicatorElement::PickerIndicatorOwner
+    , protected SpinButtonElement::SpinButtonOwner {
 protected:
     BaseMultipleFieldsDateAndTimeInputType(HTMLInputElement*);
     virtual ~BaseMultipleFieldsDateAndTimeInputType();
@@ -74,7 +78,6 @@
     // InputType functions
     virtual String badInputText() const OVERRIDE;
     virtual void blur() OVERRIDE FINAL;
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE FINAL;
     virtual void createShadowSubtree() OVERRIDE FINAL;
     virtual void destroyShadowSubtree() OVERRIDE FINAL;
     virtual void disabledAttributeChanged() OVERRIDE FINAL;
@@ -85,7 +88,6 @@
     virtual bool hasCustomFocusLogic() const OVERRIDE FINAL;
     virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE FINAL;
     virtual bool isMouseFocusable() const OVERRIDE FINAL;
-    virtual bool isTextField() const OVERRIDE FINAL;
     virtual void minOrMaxAttributeChanged() OVERRIDE FINAL;
     virtual void readonlyAttributeChanged() OVERRIDE FINAL;
     virtual void restoreFormControlState(const FormControlState&) OVERRIDE FINAL;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to