Changeset 150801 in webkit
- Timestamp:
- May 28, 2013 7:01:20 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150799 r150801 1 2013-05-28 Andreas Kling <akling@apple.com> 2 3 Move dispatching of focus-related events from Node to Element. 4 <http://webkit.org/b/116864> 5 6 Reviewed by Antti Koivisto. 7 8 ...and pass around pointers to Element instead of Node. 9 10 * dom/Node.cpp: 11 * dom/Node.h: 12 * dom/Element.h: 13 * dom/Element.cpp: 14 (WebCore::Element::dispatchFocusInEvent): 15 (WebCore::Element::dispatchFocusOutEvent): 16 (WebCore::Element::dispatchFocusEvent): 17 (WebCore::Element::dispatchBlurEvent): 18 19 Moved here from Node. 20 21 * html/HTMLFormControlElement.h: 22 * html/HTMLFormControlElement.cpp: 23 (WebCore::HTMLFormControlElement::dispatchBlurEvent): 24 * html/HTMLSelectElement.h: 25 * html/HTMLSelectElement.cpp: 26 (WebCore::HTMLSelectElement::dispatchFocusEvent): 27 (WebCore::HTMLSelectElement::dispatchBlurEvent): 28 * html/HTMLTextFormControlElement.h: 29 * html/HTMLTextFormControlElement.cpp: 30 (WebCore::HTMLTextFormControlElement::dispatchFocusEvent): 31 (WebCore::HTMLTextFormControlElement::dispatchBlurEvent): 32 33 Update subclass overrides and sprinkle OVERRIDE/FINAL. 34 1 35 2013-05-28 Zan Dobersek <zdobersek@igalia.com> 2 36 -
trunk/Source/WebCore/dom/Element.cpp
r150796 r150801 47 47 #include "FlowThreadController.h" 48 48 #include "FocusController.h" 49 #include "FocusEvent.h" 49 50 #include "Frame.h" 50 51 #include "FrameSelection.h" … … 2159 2160 } 2160 2161 2162 void Element::dispatchFocusInEvent(const AtomicString& eventType, PassRefPtr<Element> oldFocusedElement) 2163 { 2164 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); 2165 ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent); 2166 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, oldFocusedElement))); 2167 } 2168 2169 void Element::dispatchFocusOutEvent(const AtomicString& eventType, PassRefPtr<Element> newFocusedElement) 2170 { 2171 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); 2172 ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent); 2173 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, newFocusedElement))); 2174 } 2175 2176 void Element::dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection) 2177 { 2178 if (document()->page()) 2179 document()->page()->chrome().client()->elementDidFocus(this); 2180 2181 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, oldFocusedElement); 2182 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release())); 2183 } 2184 2185 void Element::dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) 2186 { 2187 if (document()->page()) 2188 document()->page()->chrome().client()->elementDidBlur(this); 2189 2190 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, newFocusedElement); 2191 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release())); 2192 } 2193 2194 2161 2195 String Element::innerText() 2162 2196 { -
trunk/Source/WebCore/dom/Element.h
r150744 r150801 637 637 638 638 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook); 639 void dispatchFocusInEvent(const AtomicString& eventType, PassRefPtr<Element> oldFocusedElement); 640 void dispatchFocusOutEvent(const AtomicString& eventType, PassRefPtr<Element> newFocusedElement); 641 virtual void dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection); 642 virtual void dispatchBlurEvent(PassRefPtr<Element> newFocusedElement); 639 643 640 644 protected: -
trunk/Source/WebCore/dom/Node.cpp
r150796 r150801 61 61 #include "ExceptionCode.h" 62 62 #include "ExceptionCodePlaceholder.h" 63 #include "FocusEvent.h"64 63 #include "Frame.h" 65 64 #include "FrameView.h" … … 2299 2298 } 2300 2299 2301 void Node::dispatchFocusInEvent(const AtomicString& eventType, PassRefPtr<Node> oldFocusedNode)2302 {2303 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());2304 ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);2305 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, oldFocusedNode)));2306 }2307 2308 void Node::dispatchFocusOutEvent(const AtomicString& eventType, PassRefPtr<Node> newFocusedNode)2309 {2310 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());2311 ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);2312 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, newFocusedNode)));2313 }2314 2315 2300 bool Node::dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent) 2316 2301 { … … 2364 2349 { 2365 2350 return EventDispatcher::dispatchEvent(this, WheelEventDispatchMediator::create(event, document()->defaultView())); 2366 }2367 2368 void Node::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirection)2369 {2370 if (document()->page())2371 document()->page()->chrome().client()->elementDidFocus(this);2372 2373 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, oldFocusedNode);2374 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release()));2375 }2376 2377 void Node::dispatchBlurEvent(PassRefPtr<Node> newFocusedNode)2378 {2379 if (document()->page())2380 document()->page()->chrome().client()->elementDidBlur(this);2381 2382 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, newFocusedNode);2383 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release()));2384 2351 } 2385 2352 -
trunk/Source/WebCore/dom/Node.h
r150783 r150801 28 28 #include "EditingBoundary.h" 29 29 #include "EventTarget.h" 30 #include "FocusDirection.h"31 30 #include "KURLHash.h" 32 31 #include "LayoutRect.h" … … 604 603 void dispatchSubtreeModifiedEvent(); 605 604 bool dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent); 606 void dispatchFocusInEvent(const AtomicString& eventType, PassRefPtr<Node> oldFocusedNode);607 void dispatchFocusOutEvent(const AtomicString& eventType, PassRefPtr<Node> newFocusedNode);608 605 609 606 bool dispatchKeyEvent(const PlatformKeyboardEvent&); … … 619 616 bool dispatchBeforeLoadEvent(const String& sourceURL); 620 617 621 virtual void dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirection);622 virtual void dispatchBlurEvent(PassRefPtr<Node> newFocusedNode);623 618 virtual void dispatchChangeEvent(); 624 619 virtual void dispatchInputEvent(); -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r150711 r150801 457 457 } 458 458 459 void HTMLFormControlElement::dispatchBlurEvent(PassRefPtr< Node> newFocusedNode)460 { 461 HTMLElement::dispatchBlurEvent(newFocused Node);459 void HTMLFormControlElement::dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) 460 { 461 HTMLElement::dispatchBlurEvent(newFocusedElement); 462 462 hideVisibleValidationMessage(); 463 463 } -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r150711 r150801 122 122 virtual void didRecalcStyle(StyleChange) OVERRIDE; 123 123 124 virtual void dispatchBlurEvent(PassRefPtr< Node> newFocusedNode);124 virtual void dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) OVERRIDE; 125 125 126 126 // This must be called any time the result of willValidate() has changed. -
trunk/Source/WebCore/html/HTMLSelectElement.cpp
r150102 r150801 906 906 } 907 907 908 void HTMLSelectElement::dispatchFocusEvent(PassRefPtr< Node> oldFocusedNode, FocusDirection direction)908 void HTMLSelectElement::dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection direction) 909 909 { 910 910 // Save the selection so it can be compared to the new selection when … … 912 912 if (usesMenuList()) 913 913 saveLastSelection(); 914 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocused Node, direction);915 } 916 917 void HTMLSelectElement::dispatchBlurEvent(PassRefPtr< Node> newFocusedNode)914 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, direction); 915 } 916 917 void HTMLSelectElement::dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) 918 918 { 919 919 // We only need to fire change events here for menu lists, because we fire … … 922 922 if (usesMenuList()) 923 923 dispatchChangeEventForMenuList(); 924 HTMLFormControlElementWithState::dispatchBlurEvent(newFocused Node);924 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement); 925 925 } 926 926 -
trunk/Source/WebCore/html/HTMLSelectElement.h
r150692 r150801 115 115 virtual bool isMouseFocusable() const OVERRIDE; 116 116 117 virtual void dispatchFocusEvent(PassRefPtr< Node> oldFocusedNode, FocusDirection) OVERRIDE;118 virtual void dispatchBlurEvent(PassRefPtr< Node> newFocusedNode);117 virtual void dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection) OVERRIDE FINAL; 118 virtual void dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) OVERRIDE FINAL; 119 119 120 120 virtual bool canStartSelection() const { return false; } -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r150796 r150801 86 86 } 87 87 88 void HTMLTextFormControlElement::dispatchFocusEvent(PassRefPtr< Node> oldFocusedNode, FocusDirection direction)88 void HTMLTextFormControlElement::dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection direction) 89 89 { 90 90 if (supportsPlaceholder()) 91 91 updatePlaceholderVisibility(false); 92 handleFocusEvent(oldFocused Node.get(), direction);93 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocused Node, direction);94 } 95 96 void HTMLTextFormControlElement::dispatchBlurEvent(PassRefPtr< Node> newFocusedNode)92 handleFocusEvent(oldFocusedElement.get(), direction); 93 HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, direction); 94 } 95 96 void HTMLTextFormControlElement::dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) 97 97 { 98 98 if (supportsPlaceholder()) 99 99 updatePlaceholderVisibility(false); 100 100 handleBlurEvent(); 101 HTMLFormControlElementWithState::dispatchBlurEvent(newFocused Node);101 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement); 102 102 } 103 103 -
trunk/Source/WebCore/html/HTMLTextFormControlElement.h
r150711 r150801 117 117 TextFieldSelectionDirection computeSelectionDirection() const; 118 118 119 virtual void dispatchFocusEvent(PassRefPtr< Node> oldFocusedNode, FocusDirection) OVERRIDE;120 virtual void dispatchBlurEvent(PassRefPtr< Node> newFocusedNode);119 virtual void dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection) OVERRIDE FINAL; 120 virtual void dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) OVERRIDE FINAL; 121 121 virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE; 122 122
Note: See TracChangeset
for help on using the changeset viewer.