Changeset 87371 in webkit
- Timestamp:
- May 26, 2011 2:10:51 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r87368 r87371 1 2011-05-26 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Fix a bug that <input type="number"> dispatches two blurs when tabbing 6 from an invalid number 7 https://bugs.webkit.org/show_bug.cgi?id=59071 8 9 * fast/forms/input-number-blur-twice-expected.txt: Added. 10 * fast/forms/input-number-blur-twice.html: Added. 11 1 12 2011-05-26 Shane Stephens <shanestephens@google.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r87370 r87371 1 2011-05-26 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Fix a bug that <input type="number"> dispatches two blurs when tabbing 6 from an invalid number 7 https://bugs.webkit.org/show_bug.cgi?id=59071 8 9 NumberInputType::handleBlurEvent() dispatched an extra focus event 10 and an extra blur event because 11 SelectionController::textWillBeReplaced() called by 12 RenderTextControlSingleLine::updateFromElement() focuses a node 13 with the selection. 14 15 In order to avoid this problem, 16 - Introduce Node::willBlur() 17 It is called before any state changes by a blur event. 18 - Call RenderTextControlSingleLine::updateFromElement() in willBlur() 19 It avoids extra focus/blur events because Document::m_focusedNode is 20 still the number input during willBlur(). 21 22 Test: fast/forms/input-number-blur-twice.html 23 24 * dom/Document.cpp: 25 (WebCore::Document::setFocusedNode): Calls Node::beforeBlueEvent(). 26 * dom/Node.cpp: 27 (WebCore::Node::willBlur): 28 Default empty implementation of willBlur(). 29 * dom/Node.h: Declare willBlur(). 30 * html/HTMLInputElement.cpp: 31 (WebCore::HTMLInputElement::willBlur): 32 Added. It just calls InputType::willBlur(). 33 (WebCore::HTMLInputElement::handleBlurEvent): 34 Removed InputType::handleBlurEvent() call. 35 * html/HTMLInputElement.h: Declare willBlur(). 36 * html/InputType.cpp: 37 (WebCore::InputType::willBlur): Default empty implementation. 38 (WebCore::InputType::handleBlurEvent): Removed. 39 * html/InputType.h: Declare willBlur(), remove handleBlurEvent(). 40 * html/NumberInputType.cpp: 41 (WebCore::NumberInputType::willBlur): 42 Move the code in handleBlurEvent() here. 43 * html/NumberInputType.h: Declare willBlur(). 44 1 45 2011-05-25 Hans Wennborg <hans@chromium.org> 2 46 -
trunk/Source/WebCore/dom/Document.cpp
r87322 r87371 3221 3221 bool focusChangeBlocked = false; 3222 3222 RefPtr<Node> oldFocusedNode = m_focusedNode; 3223 m_focusedNode = 0;3224 3223 3225 3224 // Remove focus from the existing focus node (if any) 3226 if (oldFocusedNode && !oldFocusedNode->inDetach()) { 3225 if (oldFocusedNode && !oldFocusedNode->inDetach()) { 3226 // willBlur() should be called before any status changes. 3227 oldFocusedNode->willBlur(); 3228 m_focusedNode = 0; 3227 3229 if (oldFocusedNode->active()) 3228 3230 oldFocusedNode->setActive(false); … … 3269 3271 view()->setFocus(false); 3270 3272 } 3271 } 3273 } else 3274 m_focusedNode = 0; 3272 3275 3273 3276 if (newFocusedNode) { -
trunk/Source/WebCore/dom/Node.cpp
r87227 r87371 2732 2732 } 2733 2733 2734 void Node::willBlur() 2735 { 2736 } 2737 2734 2738 void Node::dispatchBlurEvent() 2735 2739 { -
trunk/Source/WebCore/dom/Node.h
r87227 r87371 556 556 557 557 virtual void dispatchFocusEvent(); 558 virtual void willBlur(); 558 559 virtual void dispatchBlurEvent(); 559 560 virtual void dispatchChangeEvent(); -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r87125 r87371 497 497 } 498 498 499 void HTMLInputElement::willBlur() 500 { 501 m_inputType->willBlur(); 502 HTMLTextFormControlElement::willBlur(); 503 } 504 499 505 void HTMLInputElement::handleBlurEvent() 500 506 { 501 m_inputType->handleBlurEvent();502 503 507 if (!isTextField()) 504 508 return; -
trunk/Source/WebCore/html/HTMLInputElement.h
r87125 r87371 302 302 virtual bool isEmptySuggestedValue() const { return suggestedValue().isEmpty(); } 303 303 virtual void handleFocusEvent(); 304 virtual void willBlur(); 304 305 virtual void handleBlurEvent(); 305 306 virtual int cachedSelectionStart() const { return m_cachedSelectionStart; } -
trunk/Source/WebCore/html/InputType.cpp
r87274 r87371 411 411 } 412 412 413 void InputType:: handleBlurEvent()413 void InputType::willBlur() 414 414 { 415 415 } -
trunk/Source/WebCore/html/InputType.h
r87274 r87371 179 179 virtual bool isKeyboardFocusable() const; 180 180 virtual bool shouldUseInputMethod() const; 181 virtual void handleBlurEvent();181 virtual void willBlur(); 182 182 virtual void accessKeyAction(bool sendToAnyElement); 183 183 virtual bool canBeSuccessfulSubmitButton(); -
trunk/Source/WebCore/html/NumberInputType.cpp
r84695 r87371 212 212 } 213 213 214 void NumberInputType:: handleBlurEvent()214 void NumberInputType::willBlur() 215 215 { 216 216 // Reset the renderer value, which might be unmatched with the element value. -
trunk/Source/WebCore/html/NumberInputType.h
r84695 r87371 64 64 virtual String serialize(double) const; 65 65 virtual double acceptableError(double) const; 66 virtual void handleBlurEvent();66 virtual void willBlur(); 67 67 virtual String visibleValue() const; 68 68 virtual String convertFromVisibleValue(const String&) const;
Note: See TracChangeset
for help on using the changeset viewer.