#ifndef EventListener_h
#define EventListener_h
#include <wtf/RefCounted.h>
namespace JSC {
class JSObject;
class SlotVisitor;
}
namespace WebCore {
class ScriptExecutionContext;
class Event;
class EventListener : public RefCounted<EventListener> {
public:
enum Type {
JSEventListenerType,
ImageEventListenerType,
ObjCEventListenerType,
CPPEventListenerType,
ConditionEventListenerType,
GObjectEventListenerType,
NativeEventListenerType,
SVGTRefTargetEventListenerType,
MediaControlsAppleEventListenerType
};
virtual ~EventListener() { }
virtual bool operator==(const EventListener&) = 0;
virtual void handleEvent(ScriptExecutionContext*, Event*) = 0;
virtual bool wasCreatedFromMarkup() const { return false; }
virtual void visitJSFunction(JSC::SlotVisitor&) { }
bool isAttribute() const { return virtualisAttribute(); }
Type type() const { return m_type; }
protected:
explicit EventListener(Type type)
: m_type(type)
{
}
private:
virtual bool virtualisAttribute() const { return false; }
Type m_type;
};
}
#endif