Rename EventRetargeter::adjustForRelatedTarget to EventPath::setRelatedTarget
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Oct 2013 20:05:13 +0000 (20:05 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Oct 2013 20:05:13 +0000 (20:05 +0000)
commite1084418a8773edc88866d22f48843535fd89598
tree5b7cab61b6ff40246c4ad26035d1d5633cc65b96
parent51fa2f71520ca3f15775162971c4ca5f91e0b6d8
Rename EventRetargeter::adjustForRelatedTarget to EventPath::setRelatedTarget
https://bugs.webkit.org/show_bug.cgi?id=122539

Reviewed by Darin Adler.

Renamed EventRetargeter::adjustForRelatedTarget to EventPath::setRelatedTarget and got rid of
EventDispatchMediators for focus events. We set the related target inside EventDispatcher's
dispatch via Event::relatedTarget, which is now virtual and overridden by mouse/focus events.

* dom/Element.cpp: The following functions no longer use FocusEventDispatchMediators.
(WebCore::Element::dispatchFocusInEvent):
(WebCore::Element::dispatchFocusOutEvent):
(WebCore::Element::dispatchFocusEvent):
(WebCore::Element::dispatchBlurEvent):

* dom/Event.h:
(WebCore::Event::relatedTarget): Added as a virtual function.

* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent): Cache Event*.
(WebCore::EventDispatcher::dispatch): Call setRelatedTargetToPath at the beginning to update
related targets in the path.

* dom/EventDispatcher.h:

* dom/EventRetargeter.cpp:
(WebCore::EventPath::EventPath): Initialize m_origin, used in EventPath::setRelatedTarget.
(WebCore::EventRetargeter::adjustTouchList):
(WebCore::EventPath::setRelatedTarget): Renamed from EventRetargeter::adjustForRelatedTarget.
Delegated the nullity checks to callers by taking references instead of pointers.
(WebCore::EventRetargeter::calculateAdjustedNodes):

* dom/EventRetargeter.h: Removed AdjustedNodes typedef. It's just a Vector of RefPtr<Node>.

* dom/FocusEvent.cpp: Removed FocusEventDispatchMediators for focus events.
* dom/FocusEvent.h:

* dom/MouseEvent.cpp:
(WebCore::MouseEvent::toElement): Cache the related target now that relatedTarget() is virtual.
(WebCore::MouseEvent::fromElement): Ditto.
(WebCore::MouseEventDispatchMediator::mediateAndDispatchEvent): No longer sets the related
targets since that's done in EventDispatcher::dispatch now.

* dom/MouseEvent.h:

* dom/Node.cpp: Removed obnoxious Node::dispatchScopedEventDispatchMediator.
(WebCore::Node::dispatchScopedEvent):
* dom/Node.h:

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler): Cache the related
target in a local variable now that relatedTarget() is virtual.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Event.h
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/EventDispatcher.h
Source/WebCore/dom/EventRetargeter.cpp
Source/WebCore/dom/EventRetargeter.h
Source/WebCore/dom/FocusEvent.cpp
Source/WebCore/dom/FocusEvent.h
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/MouseEvent.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/html/shadow/MediaControlElements.cpp