#ifndef EventDispatcher_h
#define EventDispatcher_h
#include "core/dom/SimulatedClickOptions.h"
#include "heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
namespace WebCore {
class Event;
class EventDispatchMediator;
class FrameView;
class Node;
class NodeEventContext;
class WindowEventContext;
enum EventDispatchContinuation {
ContinueDispatching,
DoneDispatching
};
class EventDispatcher {
public:
static bool dispatchEvent(Node*, PassRefPtr<EventDispatchMediator>);
static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>);
static void dispatchSimulatedClick(Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions);
bool dispatch();
Node* node() const { return m_node.get(); }
Event* event() const { return m_event.get(); }
private:
EventDispatcher(Node*, PassRefPtrWillBeRawPtr<Event>);
const NodeEventContext* topNodeEventContext();
EventDispatchContinuation dispatchEventPreProcess(void*& preDispatchEventHandlerResult);
EventDispatchContinuation dispatchEventAtCapturing(WindowEventContext&);
EventDispatchContinuation dispatchEventAtTarget();
void dispatchEventAtBubbling(WindowEventContext&);
void dispatchEventPostProcess(void* preDispatchEventHandlerResult);
RefPtr<Node> m_node;
RefPtrWillBePersistent<Event> m_event;
RefPtr<FrameView> m_view;
#ifndef NDEBUG
bool m_eventDispatched;
#endif
};
}
#endif