#ifndef EventTargetNode_h
#define EventTargetNode_h
#include "EventTarget.h"
#include "Node.h"
namespace WebCore {
class EventTargetNode : public Node,
public EventTarget {
public:
EventTargetNode(Document*);
virtual ~EventTargetNode();
virtual bool isEventTargetNode() const { return true; }
virtual EventTargetNode* toNode() { return this; }
virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&, bool tempEvent = false);
void removeAllEventListeners();
void setHTMLEventListener(const AtomicString& eventType, PassRefPtr<EventListener>);
void removeHTMLEventListener(const AtomicString& eventType);
bool dispatchHTMLEvent(const AtomicString& eventType, bool canBubble, bool cancelable);
EventListener* getHTMLEventListener(const AtomicString& eventType);
bool dispatchSubtreeModifiedEvent(bool childrenChanged = true);
void dispatchWindowEvent(const AtomicString& eventType, bool canBubble, bool cancelable);
bool dispatchUIEvent(const AtomicString& eventType, int detail = 0, PassRefPtr<Event> underlyingEvent = 0);
bool dispatchKeyEvent(const PlatformKeyboardEvent&);
void dispatchWheelEvent(PlatformWheelEvent&);
bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType,
int clickCount = 0, Node* relatedTarget = 0);
bool dispatchMouseEvent(const AtomicString& eventType, int button, int clickCount,
int pageX, int pageY, int screenX, int screenY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
bool isSimulated = false, Node* relatedTarget = 0, PassRefPtr<Event> underlyingEvent = 0);
void dispatchSimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<Event> underlyingEvent = 0);
void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
bool dispatchProgressEvent(const AtomicString &eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg);
bool dispatchWebKitAnimationEvent(const AtomicString& eventType, const String& animationName, double elapsedTime);
bool dispatchWebKitTransitionEvent(const AtomicString& eventType, const String& propertyName, double elapsedTime);
virtual void handleLocalEvents(Event*, bool useCapture);
virtual void dispatchFocusEvent();
virtual void dispatchBlurEvent();
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void defaultEventHandler(Event*);
virtual bool disabled() const;
#ifndef NDEBUG
virtual void dump(TextStream*, DeprecatedString indent = "") const;
#endif
virtual bool willRespondToMouseMoveEvents();
virtual bool willRespondToMouseWheelEvents();
virtual bool willRespondToMouseClickEvents();
RegisteredEventListenerList* localEventListeners() const { return m_regdListeners; }
using Node::ref;
using Node::deref;
protected:
friend class EventTarget;
RegisteredEventListenerList* m_regdListeners;
HashMap<Node *, int> * EventTargetNode::WebThreadGetCurrentDOMMouseWheelEventListeners();
HashMap<Node *, int> * EventTargetNode::WebThreadGetCurrentDOMMouseMoveEventListeners();
HashMap<Node *, int> * EventTargetNode::WebThreadGetCurrentDOMMouseClickEventListeners();
private:
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
};
inline EventTargetNode* EventTargetNodeCast(Node* n)
{
ASSERT(n->isEventTargetNode());
return static_cast<EventTargetNode*>(n);
}
inline const EventTargetNode* EventTargetNodeCast(const Node* n)
{
ASSERT(n->isEventTargetNode());
return static_cast<const EventTargetNode*>(n);
}
}
#endif // EventTargetNode_h