Changeset 91353 in webkit
- Timestamp:
- Jul 20, 2011, 3:23:42 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/spin-button-gets-disabled-or-readonly-expected.txt (added)
-
LayoutTests/fast/forms/spin-button-gets-disabled-or-readonly.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLInputElement.cpp (modified) (1 diff)
-
Source/WebCore/html/InputType.cpp (modified) (1 diff)
-
Source/WebCore/html/InputType.h (modified) (1 diff)
-
Source/WebCore/html/TextFieldInputType.cpp (modified) (1 diff)
-
Source/WebCore/html/TextFieldInputType.h (modified) (3 diffs)
-
Source/WebCore/html/shadow/TextControlInnerElements.cpp (modified) (2 diffs)
-
Source/WebCore/html/shadow/TextControlInnerElements.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91352 r91353 1 2011-07-20 Kentaro Hara <haraken@google.com> 2 3 The value of a number input form continues to increase/decrease even if we disable the input form. 4 https://bugs.webkit.org/show_bug.cgi?id=64786 5 6 Reviewed by Kent Tamura. 7 8 The value of the number input form continues to increase/decrease in the following scenario: 9 (1) Click the spin button of the number input form. 10 (2) Hook the 'mouseup' event and disable the number input form. 11 (3) Enable the number input form after some delay (e.g. 50ms). 12 13 What is happening above is as follows: 14 (1) When the 'mousedown' event happens, the repeating timer of the spin button starts. 15 (2) If the input form is not disabled, the repeating timer stops at the 'mouseup' event. 16 However, if the input form is disabled, the 'mouseup' event is ignored, failing to stop 17 the repeating timer. 18 (3) The value continues to increase/decrease, since the repeating timer is still working. 19 20 The added test checks if the value does not continue to increase/decrease when we do the above operation. 21 22 * fast/forms/spin-button-gets-disabled-or-readonly-expected.txt: Added. 23 * fast/forms/spin-button-gets-disabled-or-readonly.html: Added. 24 1 25 2011-07-20 Kent Tamura <tkent@chromium.org> 2 26 -
trunk/Source/WebCore/ChangeLog
r91349 r91353 1 2011-07-20 Kentaro Hara <haraken@google.com> 2 3 The value of a number input form continues to increase/decrease even if we disable the input form. 4 https://bugs.webkit.org/show_bug.cgi?id=64786 5 6 Reviewed by Kent Tamura. 7 8 The value of the number input form continues to increase/decrease in the following scenario: 9 (1) Click the spin button of the input form. 10 (2) Hook the 'mouseup' event and disable the input form. 11 (3) Enable the input form after some delay (e.g. 50ms). 12 13 What is happening above is as follows: 14 (1) When the 'mousedown' event happens, the repeating timer of the spin button starts. 15 (2) If the input form is not disabled, the repeating timer stops at the 'mouseup' event. 16 However, if the input form is disabled, the 'mouseup' event is ignored, failing to stop 17 the repeating timer. 18 (3) The value continues to increase/decrease, since the repeating timer is still working. 19 20 This patch stops the repeating timer when the input form gets disabled or readonly. 21 22 Test: fast/forms/spin-button-gets-disabled-or-readonly.html 23 24 * html/HTMLInputElement.cpp: 25 (WebCore::HTMLInputElement::parseMappedAttribute): Calls disabledAttributeChanged() when 'disabled' attribute gets changed. Calls readonlyAttributeChanged() when 'readonly' attribute gets changed. 26 * html/InputType.cpp: 27 (WebCore::InputType::disabledAttributeChanged): Stops the repeating timer and releases mouse capturing. 28 (WebCore::InputType::readonlyAttributeChanged): Ditto. 29 * html/InputType.h: 30 * html/TextFieldInputType.cpp: 31 (WebCore::TextFieldInputType::disabledAttributeChanged): Ditto. 32 (WebCore::TextFieldInputType::readonlyAttributeChanged): Ditto. 33 * html/TextFieldInputType.h: 34 * html/shadow/TextControlInnerElements.cpp: 35 (WebCore::SpinButtonElement::detach): Replased the code with releaseCapture(). 36 (WebCore::SpinButtonElement::defaultEventHandler): Ditto. 37 (WebCore::SpinButtonElement::releaseCapture): Stops the repeating timer and releases mouse capturing. 38 * html/shadow/TextControlInnerElements.h: 39 1 40 2011-07-20 Sheriff Bot <webkit.review.bot@gmail.com> 2 41 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r91049 r91353 790 790 } else if (attr->name() == patternAttr || attr->name() == precisionAttr || attr->name() == stepAttr) 791 791 setNeedsValidityCheck(); 792 else if (attr->name() == disabledAttr) { 793 m_inputType->disabledAttributeChanged(); 794 HTMLTextFormControlElement::parseMappedAttribute(attr); 795 } else if (attr->name() == readonlyAttr) { 796 m_inputType->readonlyAttributeChanged(); 797 HTMLTextFormControlElement::parseMappedAttribute(attr); 798 } 792 799 #if ENABLE(DATALIST) 793 800 else if (attr->name() == listAttr) -
trunk/Source/WebCore/html/InputType.cpp
r90971 r91353 674 674 } 675 675 676 void InputType::disabledAttributeChanged() 677 { 678 } 679 680 void InputType::readonlyAttributeChanged() 681 { 682 } 683 676 684 namespace InputTypeNames { 677 685 -
trunk/Source/WebCore/html/InputType.h
r90971 r91353 230 230 virtual void updatePlaceholderText(); 231 231 virtual void multipleAttributeChanged(); 232 virtual void disabledAttributeChanged(); 233 virtual void readonlyAttributeChanged(); 232 234 233 235 // Parses the specified string for the type, and return -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r91014 r91353 239 239 } 240 240 241 void TextFieldInputType::disabledAttributeChanged() 242 { 243 if (m_innerSpinButton) 244 m_innerSpinButton->releaseCapture(); 245 } 246 247 void TextFieldInputType::readonlyAttributeChanged() 248 { 249 if (m_innerSpinButton) 250 m_innerSpinButton->releaseCapture(); 251 } 252 241 253 bool TextFieldInputType::shouldUseInputMethod() const 242 254 { -
trunk/Source/WebCore/html/TextFieldInputType.h
r90971 r91353 36 36 namespace WebCore { 37 37 38 class SpinButtonElement; 39 38 40 // The class represents types of which UI contain text fields. 39 41 // It supports not only the types for BaseTextInputType but also type=number. … … 59 61 virtual void createShadowSubtree(); 60 62 virtual void destroyShadowSubtree(); 63 virtual void disabledAttributeChanged(); 64 virtual void readonlyAttributeChanged(); 61 65 62 66 private: … … 77 81 RefPtr<HTMLElement> m_innerText; 78 82 RefPtr<HTMLElement> m_placeholder; 79 RefPtr< HTMLElement> m_innerSpinButton;83 RefPtr<SpinButtonElement> m_innerSpinButton; 80 84 #if ENABLE(INPUT_SPEECH) 81 85 RefPtr<HTMLElement> m_speechButton; -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp
r90225 r91353 253 253 void SpinButtonElement::detach() 254 254 { 255 stopRepeatingTimer(); 256 if (m_capturing) { 257 if (Frame* frame = document()->frame()) { 258 frame->eventHandler()->setCapturingMouseEventsNode(0); 259 m_capturing = false; 260 } 261 } 255 releaseCapture(); 262 256 HTMLDivElement::detach(); 263 257 } … … 316 310 if (m_upDownState != oldUpDownState) 317 311 renderer()->repaint(); 318 } else { 319 if (m_capturing) { 320 stopRepeatingTimer(); 321 if (Frame* frame = document()->frame()) { 322 frame->eventHandler()->setCapturingMouseEventsNode(0); 323 m_capturing = false; 324 } 325 } 326 } 312 } else 313 releaseCapture(); 327 314 } 328 315 329 316 if (!event->defaultHandled()) 330 317 HTMLDivElement::defaultEventHandler(event); 318 } 319 320 void SpinButtonElement::releaseCapture() 321 { 322 stopRepeatingTimer(); 323 if (m_capturing) { 324 if (Frame* frame = document()->frame()) { 325 frame->eventHandler()->setCapturingMouseEventsNode(0); 326 m_capturing = false; 327 } 328 } 331 329 } 332 330 -
trunk/Source/WebCore/html/shadow/TextControlInnerElements.h
r90094 r91353 99 99 static PassRefPtr<SpinButtonElement> create(Document*); 100 100 UpDownState upDownState() const { return m_upDownState; } 101 virtual void releaseCapture(); 101 102 102 103 private:
Note:
See TracChangeset
for help on using the changeset viewer.