Changeset 139424 in webkit
- Timestamp:
- Jan 11, 2013 3:24:43 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r139423 r139424 1 2013-01-11 Kent Tamura <tkent@chromium.org> 2 3 BaseDateAndTimeInputType should not inherit from TextFieldInputType 4 https://bugs.webkit.org/show_bug.cgi?id=106306 5 6 Reviewed by Hajime Morita. 7 8 Date/time input types don't need text-field features at all. 9 10 No new tests. This should not make any behavior changes except reduction 11 of memory usage. 12 13 * html/BaseDateAndTimeInputType.h: 14 Inherit InputType instead of TextFieldInputType. 15 (WebCore::BaseDateAndTimeInputType::BaseDateAndTimeInputType): 16 (BaseDateAndTimeInputType): Update function declarations. 17 * html/BaseDateAndTimeInputType.cpp: 18 Remove handleKeydownEvent and convertFromVisibleValue, which are for 19 TextFieldInputType. 20 (WebCore::BaseDateAndTimeInputType::shouldRespectListAttribute): 21 Added. This is necessary for <datalist> support. TextFieldInputType has 22 the same code. 23 (WebCore::BaseDateAndTimeInputType::valueMissing): 24 Added. This is necessary for validity.valueMissing. TextFieldInputType 25 has the same code. 26 27 * html/BaseChooserOnlyDateAndTimeInputType.cpp: 28 Remove unnecessary functions which cancel TextFieldInputType behavior. 29 * html/BaseChooserOnlyDateAndTimeInputType.h: 30 (BaseChooserOnlyDateAndTimeInputType): Remove declarations for them. 31 32 * html/BaseMultipleFieldsDateAndTimeInputType.cpp: 33 Remove unnecessary functions which cancel TextFieldInputType behavior. 34 * html/BaseMultipleFieldsDateAndTimeInputType.h: 35 (BaseMultipleFieldsDateAndTimeInputType): 36 Add SpinButtonOwner interface. We didn't need it because 37 TextFieldInputType implements it. 38 1 39 2013-01-11 Mary Wu <mary.wu@torchmobile.com.cn> 2 40 -
trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp
r137124 r139424 58 58 return; 59 59 m_dateTimeChooser = chrome->openDateTimeChooser(this, parameters); 60 }61 62 RenderObject* BaseChooserOnlyDateAndTimeInputType::createRenderer(RenderArena* arena, RenderStyle* style) const63 {64 // Cancel the override by TextFieldInputType.65 // FIXME: Remove this function when we stop inheriting TextFieldInputType.66 return InputType::createRenderer(arena, style);67 }68 69 void BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue()70 {71 // Cancel the override by TextFieldInputType.72 // FIXME: Remove this function when we stop inheriting TextFieldInputType.73 }74 75 void BaseChooserOnlyDateAndTimeInputType::forwardEvent(Event*)76 {77 // Cancel the override by TextFieldInputType.78 // FIXME: Remove this function when we stop inheriting TextFieldInputType.79 60 } 80 61 -
trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h
r134036 r139424 45 45 46 46 // InputType functions: 47 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE;48 virtual void updateInnerTextValue() OVERRIDE;49 void forwardEvent(Event*) OVERRIDE;50 47 virtual void createShadowSubtree() OVERRIDE; 51 48 virtual void detach() OVERRIDE; -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp
r135829 r139424 97 97 } 98 98 99 void BaseDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event)100 {101 if (shouldHaveSpinButton())102 handleKeydownEventForSpinButton(event);103 if (!event->defaultHandled())104 TextFieldInputType::handleKeydownEvent(event);105 }106 107 99 Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const 108 100 { … … 167 159 } 168 160 169 String BaseDateAndTimeInputType::convertFromVisibleValue(const String& visibleValue) const170 {171 // convertFromVisibleValue is used in the textfield UI. Though this class172 // inherits TextFieldInputType, users are unable to edit visible values, and173 // this function is never called.174 ASSERT_NOT_REACHED();175 return visibleValue;176 }177 178 161 String BaseDateAndTimeInputType::sanitizeValue(const String& proposedValue) const 179 162 { … … 186 169 } 187 170 171 bool BaseDateAndTimeInputType::shouldRespectListAttribute() 172 { 173 return InputType::themeSupportsDataListUI(this); 174 } 175 176 bool BaseDateAndTimeInputType::valueMissing(const String& value) const 177 { 178 return element()->isRequired() && value.isEmpty(); 179 } 180 188 181 } // namespace WebCore 189 182 #endif -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.h
r135829 r139424 34 34 #if ENABLE(DATE_AND_TIME_INPUT_TYPES) 35 35 #include "DateComponents.h" 36 #include " TextFieldInputType.h"36 #include "InputType.h" 37 37 #include <wtf/unicode/Unicode.h> 38 38 … … 40 40 41 41 // A super class of date, datetime, datetime-local, month, time, and week types. 42 // FIXME: Don't inherit TextFieldInputType. webkit.org/b/100935 43 class BaseDateAndTimeInputType : public TextFieldInputType { 42 class BaseDateAndTimeInputType : public InputType { 44 43 protected: 45 BaseDateAndTimeInputType(HTMLInputElement* element) : TextFieldInputType(element) { } 46 virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE; 44 BaseDateAndTimeInputType(HTMLInputElement* element) : InputType(element) { } 47 45 virtual Decimal parseToNumber(const String&, const Decimal&) const OVERRIDE; 48 46 virtual bool parseToDateComponents(const String&, DateComponents*) const OVERRIDE; … … 62 60 virtual bool typeMismatchFor(const String&) const OVERRIDE; 63 61 virtual bool typeMismatch() const OVERRIDE; 62 virtual bool valueMissing(const String&) const OVERRIDE; 64 63 virtual Decimal defaultValueForStepUp() const OVERRIDE; 65 64 virtual bool isSteppable() const OVERRIDE; 66 65 virtual String serializeWithMilliseconds(double) const; 67 66 virtual String localizeValue(const String&) const OVERRIDE; 68 virtual String convertFromVisibleValue(const String&) const OVERRIDE;69 67 virtual bool supportsReadOnly() const OVERRIDE; 68 virtual bool shouldRespectListAttribute() OVERRIDE; 70 69 }; 71 70 -
trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp
r138254 r139424 182 182 } 183 183 184 RenderObject* BaseMultipleFieldsDateAndTimeInputType::createRenderer(RenderArena* arena, RenderStyle* style) const185 {186 return InputType::createRenderer(arena, style);187 }188 189 184 void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree() 190 185 { … … 313 308 } 314 309 315 bool BaseMultipleFieldsDateAndTimeInputType::isTextField() const316 {317 return false;318 }319 320 310 void BaseMultipleFieldsDateAndTimeInputType::restoreFormControlState(const FormControlState& state) 321 311 { -
trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h
r138254 r139424 43 43 struct DateTimeChooserParameters; 44 44 45 class BaseMultipleFieldsDateAndTimeInputType : public BaseDateAndTimeInputType, protected DateTimeEditElement::EditControlOwner, protected PickerIndicatorElement::PickerIndicatorOwner { 45 class BaseMultipleFieldsDateAndTimeInputType 46 : public BaseDateAndTimeInputType 47 , protected DateTimeEditElement::EditControlOwner 48 , protected PickerIndicatorElement::PickerIndicatorOwner 49 , protected SpinButtonElement::SpinButtonOwner { 46 50 protected: 47 51 BaseMultipleFieldsDateAndTimeInputType(HTMLInputElement*); … … 75 79 virtual String badInputText() const OVERRIDE; 76 80 virtual void blur() OVERRIDE FINAL; 77 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE FINAL;78 81 virtual void createShadowSubtree() OVERRIDE FINAL; 79 82 virtual void destroyShadowSubtree() OVERRIDE FINAL; … … 86 89 virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE FINAL; 87 90 virtual bool isMouseFocusable() const OVERRIDE FINAL; 88 virtual bool isTextField() const OVERRIDE FINAL;89 91 virtual void minOrMaxAttributeChanged() OVERRIDE FINAL; 90 92 virtual void readonlyAttributeChanged() OVERRIDE FINAL;
Note: See TracChangeset
for help on using the changeset viewer.