Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Side by Side Diff: Source/core/dom/EventTarget.h

Issue 18301003: Introduce DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER() macro (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/svg/SVGElementInstance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapp erWorld* isolatedWorld) { setAttributeEventListener(eventNames().attribute##Even t, listener, isolatedWorld); } \ 158 void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapp erWorld* isolatedWorld) { setAttributeEventListener(eventNames().attribute##Even t, listener, isolatedWorld); } \
159 159
160 #define DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \ 160 #define DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \
161 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return do cument()->getWindowAttributeEventListener(eventNames().attribute##Event, isolate dWorld); } \ 161 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return do cument()->getWindowAttributeEventListener(eventNames().attribute##Event, isolate dWorld); } \
162 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl d* isolatedWorld) { document()->setWindowAttributeEventListener(eventNames().att ribute##Event, listener, isolatedWorld); } \ 162 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl d* isolatedWorld) { document()->setWindowAttributeEventListener(eventNames().att ribute##Event, listener, isolatedWorld); } \
163 163
164 #define DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(attribute, eventName) \ 164 #define DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(attribute, eventName) \
165 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return ge tAttributeEventListener(eventNames().eventName##Event, isolatedWorld); } \ 165 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return ge tAttributeEventListener(eventNames().eventName##Event, isolatedWorld); } \
166 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl d* isolatedWorld) { setAttributeEventListener(eventNames().eventName##Event, lis tener, isolatedWorld); } \ 166 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl d* isolatedWorld) { setAttributeEventListener(eventNames().eventName##Event, lis tener, isolatedWorld); } \
167 167
168 #define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \ 168 #define DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \
169 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return re cipient ? recipient->getAttributeEventListener(eventNames().attribute##Event, is olatedWorld) : 0; } \ 169 EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \
170 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl d* isolatedWorld) { if (recipient) recipient->setAttributeEventListener(eventNam es().attribute##Event, listener, isolatedWorld); } \ 170 void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorl d* isolatedWorld);
171
172 #define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(type, recipient, attribut e) \
173 EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { ret urn recipient ? recipient->getAttributeEventListener(eventNames().attribute##Eve nt, isolatedWorld) : 0; } \
174 void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapp erWorld* isolatedWorld) { if (recipient) recipient->setAttributeEventListener(ev entNames().attribute##Event, listener, isolatedWorld); }
171 175
172 inline bool EventTarget::isFiringEventListeners() 176 inline bool EventTarget::isFiringEventListeners()
173 { 177 {
174 EventTargetData* d = eventTargetData(); 178 EventTargetData* d = eventTargetData();
175 if (!d) 179 if (!d)
176 return false; 180 return false;
177 return d->firingEventIterators && !d->firingEventIterators->isEmpty(); 181 return d->firingEventIterators && !d->firingEventIterators->isEmpty();
178 } 182 }
179 183
180 inline bool EventTarget::hasEventListeners() 184 inline bool EventTarget::hasEventListeners()
181 { 185 {
182 EventTargetData* d = eventTargetData(); 186 EventTargetData* d = eventTargetData();
183 if (!d) 187 if (!d)
184 return false; 188 return false;
185 return !d->eventListenerMap.isEmpty(); 189 return !d->eventListenerMap.isEmpty();
186 } 190 }
187 191
188 inline bool EventTarget::hasEventListeners(const AtomicString& eventType) 192 inline bool EventTarget::hasEventListeners(const AtomicString& eventType)
189 { 193 {
190 EventTargetData* d = eventTargetData(); 194 EventTargetData* d = eventTargetData();
191 if (!d) 195 if (!d)
192 return false; 196 return false;
193 return d->eventListenerMap.contains(eventType); 197 return d->eventListenerMap.contains(eventType);
194 } 198 }
195 199
196 } // namespace WebCore 200 } // namespace WebCore
197 201
198 #endif // EventTarget_h 202 #endif // EventTarget_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/svg/SVGElementInstance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698