Changeset 142719 in webkit
- Timestamp:
- Feb 12, 2013 10:09:16 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142717 r142719 1 2013-02-12 Hayato Ito <hayato@chromium.org> 2 3 Use FocusEvent.relatedTarget in {FocusIn,FocusOut,Focus,Blur}EventDispatchMediator. 4 https://bugs.webkit.org/show_bug.cgi?id=109650 5 6 Reviewed by Dimitri Glazkov. 7 8 Set FocusEvent.relatedTarget in its constructor so that each 9 EventDispatchMediator can use FocusEvent.relatedTarget rather than 10 its redundant m_{old,new}FocusedNode member variable. 11 12 I've also removed FIXME comments, mentioning bug 109261, since I 13 can not reproduce the issue. 14 15 No new tests. No change in functionality. 16 17 * dom/FocusEvent.cpp: 18 (WebCore::FocusEventDispatchMediator::create): 19 (WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator): 20 (WebCore::FocusEventDispatchMediator::dispatchEvent): 21 (WebCore::BlurEventDispatchMediator::create): 22 (WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator): 23 (WebCore::BlurEventDispatchMediator::dispatchEvent): 24 (WebCore::FocusInEventDispatchMediator::create): 25 (WebCore::FocusInEventDispatchMediator::FocusInEventDispatchMediator): 26 (WebCore::FocusInEventDispatchMediator::dispatchEvent): 27 (WebCore::FocusOutEventDispatchMediator::create): 28 (WebCore::FocusOutEventDispatchMediator::FocusOutEventDispatchMediator): 29 (WebCore::FocusOutEventDispatchMediator::dispatchEvent): 30 * dom/FocusEvent.h: 31 (FocusEventDispatchMediator): 32 (BlurEventDispatchMediator): 33 (FocusInEventDispatchMediator): 34 (FocusOutEventDispatchMediator): 35 * dom/Node.cpp: 36 (WebCore::Node::dispatchFocusInEvent): 37 (WebCore::Node::dispatchFocusOutEvent): 38 (WebCore::Node::dispatchFocusEvent): 39 (WebCore::Node::dispatchBlurEvent): 40 1 41 2013-02-12 Takashi Sakamoto <tasak@google.com> 2 42 -
trunk/Source/WebCore/dom/FocusEvent.cpp
r142713 r142719 65 65 } 66 66 67 PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> oldFocusedNode)67 PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) 68 68 { 69 return adoptRef(new FocusEventDispatchMediator(focusEvent , oldFocusedNode));69 return adoptRef(new FocusEventDispatchMediator(focusEvent)); 70 70 } 71 71 72 FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> oldFocusedNode)72 FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) 73 73 : EventDispatchMediator(focusEvent) 74 , m_oldFocusedNode(oldFocusedNode)75 74 { 76 75 } … … 78 77 bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const 79 78 { 80 dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode);79 dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); 81 80 return EventDispatchMediator::dispatchEvent(dispatcher); 82 81 } 83 82 84 PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> newFocusedNode)83 PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) 85 84 { 86 return adoptRef(new BlurEventDispatchMediator(focusEvent , newFocusedNode));85 return adoptRef(new BlurEventDispatchMediator(focusEvent)); 87 86 } 88 87 89 BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> newFocusedNode)88 BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) 90 89 : EventDispatchMediator(focusEvent) 91 , m_newFocusedNode(newFocusedNode)92 90 { 93 91 } … … 95 93 bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const 96 94 { 97 dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);95 dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); 98 96 return EventDispatchMediator::dispatchEvent(dispatcher); 99 97 } 100 98 101 PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> oldFocusedNode)99 PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) 102 100 { 103 return adoptRef(new FocusInEventDispatchMediator(focusEvent , oldFocusedNode));101 return adoptRef(new FocusInEventDispatchMediator(focusEvent)); 104 102 } 105 103 106 FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> oldFocusedNode)104 FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) 107 105 : EventDispatchMediator(focusEvent) 108 , m_oldFocusedNode(oldFocusedNode)109 106 { 110 107 } … … 112 109 bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const 113 110 { 114 dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode);111 dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); 115 112 return EventDispatchMediator::dispatchEvent(dispatcher); 116 113 } 117 114 118 PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> newFocusedNode)115 PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) 119 116 { 120 return adoptRef(new FocusOutEventDispatchMediator(focusEvent , newFocusedNode));117 return adoptRef(new FocusOutEventDispatchMediator(focusEvent)); 121 118 } 122 119 123 FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent , PassRefPtr<Node> newFocusedNode)120 FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) 124 121 : EventDispatchMediator(focusEvent) 125 , m_newFocusedNode(newFocusedNode)126 122 { 127 123 } … … 129 125 bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const 130 126 { 131 dispatcher->adjustRelatedTarget(event(), m_newFocusedNode);127 dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); 132 128 return EventDispatchMediator::dispatchEvent(dispatcher); 133 129 } -
trunk/Source/WebCore/dom/FocusEvent.h
r142713 r142719 79 79 class FocusEventDispatchMediator : public EventDispatchMediator { 80 80 public: 81 static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<FocusEvent> , PassRefPtr<Node> oldFocusedNode);81 static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<FocusEvent>); 82 82 private: 83 FocusEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode);83 explicit FocusEventDispatchMediator(PassRefPtr<FocusEvent>); 84 84 FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } 85 85 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; 86 RefPtr<Node> m_oldFocusedNode;87 86 }; 88 87 89 88 class BlurEventDispatchMediator : public EventDispatchMediator { 90 89 public: 91 static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<FocusEvent> , PassRefPtr<Node> newFocusedNode);90 static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<FocusEvent>); 92 91 private: 93 BlurEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode);92 explicit BlurEventDispatchMediator(PassRefPtr<FocusEvent>); 94 93 FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } 95 94 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; 96 RefPtr<Node> m_newFocusedNode;97 95 }; 98 96 99 97 class FocusInEventDispatchMediator : public EventDispatchMediator { 100 98 public: 101 static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent> , PassRefPtr<Node> oldFocusedNode);99 static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>); 102 100 private: 103 FocusInEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode);101 explicit FocusInEventDispatchMediator(PassRefPtr<FocusEvent>); 104 102 FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } 105 103 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; 106 RefPtr<Node> m_oldFocusedNode;107 104 }; 108 105 109 106 class FocusOutEventDispatchMediator : public EventDispatchMediator { 110 107 public: 111 static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent> , PassRefPtr<Node> newFocusedNode);108 static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>); 112 109 private: 113 FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode);110 explicit FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>); 114 111 FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } 115 112 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; 116 RefPtr<Node> m_newFocusedNode;117 113 }; 118 114 -
trunk/Source/WebCore/dom/Node.cpp
r142500 r142719 2342 2342 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); 2343 2343 ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent); 2344 // FIXME: We should pass oldFocusedNode to FocusEvent::create() and 2345 // remove oldFocusedNode from FocusInEventDispatchMediator::create(). 2346 // See https://bugs.webkit.org/show_bug.cgi?id=109261 2347 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, 0), oldFocusedNode)); 2344 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, oldFocusedNode))); 2348 2345 } 2349 2346 … … 2352 2349 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); 2353 2350 ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent); 2354 // FIXME: We should pass newFocusedNode to FocusEvent::create() and 2355 // remove newFocusedNode from FocusOutEventDispatchMediator::create(). 2356 // See https://bugs.webkit.org/show_bug.cgi?id=109261 2357 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, 0), newFocusedNode)); 2351 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, newFocusedNode))); 2358 2352 } 2359 2353 … … 2414 2408 document()->page()->chrome()->client()->elementDidFocus(this); 2415 2409 2416 // FIXME: We should pass oldFocusedNode to FocusEvent::create() and 2417 // remove oldFocusedNode from FocusEventDispatchMediator::create(). 2418 // See https://bugs.webkit.org/show_bug.cgi?id=109261 2419 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, 0); 2420 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release(), oldFocusedNode)); 2410 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, oldFocusedNode); 2411 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release())); 2421 2412 } 2422 2413 … … 2426 2417 document()->page()->chrome()->client()->elementDidBlur(this); 2427 2418 2428 // FIXME: We should pass newFocusedNode to FocusEvent::create() and 2429 // remove newFocusedNode from BlurEventDispatchMediator::create(). 2430 // See https://bugs.webkit.org/show_bug.cgi?id=109261 2431 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, 0); 2432 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release(), newFocusedNode)); 2419 RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, newFocusedNode); 2420 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release())); 2433 2421 } 2434 2422
Note: See TracChangeset
for help on using the changeset viewer.