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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool hasCapturingEventListeners(const AtomicString& eventType); | 124 bool hasCapturingEventListeners(const AtomicString& eventType); |
125 const EventListenerVector& getEventListeners(const AtomicString& eventTy
pe); | 125 const EventListenerVector& getEventListeners(const AtomicString& eventTy
pe); |
126 | 126 |
127 bool fireEventListeners(Event*); | 127 bool fireEventListeners(Event*); |
128 bool isFiringEventListeners(); | 128 bool isFiringEventListeners(); |
129 | 129 |
130 protected: | 130 protected: |
131 virtual ~EventTarget(); | 131 virtual ~EventTarget(); |
132 | 132 |
133 virtual EventTargetData* eventTargetData() = 0; | 133 virtual EventTargetData* eventTargetData() = 0; |
134 virtual EventTargetData* ensureEventTargetData() = 0; | 134 virtual EventTargetData& ensureEventTargetData() = 0; |
135 | 135 |
136 private: | 136 private: |
137 virtual void refEventTarget() = 0; | 137 virtual void refEventTarget() = 0; |
138 virtual void derefEventTarget() = 0; | 138 virtual void derefEventTarget() = 0; |
139 | 139 |
140 DOMWindow* executingWindow(); | 140 DOMWindow* executingWindow(); |
141 void fireEventListeners(Event*, EventTargetData*, EventListenerVector&); | 141 void fireEventListeners(Event*, EventTargetData*, EventListenerVector&); |
142 void countLegacyEvents(const AtomicString& legacyTypeName, EventListener
Vector*, EventListenerVector*); | 142 void countLegacyEvents(const AtomicString& legacyTypeName, EventListener
Vector*, EventListenerVector*); |
143 | 143 |
144 bool clearAttributeEventListener(const AtomicString& eventType, DOMWrapp
erWorld* isolatedWorld); | 144 bool clearAttributeEventListener(const AtomicString& eventType, DOMWrapp
erWorld* isolatedWorld); |
145 | 145 |
146 friend class EventListenerIterator; | 146 friend class EventListenerIterator; |
147 }; | 147 }; |
148 | 148 |
| 149 class EventTargetWithInlineData : public EventTarget { |
| 150 protected: |
| 151 virtual EventTargetData* eventTargetData() OVERRIDE FINAL { return &m_ev
entTargetData; } |
| 152 virtual EventTargetData& ensureEventTargetData() OVERRIDE FINAL { return
m_eventTargetData; } |
| 153 private: |
| 154 EventTargetData m_eventTargetData; |
| 155 }; |
| 156 |
149 // FIXME: These macros should be split into separate DEFINE and DECLARE | 157 // FIXME: These macros should be split into separate DEFINE and DECLARE |
150 // macros to avoid causing so many header includes. | 158 // macros to avoid causing so many header includes. |
151 #define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \ | 159 #define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \ |
152 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return ge
tAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \ | 160 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return ge
tAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \ |
153 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl
d* isolatedWorld = 0) { setAttributeEventListener(EventTypeNames::attribute, lis
tener, isolatedWorld); } \ | 161 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl
d* isolatedWorld = 0) { setAttributeEventListener(EventTypeNames::attribute, lis
tener, isolatedWorld); } \ |
154 | 162 |
155 #define DECLARE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(attribute) \ | 163 #define DECLARE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(attribute) \ |
156 virtual EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \ | 164 virtual EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \ |
157 virtual void setOn##attribute(PassRefPtr<EventListener>, DOMWrapperWorld
* isolatedWorld); \ | 165 virtual void setOn##attribute(PassRefPtr<EventListener>, DOMWrapperWorld
* isolatedWorld); \ |
158 | 166 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 { | 212 { |
205 EventTargetData* d = eventTargetData(); | 213 EventTargetData* d = eventTargetData(); |
206 if (!d) | 214 if (!d) |
207 return false; | 215 return false; |
208 return d->eventListenerMap.containsCapturing(eventType); | 216 return d->eventListenerMap.containsCapturing(eventType); |
209 } | 217 } |
210 | 218 |
211 } // namespace WebCore | 219 } // namespace WebCore |
212 | 220 |
213 #endif // EventTarget_h | 221 #endif // EventTarget_h |
OLD | NEW |