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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 * | 29 * |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 #include "core/events/EventTarget.h" | 33 #include "core/events/EventTarget.h" |
34 | 34 |
35 #include "RuntimeEnabledFeatures.h" | 35 #include "RuntimeEnabledFeatures.h" |
36 #include "bindings/v8/DOMWrapperWorld.h" | 36 #include "bindings/v8/DOMWrapperWorld.h" |
37 #include "bindings/v8/ExceptionMessages.h" | |
38 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
39 #include "core/events/Event.h" | 38 #include "core/events/Event.h" |
40 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
41 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
42 #include "core/frame/DOMWindow.h" | 41 #include "core/frame/DOMWindow.h" |
43 #include "platform/UserGestureIndicator.h" | 42 #include "platform/UserGestureIndicator.h" |
44 #include "wtf/StdLibExtras.h" | 43 #include "wtf/StdLibExtras.h" |
45 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
46 | 45 |
47 using namespace WTF; | 46 using namespace WTF; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 { | 150 { |
152 EventListener* listener = getAttributeEventListener(eventType, isolatedWorld
); | 151 EventListener* listener = getAttributeEventListener(eventType, isolatedWorld
); |
153 if (!listener) | 152 if (!listener) |
154 return false; | 153 return false; |
155 return removeEventListener(eventType, listener, false); | 154 return removeEventListener(eventType, listener, false); |
156 } | 155 } |
157 | 156 |
158 bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& excepti
onState) | 157 bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& excepti
onState) |
159 { | 158 { |
160 if (!event) { | 159 if (!event) { |
161 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("dispatchEvent", "EventTarget", "The event provided is null.")); | 160 exceptionState.throwDOMException(InvalidStateError, "The event provided
is null."); |
162 return false; | 161 return false; |
163 } | 162 } |
164 if (event->type().isEmpty()) { | 163 if (event->type().isEmpty()) { |
165 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("dispatchEvent", "EventTarget", "The event provided is uninitiali
zed.")); | 164 exceptionState.throwDOMException(InvalidStateError, "The event provided
is uninitialized."); |
166 return false; | 165 return false; |
167 } | 166 } |
168 if (event->isBeingDispatched()) { | 167 if (event->isBeingDispatched()) { |
169 exceptionState.throwDOMException(InvalidStateError, ExceptionMessages::f
ailedToExecute("dispatchEvent", "EventTarget", "The event is already being dispa
tched.")); | 168 exceptionState.throwDOMException(InvalidStateError, "The event is alread
y being dispatched."); |
170 return false; | 169 return false; |
171 } | 170 } |
172 | 171 |
173 if (!executionContext()) | 172 if (!executionContext()) |
174 return false; | 173 return false; |
175 | 174 |
176 return dispatchEvent(event); | 175 return dispatchEvent(event); |
177 } | 176 } |
178 | 177 |
179 bool EventTarget::dispatchEvent(PassRefPtr<Event> event) | 178 bool EventTarget::dispatchEvent(PassRefPtr<Event> event) |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // they have one less listener to invoke. | 368 // they have one less listener to invoke. |
370 if (d->firingEventIterators) { | 369 if (d->firingEventIterators) { |
371 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 370 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
372 d->firingEventIterators->at(i).iterator = 0; | 371 d->firingEventIterators->at(i).iterator = 0; |
373 d->firingEventIterators->at(i).end = 0; | 372 d->firingEventIterators->at(i).end = 0; |
374 } | 373 } |
375 } | 374 } |
376 } | 375 } |
377 | 376 |
378 } // namespace WebCore | 377 } // namespace WebCore |
OLD | NEW |