Make EventDispatcher::dispatch comprehensible
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Oct 2013 08:19:22 +0000 (08:19 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Oct 2013 08:19:22 +0000 (08:19 +0000)
commite90dacede4ea45dead7065f1276773f51e243a30
tree4097f8140babdbede79181e2e0e2f973273be7a6
parentcb186e6d73679b9c1a798f1f51e89e500fac3411
Make EventDispatcher::dispatch comprehensible
https://bugs.webkit.org/show_bug.cgi?id=122588

Reviewed by Andreas Kling.

Merged EventDispatcher::dispatchEventAtCapturing, EventDispatcher::dispatchEventAtTarget,
EventDispatcher::dispatchEventAtBubbling, and EventDispatcher::dispatchEventPostProcess into EventDispatcher::dispatch,
and extracted static local callDefaultEventHandlersInTheBubblingOrder and dispatchEventInDOM out of it.

Also made handleLocalEvents of subclasses of EventContext and Node take Event& instead of Event*.

* dom/EventContext.cpp: The following functions now take Event& instead of Event*.
(WebCore::EventContext::handleLocalEvents):
(WebCore::MouseOrFocusEventContext::handleLocalEvents):
(WebCore::TouchEventContext::handleLocalEvents):
* dom/EventContext.h:

* dom/EventDispatcher.cpp:
(WebCore::callDefaultEventHandlersInTheBubblingOrder): Extracted from EventDispatcher::dispatchEventPostProcess,
which is now merged into EventDispatcher::dispatch.
(WebCore::dispatchEventInDOM): Extracted out of EventDispatcher::dispatch, EventDispatcher::dispatchEventAtCapturing,
EventDispatcher::dispatchEventAtTarget and EventDispatcher::dispatchEventAtBubbling. This function is responsible for
dispatching the event for capturing, at the target, and then bubbling through the event path chain.
(WebCore::EventDispatcher::dispatch): EventDispatcher::dispatchEventPostProcess got merged into this. The calls to
dispatchEventAtCapturing, dispatchEventAtTarget, and dispatchEventAtBubbling are replaced by a single call to
dispatchEventInDOM.
* dom/EventDispatcher.h:

* dom/FocusEvent.h:
(WebCore::toFocusEvent): Added the version that takes a reference.
* dom/MouseEvent.h:
(WebCore::toMouseEvent): Ditto.
* dom/TouchEvent.h:
(WebCore::toTouchEvent): Ditto.
* dom/Node.cpp:
(WebCore::Node::handleLocalEvents): Now takes Event& instead of Event*.
* dom/Node.h:
* dom/WindowEventContext.cpp:
(WebCore::WindowEventContext::handleLocalEvents): Ditto.
* dom/WindowEventContext.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::handleLocalEvents): Ditto.
* html/HTMLFormElement.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157210 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/EventContext.cpp
Source/WebCore/dom/EventContext.h
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/EventDispatcher.h
Source/WebCore/dom/FocusEvent.h
Source/WebCore/dom/MouseEvent.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/TouchEvent.h
Source/WebCore/dom/WindowEventContext.cpp
Source/WebCore/dom/WindowEventContext.h
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFormElement.h