OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // - Figure out if you now need to inherit from ActiveDOMObject as well. | 95 // - Figure out if you now need to inherit from ActiveDOMObject as well. |
96 // - In your class declaration, you will typically use | 96 // - In your class declaration, you will typically use |
97 // REFCOUNTED_EVENT_TARGET(YourClass) if YourClass is a RefCounted<>, | 97 // REFCOUNTED_EVENT_TARGET(YourClass) if YourClass is a RefCounted<>, |
98 // or REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(OtherRefCounted<YourClass>) | 98 // or REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(OtherRefCounted<YourClass>) |
99 // if YourClass uses a different kind of reference counting template such as | 99 // if YourClass uses a different kind of reference counting template such as |
100 // RefCountedGarbageCollected<YourClass>. | 100 // RefCountedGarbageCollected<YourClass>. |
101 // - Make sure to include this header file in your .h file, or you will get | 101 // - Make sure to include this header file in your .h file, or you will get |
102 // very strange compiler errors. | 102 // very strange compiler errors. |
103 // - If you added an onfoo attribute, use DEFINE_ATTRIBUTE_EVENT_LISTENER(foo) | 103 // - If you added an onfoo attribute, use DEFINE_ATTRIBUTE_EVENT_LISTENER(foo) |
104 // in your class declaration. | 104 // in your class declaration. |
105 // - Override EventTarget::interfaceName() and executionContext(). The former | 105 // - Override EventTarget::interfaceName() and getExecutionContext(). The former |
106 // will typically return EventTargetNames::YourClassName. The latter will | 106 // will typically return EventTargetNames::YourClassName. The latter will |
107 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) | 107 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) |
108 // or the document you're in. | 108 // or the document you're in. |
109 // - Your trace() method will need to call EventTargetWithInlineData::trace | 109 // - Your trace() method will need to call EventTargetWithInlineData::trace |
110 // or RefCountedGarbageCollectedEventTargetWithInlineData<YourClass>::trace, | 110 // or RefCountedGarbageCollectedEventTargetWithInlineData<YourClass>::trace, |
111 // depending on the base class of your class. | 111 // depending on the base class of your class. |
112 // | 112 // |
113 // Optionally, add a FooEvent.idl class, but that's outside the scope of this | 113 // Optionally, add a FooEvent.idl class, but that's outside the scope of this |
114 // comment (and much more straightforward). | 114 // comment (and much more straightforward). |
115 class CORE_EXPORT EventTarget : public NoBaseWillBeGarbageCollectedFinalized<Eve
ntTarget>, public ScriptWrappable { | 115 class CORE_EXPORT EventTarget : public NoBaseWillBeGarbageCollectedFinalized<Eve
ntTarget>, public ScriptWrappable { |
116 DEFINE_WRAPPERTYPEINFO(); | 116 DEFINE_WRAPPERTYPEINFO(); |
117 public: | 117 public: |
118 virtual ~EventTarget(); | 118 virtual ~EventTarget(); |
119 | 119 |
120 #if !ENABLE(OILPAN) | 120 #if !ENABLE(OILPAN) |
121 void ref() { refEventTarget(); } | 121 void ref() { refEventTarget(); } |
122 void deref() { derefEventTarget(); } | 122 void deref() { derefEventTarget(); } |
123 #endif | 123 #endif |
124 | 124 |
125 virtual const AtomicString& interfaceName() const = 0; | 125 virtual const AtomicString& interfaceName() const = 0; |
126 virtual ExecutionContext* executionContext() const = 0; | 126 virtual ExecutionContext* getExecutionContext() const = 0; |
127 | 127 |
128 virtual Node* toNode(); | 128 virtual Node* toNode(); |
129 virtual const LocalDOMWindow* toDOMWindow() const; | 129 virtual const LocalDOMWindow* toDOMWindow() const; |
130 virtual LocalDOMWindow* toDOMWindow(); | 130 virtual LocalDOMWindow* toDOMWindow(); |
131 virtual MessagePort* toMessagePort(); | 131 virtual MessagePort* toMessagePort(); |
132 | 132 |
133 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, bool useCapture = false); | 133 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, bool useCapture = false); |
134 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, const EventListenerOptionsOrBoolean&); | 134 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, const EventListenerOptionsOrBoolean&); |
135 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, EventListenerOptions&); | 135 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, EventListenerOptions&); |
136 | 136 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 using baseClass::deref; \ | 322 using baseClass::deref; \ |
323 private: \ | 323 private: \ |
324 void refEventTarget() final { ref(); } \ | 324 void refEventTarget() final { ref(); } \ |
325 void derefEventTarget() final { deref(); } \ | 325 void derefEventTarget() final { deref(); } \ |
326 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro | 326 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro |
327 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
unted<baseClass>) | 327 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
unted<baseClass>) |
328 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET
_REFCOUNTING(RefCountedGarbageCollected<baseClass>) | 328 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET
_REFCOUNTING(RefCountedGarbageCollected<baseClass>) |
329 #endif // ENABLE(OILPAN) | 329 #endif // ENABLE(OILPAN) |
330 | 330 |
331 #endif // EventTarget_h | 331 #endif // EventTarget_h |
OLD | NEW |