Changeset 108051 in webkit
- Timestamp:
- Feb 17, 2012, 1:22:41 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r108050 r108051 1 2012-02-17 Yosifumi Inoue <yosin@chromium.org> 2 3 [Forms] Integrate InputType::dispatchChangeEventInResponseToSetValue into InputType::setValue 4 https://bugs.webkit.org/show_bug.cgi?id=78873 5 6 Reviewed by Kent Tamura. 7 8 This patch moves event dispatch logic to InputType and TextFieldInputType from HTMLInputElement 9 and merge dispatchChangeEventInResponseToSetValue to setValue. 10 11 No new tests. No change in behavior. 12 13 * html/HTMLInputElement.cpp: 14 (WebCore::HTMLInputElement::setValue): Move dispatch logic to InputType and TextFieldInput. 15 * html/InputType.cpp: Remove dispatchChangeEventInResponseToSetValue implementation. 16 * html/InputType.h: Remove dispatchChangeEventInResponseToSetValue declaration. 17 (WebCore::InputType::setValue): Move code from dispatchChangeEventInResponseToSetValue. 18 * html/TextFieldInputType.cpp: Remove dispatchChangeEventInResponseToSetValue implementation. 19 * html/TextFieldInputType.h: Remove dispatchChangeEventInResponseToSetValue declaration. 20 (WebCore::TextFieldInputType::setValue): Move code from dispatchChangeEventInResponseToSetValue. Stop dispatching event in InputType::setValue. 21 * html/HTMLTextFormControlElement.h: Make setTextAsOfLastFormControlChangeEvent to public from protected for accessing from InputType class. 22 1 23 2012-02-17 Yury Semikhatsky <yurys@chromium.org> 2 24 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r107706 r108051 1044 1044 return; 1045 1045 1046 if (eventBehavior != DispatchNoEvent)1047 m_inputType->dispatchChangeEventInResponseToSetValue();1048 1049 // FIXME: Why do we do this when eventBehavior == DispatchNoEvent1050 if (isTextField() && (!focused() || eventBehavior == DispatchNoEvent))1051 setTextAsOfLastFormControlChangeEvent(value);1052 1053 1046 notifyFormStateChanged(); 1054 1047 } -
trunk/Source/WebCore/html/HTMLTextFormControlElement.h
r107555 r108051 83 83 String directionForFormData() const; 84 84 85 void setTextAsOfLastFormControlChangeEvent(const String& text) { m_textAsOfLastFormControlChangeEvent = text; } 86 85 87 protected: 86 88 HTMLTextFormControlElement(const QualifiedName&, Document*, HTMLFormElement*); … … 89 91 virtual void parseAttribute(Attribute*) OVERRIDE; 90 92 91 void setTextAsOfLastFormControlChangeEvent(const String& text) { m_textAsOfLastFormControlChangeEvent = text; }92 93 93 void cacheSelection(int start, int end, TextFieldSelectionDirection direction) 94 94 { -
trunk/Source/WebCore/html/InputType.cpp
r107706 r108051 541 541 } 542 542 543 void InputType::setValue(const String& sanitizedValue, bool , TextFieldEventBehavior eventBehavior)543 void InputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior) 544 544 { 545 545 element()->setValueInternal(sanitizedValue, eventBehavior); 546 546 element()->setNeedsStyleRecalc(); 547 } 548 549 void InputType::dispatchChangeEventInResponseToSetValue() 550 { 551 element()->dispatchFormControlChangeEvent(); 547 if (valueChanged && eventBehavior != DispatchNoEvent) 548 element()->dispatchFormControlChangeEvent(); 552 549 } 553 550 -
trunk/Source/WebCore/html/InputType.h
r107555 r108051 228 228 virtual bool storesValueSeparateFromAttribute(); 229 229 virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior); 230 virtual void dispatchChangeEventInResponseToSetValue();231 230 virtual bool shouldResetOnDocumentActivation(); 232 231 virtual bool shouldRespectListAttribute(); -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r107706 r108051 81 81 void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior) 82 82 { 83 InputType::setValue(sanitizedValue, valueChanged, eventBehavior); 83 // We don't ask InputType::setValue to dispatch events because 84 // TextFieldInputType dispatches events different way from InputType. 85 InputType::setValue(sanitizedValue, valueChanged, DispatchNoEvent); 84 86 85 87 if (valueChanged) … … 91 93 else 92 94 element()->cacheSelectionInResponseToSetValue(max); 93 } 94 95 void TextFieldInputType::dispatchChangeEventInResponseToSetValue() 96 { 97 // If the user is still editing this field, dispatch an input event rather than a change event. 98 // The change event will be dispatched when editing finishes. 99 if (element()->focused()) { 100 element()->dispatchFormControlInputEvent(); 101 return; 102 } 103 InputType::dispatchChangeEventInResponseToSetValue(); 95 96 if (!valueChanged) 97 return; 98 99 if (eventBehavior != DispatchNoEvent) { 100 // If the user is still editing this field, dispatch an input event rather than a change event. 101 // The change event will be dispatched when editing finishes. 102 if (element()->focused()) 103 element()->dispatchFormControlInputEvent(); 104 else 105 element()->dispatchFormControlChangeEvent(); 106 } 107 108 // FIXME: Why do we do this when eventBehavior == DispatchNoEvent 109 if (!element()->focused() || eventBehavior == DispatchNoEvent) 110 element()->setTextAsOfLastFormControlChangeEvent(sanitizedValue); 104 111 } 105 112 -
trunk/Source/WebCore/html/TextFieldInputType.h
r107555 r108051 75 75 virtual bool shouldUseInputMethod() const OVERRIDE; 76 76 virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE; 77 virtual void dispatchChangeEventInResponseToSetValue() OVERRIDE;78 77 virtual String sanitizeValue(const String&) const OVERRIDE; 79 78 virtual bool shouldRespectListAttribute() OVERRIDE;
Note:
See TracChangeset
for help on using the changeset viewer.