WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Use FocusEvent.relatedTarget.
bug-109650-20130213132121.patch (text/plain), 13.09 KB, created by
Hayato Ito
on 2013-02-12 20:24:52 PST
(
hide
)
Description:
Use FocusEvent.relatedTarget.
Filename:
MIME Type:
Creator:
Hayato Ito
Created:
2013-02-12 20:24:52 PST
Size:
13.09 KB
patch
obsolete
>Subversion Revision: 142592 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0d345e4260714783d75cf08a1ba5f93222978f06..2245f365e33617db7889f16fe9d2a3ecd9513900 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2013-02-13 Hayato Ito <hayato@chromium.org> >+ >+ Use FocusEvent.relatedTarget in {FocusIn,FocusOut,Focus,Blur}EventDispatchMediator. >+ https://bugs.webkit.org/show_bug.cgi?id=109650 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Set FocusEvent.relatedTarget in its constructor so that each >+ EventDispatchMediator can use FocusEvent.relatedTarget rather than >+ its redundant m_{old,new}FocusedNode member variable. >+ >+ I've also removed FIXME comments, mentioning bug 109261, since I >+ can not reproduce the issue. >+ >+ No new tests. No change in functionality. >+ >+ * dom/FocusEvent.cpp: >+ (WebCore::FocusEventDispatchMediator::create): >+ (WebCore::FocusEventDispatchMediator::FocusEventDispatchMediator): >+ (WebCore::FocusEventDispatchMediator::dispatchEvent): >+ (WebCore::BlurEventDispatchMediator::create): >+ (WebCore::BlurEventDispatchMediator::BlurEventDispatchMediator): >+ (WebCore::BlurEventDispatchMediator::dispatchEvent): >+ (WebCore::FocusInEventDispatchMediator::create): >+ (WebCore::FocusInEventDispatchMediator::FocusInEventDispatchMediator): >+ (WebCore::FocusInEventDispatchMediator::dispatchEvent): >+ (WebCore::FocusOutEventDispatchMediator::create): >+ (WebCore::FocusOutEventDispatchMediator::FocusOutEventDispatchMediator): >+ (WebCore::FocusOutEventDispatchMediator::dispatchEvent): >+ * dom/FocusEvent.h: >+ (FocusEventDispatchMediator): >+ (BlurEventDispatchMediator): >+ (FocusInEventDispatchMediator): >+ (FocusOutEventDispatchMediator): >+ * dom/Node.cpp: >+ (WebCore::Node::dispatchFocusInEvent): >+ (WebCore::Node::dispatchFocusOutEvent): >+ (WebCore::Node::dispatchFocusEvent): >+ (WebCore::Node::dispatchBlurEvent): >+ > 2013-02-12 Hayato Ito <hayato@chromium.org> > > Make {FocusIn,FocusOut,Focus,Blur}EventDispatchMediator type safe. >diff --git a/Source/WebCore/dom/FocusEvent.cpp b/Source/WebCore/dom/FocusEvent.cpp >index fc02cebc4c0bd2dd0a7d23032e1f4b5e702aaa30..fbd31e9136495b1d6157ce6fb42af4fbf38877bb 100644 >--- a/Source/WebCore/dom/FocusEvent.cpp >+++ b/Source/WebCore/dom/FocusEvent.cpp >@@ -64,71 +64,67 @@ FocusEvent::FocusEvent(const AtomicString& type, const FocusEventInit& initializ > { > } > >-PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> oldFocusedNode) >+PassRefPtr<FocusEventDispatchMediator> FocusEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) > { >- return adoptRef(new FocusEventDispatchMediator(focusEvent, oldFocusedNode)); >+ return adoptRef(new FocusEventDispatchMediator(focusEvent)); > } > >-FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> oldFocusedNode) >+FocusEventDispatchMediator::FocusEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) > : EventDispatchMediator(focusEvent) >- , m_oldFocusedNode(oldFocusedNode) > { > } > > bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const > { >- dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode); >+ dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); > return EventDispatchMediator::dispatchEvent(dispatcher); > } > >-PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> newFocusedNode) >+PassRefPtr<BlurEventDispatchMediator> BlurEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) > { >- return adoptRef(new BlurEventDispatchMediator(focusEvent, newFocusedNode)); >+ return adoptRef(new BlurEventDispatchMediator(focusEvent)); > } > >-BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> newFocusedNode) >+BlurEventDispatchMediator::BlurEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) > : EventDispatchMediator(focusEvent) >- , m_newFocusedNode(newFocusedNode) > { > } > > bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const > { >- dispatcher->adjustRelatedTarget(event(), m_newFocusedNode); >+ dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); > return EventDispatchMediator::dispatchEvent(dispatcher); > } > >-PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> oldFocusedNode) >+PassRefPtr<FocusInEventDispatchMediator> FocusInEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) > { >- return adoptRef(new FocusInEventDispatchMediator(focusEvent, oldFocusedNode)); >+ return adoptRef(new FocusInEventDispatchMediator(focusEvent)); > } > >-FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> oldFocusedNode) >+FocusInEventDispatchMediator::FocusInEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) > : EventDispatchMediator(focusEvent) >- , m_oldFocusedNode(oldFocusedNode) > { > } > > bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const > { >- dispatcher->adjustRelatedTarget(event(), m_oldFocusedNode); >+ dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); > return EventDispatchMediator::dispatchEvent(dispatcher); > } > >-PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> newFocusedNode) >+PassRefPtr<FocusOutEventDispatchMediator> FocusOutEventDispatchMediator::create(PassRefPtr<FocusEvent> focusEvent) > { >- return adoptRef(new FocusOutEventDispatchMediator(focusEvent, newFocusedNode)); >+ return adoptRef(new FocusOutEventDispatchMediator(focusEvent)); > } > >-FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent, PassRefPtr<Node> newFocusedNode) >+FocusOutEventDispatchMediator::FocusOutEventDispatchMediator(PassRefPtr<FocusEvent> focusEvent) > : EventDispatchMediator(focusEvent) >- , m_newFocusedNode(newFocusedNode) > { > } > > bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const > { >- dispatcher->adjustRelatedTarget(event(), m_newFocusedNode); >+ dispatcher->adjustRelatedTarget(event(), event()->relatedTarget()); > return EventDispatchMediator::dispatchEvent(dispatcher); > } > >diff --git a/Source/WebCore/dom/FocusEvent.h b/Source/WebCore/dom/FocusEvent.h >index cbcff1a85cb37be3fbaacc19deac415cbfdd1bc2..7a5b892188f7b9cc5392e73a2d9c5a6632fcecf8 100644 >--- a/Source/WebCore/dom/FocusEvent.h >+++ b/Source/WebCore/dom/FocusEvent.h >@@ -78,42 +78,38 @@ inline FocusEvent* toFocusEvent(Event* event) > > class FocusEventDispatchMediator : public EventDispatchMediator { > public: >- static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode); >+ static PassRefPtr<FocusEventDispatchMediator> create(PassRefPtr<FocusEvent>); > private: >- FocusEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode); >+ FocusEventDispatchMediator(PassRefPtr<FocusEvent>); > FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } > virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; >- RefPtr<Node> m_oldFocusedNode; > }; > > class BlurEventDispatchMediator : public EventDispatchMediator { > public: >- static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode); >+ static PassRefPtr<BlurEventDispatchMediator> create(PassRefPtr<FocusEvent>); > private: >- BlurEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode); >+ BlurEventDispatchMediator(PassRefPtr<FocusEvent>); > FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } > virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; >- RefPtr<Node> m_newFocusedNode; > }; > > class FocusInEventDispatchMediator : public EventDispatchMediator { > public: >- static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode); >+ static PassRefPtr<FocusInEventDispatchMediator> create(PassRefPtr<FocusEvent>); > private: >- FocusInEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> oldFocusedNode); >+ FocusInEventDispatchMediator(PassRefPtr<FocusEvent>); > FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } > virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; >- RefPtr<Node> m_oldFocusedNode; > }; > > class FocusOutEventDispatchMediator : public EventDispatchMediator { > public: >- static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode); >+ static PassRefPtr<FocusOutEventDispatchMediator> create(PassRefPtr<FocusEvent>); > private: >- FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>, PassRefPtr<Node> newFocusedNode); >+ FocusOutEventDispatchMediator(PassRefPtr<FocusEvent>); > FocusEvent* event() const { return static_cast<FocusEvent*>(EventDispatchMediator::event()); } > virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; >- RefPtr<Node> m_newFocusedNode; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index 840c24c81e69b415fd02db9f7aad379596ccba6c..57d25cd2d0907b215519c8904730f93ed54fe1f5 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -2382,20 +2382,14 @@ void Node::dispatchFocusInEvent(const AtomicString& eventType, PassRefPtr<Node> > { > ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); > ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent); >- // FIXME: We should pass oldFocusedNode to FocusEvent::create() and >- // remove oldFocusedNode from FocusInEventDispatchMediator::create(). >- // See https://bugs.webkit.org/show_bug.cgi?id=109261 >- dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, 0), oldFocusedNode)); >+ dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, oldFocusedNode))); > } > > void Node::dispatchFocusOutEvent(const AtomicString& eventType, PassRefPtr<Node> newFocusedNode) > { > ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); > ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent); >- // FIXME: We should pass newFocusedNode to FocusEvent::create() and >- // remove newFocusedNode from FocusOutEventDispatchMediator::create(). >- // See https://bugs.webkit.org/show_bug.cgi?id=109261 >- dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, 0), newFocusedNode)); >+ dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document()->defaultView(), 0, newFocusedNode))); > } > > bool Node::dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent) >@@ -2454,11 +2448,8 @@ void Node::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirection) > if (document()->page()) > document()->page()->chrome()->client()->elementDidFocus(this); > >- // FIXME: We should pass oldFocusedNode to FocusEvent::create() and >- // remove oldFocusedNode from FocusEventDispatchMediator::create(). >- // See https://bugs.webkit.org/show_bug.cgi?id=109261 >- RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, 0); >- EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release(), oldFocusedNode)); >+ RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document()->defaultView(), 0, oldFocusedNode); >+ EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release())); > } > > void Node::dispatchBlurEvent(PassRefPtr<Node> newFocusedNode) >@@ -2466,11 +2457,8 @@ void Node::dispatchBlurEvent(PassRefPtr<Node> newFocusedNode) > if (document()->page()) > document()->page()->chrome()->client()->elementDidBlur(this); > >- // FIXME: We should pass newFocusedNode to FocusEvent::create() and >- // remove newFocusedNode from BlurEventDispatchMediator::create(). >- // See https://bugs.webkit.org/show_bug.cgi?id=109261 >- RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, 0); >- EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release(), newFocusedNode)); >+ RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document()->defaultView(), 0, newFocusedNode); >+ EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release())); > } > > void Node::dispatchChangeEvent()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 109650
:
187996
|
188000
|
188008