Changeset 81978 in webkit
- Timestamp:
- Mar 25, 2011 12:08:27 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r81976 r81978 1 2011-03-25 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Text field "onchange" event is triggered if actual value unchanged 6 https://bugs.webkit.org/show_bug.cgi?id=36314 7 8 Add tests for text field change events. 9 10 * fast/events/onchange-text-form-field-expected.txt: Added. 11 * fast/events/onchange-text-form-field.html: Added. 12 1 13 2011-03-25 Jessie Berlin <jberlin@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r81977 r81978 1 2011-03-25 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Text field "onchange" event is triggered if actual value unchanged 6 https://bugs.webkit.org/show_bug.cgi?id=36314 7 8 Change RenderTextControl::subtreeHasChanged to only return true if the 9 subtree has changed since the last event was triggered. 10 11 * html/HTMLFormControlElement.cpp: 12 (WebCore::HTMLTextFormControlElement::insertedIntoDocument): 13 (WebCore::HTMLTextFormControlElement::dispatchFormControlChangeEvent): 14 * html/HTMLFormControlElement.h: 15 (WebCore::HTMLTextFormControlElement::setTextAsOfLastFormControlChangeEvent): 16 * html/HTMLInputElement.cpp: 17 (WebCore::HTMLInputElement::setChecked): 18 (WebCore::HTMLInputElement::setValue): 19 * html/HTMLTextAreaElement.cpp: 20 (WebCore::HTMLTextAreaElement::setValue): 21 (WebCore::HTMLTextAreaElement::setNonDirtyValue): 22 1 23 2011-03-25 Brent Fulgham <bfulgham@webkit.org> 2 24 -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r81947 r81978 548 548 } 549 549 550 void HTMLTextFormControlElement::insertedIntoDocument() 551 { 552 HTMLFormControlElement::insertedIntoDocument(); 553 setTextAsOfLastFormControlChangeEvent(value()); 554 } 555 550 556 void HTMLTextFormControlElement::dispatchFocusEvent() 551 557 { … … 630 636 } 631 637 638 void HTMLTextFormControlElement::dispatchFormControlChangeEvent() 639 { 640 if (m_textAsOfLastFormControlChangeEvent != value()) { 641 HTMLElement::dispatchChangeEvents(); 642 setTextAsOfLastFormControlChangeEvent(value()); 643 } 644 setChangedSinceLastFormControlChangeEvent(false); 645 } 646 632 647 void HTMLTextFormControlElement::setSelectionRange(int start, int end) 633 648 { -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r80412 r81978 195 195 virtual ~HTMLTextFormControlElement(); 196 196 197 virtual void insertedIntoDocument(); 198 197 199 // The derived class should return true if placeholder processing is needed. 198 200 virtual bool supportsPlaceholder() const = 0; … … 208 210 PassRefPtr<Range> selection() const; 209 211 212 virtual void dispatchFormControlChangeEvent(); 213 210 214 virtual int maxLength() const = 0; 211 215 virtual String value() const = 0; … … 217 221 218 222 virtual void parseMappedAttribute(Attribute*); 223 virtual void setTextAsOfLastFormControlChangeEvent(String text) { m_textAsOfLastFormControlChangeEvent = text; } 219 224 220 225 private: … … 237 242 238 243 RenderTextControl* textRendererAfterUpdateLayout(); 244 245 String m_textAsOfLastFormControlChangeEvent; 239 246 }; 240 247 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r81652 r81978 791 791 // because it says only to fire change events at "lose focus" time, which is 792 792 // definitely wrong in practice for these types of elements. 793 if (sendChangeEvent && inDocument() && m_inputType->shouldSendChangeEventAfterCheckedChanged()) 793 if (sendChangeEvent && inDocument() && m_inputType->shouldSendChangeEventAfterCheckedChanged()) { 794 setTextAsOfLastFormControlChangeEvent(String()); 794 795 dispatchFormControlChangeEvent(); 796 } 795 797 } 796 798 … … 912 914 dispatchFormControlChangeEvent(); 913 915 } 916 917 if (isText() && (!focused() || !sendChangeEvent)) 918 setTextAsOfLastFormControlChangeEvent(value); 914 919 915 920 InputElement::notifyFormStateChanged(this); -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r81263 r81978 292 292 m_isDirty = true; 293 293 setNeedsValidityCheck(); 294 setTextAsOfLastFormControlChangeEvent(value); 294 295 } 295 296 … … 299 300 m_isDirty = false; 300 301 setNeedsValidityCheck(); 302 setTextAsOfLastFormControlChangeEvent(value); 301 303 } 302 304
Note: See TracChangeset
for help on using the changeset viewer.