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 20 matching lines...) Expand all Loading... |
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 "bindings/v8/ExceptionState.h" | 35 #include "bindings/v8/ExceptionState.h" |
36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
37 #include "core/dom/NoEventDispatchAssertion.h" | 37 #include "core/dom/NoEventDispatchAssertion.h" |
38 #include "core/editing/Editor.h" | 38 #include "core/editing/Editor.h" |
39 #include "core/events/Event.h" | 39 #include "core/events/Event.h" |
40 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
41 #include "core/frame/DOMWindow.h" | 41 #include "core/frame/LocalDOMWindow.h" |
42 #include "platform/RuntimeEnabledFeatures.h" | 42 #include "platform/RuntimeEnabledFeatures.h" |
43 #include "wtf/StdLibExtras.h" | 43 #include "wtf/StdLibExtras.h" |
44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
45 | 45 |
46 using namespace WTF; | 46 using namespace WTF; |
47 | 47 |
48 namespace WebCore { | 48 namespace WebCore { |
49 | 49 |
50 EventTargetData::EventTargetData() | 50 EventTargetData::EventTargetData() |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 EventTargetData::~EventTargetData() | 54 EventTargetData::~EventTargetData() |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 EventTarget::~EventTarget() | 58 EventTarget::~EventTarget() |
59 { | 59 { |
60 } | 60 } |
61 | 61 |
62 Node* EventTarget::toNode() | 62 Node* EventTarget::toNode() |
63 { | 63 { |
64 return 0; | 64 return 0; |
65 } | 65 } |
66 | 66 |
67 DOMWindow* EventTarget::toDOMWindow() | 67 LocalDOMWindow* EventTarget::toDOMWindow() |
68 { | 68 { |
69 return 0; | 69 return 0; |
70 } | 70 } |
71 | 71 |
72 MessagePort* EventTarget::toMessagePort() | 72 MessagePort* EventTarget::toMessagePort() |
73 { | 73 { |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 | 76 |
77 inline DOMWindow* EventTarget::executingWindow() | 77 inline LocalDOMWindow* EventTarget::executingWindow() |
78 { | 78 { |
79 if (ExecutionContext* context = executionContext()) | 79 if (ExecutionContext* context = executionContext()) |
80 return context->executingWindow(); | 80 return context->executingWindow(); |
81 return 0; | 81 return 0; |
82 } | 82 } |
83 | 83 |
84 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener> listener, bool useCapture) | 84 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener> listener, bool useCapture) |
85 { | 85 { |
86 // FIXME: listener null check should throw TypeError (and be done in | 86 // FIXME: listener null check should throw TypeError (and be done in |
87 // generated bindings), but breaks legacy content. http://crbug.com/249598 | 87 // generated bindings), but breaks legacy content. http://crbug.com/249598 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimatio
nStartEvent; | 226 prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimatio
nStartEvent; |
227 shouldCount = true; | 227 shouldCount = true; |
228 } else if (legacyTypeName == EventTypeNames::webkitAnimationIteration) { | 228 } else if (legacyTypeName == EventTypeNames::webkitAnimationIteration) { |
229 prefixedFeature = UseCounter::PrefixedAnimationIterationEvent; | 229 prefixedFeature = UseCounter::PrefixedAnimationIterationEvent; |
230 unprefixedFeature = UseCounter::UnprefixedAnimationIterationEvent; | 230 unprefixedFeature = UseCounter::UnprefixedAnimationIterationEvent; |
231 prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimatio
nIterationEvent; | 231 prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimatio
nIterationEvent; |
232 shouldCount = true; | 232 shouldCount = true; |
233 } | 233 } |
234 | 234 |
235 if (shouldCount) { | 235 if (shouldCount) { |
236 if (DOMWindow* executingWindow = this->executingWindow()) { | 236 if (LocalDOMWindow* executingWindow = this->executingWindow()) { |
237 if (legacyListenersVector) { | 237 if (legacyListenersVector) { |
238 if (listenersVector) | 238 if (listenersVector) |
239 UseCounter::count(executingWindow->document(), prefixedAndUn
prefixedFeature); | 239 UseCounter::count(executingWindow->document(), prefixedAndUn
prefixedFeature); |
240 else | 240 else |
241 UseCounter::count(executingWindow->document(), prefixedFeatu
re); | 241 UseCounter::count(executingWindow->document(), prefixedFeatu
re); |
242 } else if (listenersVector) { | 242 } else if (listenersVector) { |
243 UseCounter::count(executingWindow->document(), unprefixedFeature
); | 243 UseCounter::count(executingWindow->document(), unprefixedFeature
); |
244 } | 244 } |
245 } | 245 } |
246 } | 246 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 { | 287 { |
288 RefPtrWillBeRawPtr<EventTarget> protect(this); | 288 RefPtrWillBeRawPtr<EventTarget> protect(this); |
289 | 289 |
290 // Fire all listeners registered for this event. Don't fire listeners remove
d | 290 // Fire all listeners registered for this event. Don't fire listeners remove
d |
291 // during event dispatch. Also, don't fire event listeners added during even
t | 291 // during event dispatch. Also, don't fire event listeners added during even
t |
292 // dispatch. Conveniently, all new event listeners will be added after or at | 292 // dispatch. Conveniently, all new event listeners will be added after or at |
293 // index |size|, so iterating up to (but not including) |size| naturally exc
ludes | 293 // index |size|, so iterating up to (but not including) |size| naturally exc
ludes |
294 // new event listeners. | 294 // new event listeners. |
295 | 295 |
296 if (event->type() == EventTypeNames::beforeunload) { | 296 if (event->type() == EventTypeNames::beforeunload) { |
297 if (DOMWindow* executingWindow = this->executingWindow()) { | 297 if (LocalDOMWindow* executingWindow = this->executingWindow()) { |
298 if (executingWindow->top()) | 298 if (executingWindow->top()) |
299 UseCounter::count(executingWindow->document(), UseCounter::SubFr
ameBeforeUnloadFired); | 299 UseCounter::count(executingWindow->document(), UseCounter::SubFr
ameBeforeUnloadFired); |
300 UseCounter::count(executingWindow->document(), UseCounter::DocumentB
eforeUnloadFired); | 300 UseCounter::count(executingWindow->document(), UseCounter::DocumentB
eforeUnloadFired); |
301 } | 301 } |
302 } else if (event->type() == EventTypeNames::unload) { | 302 } else if (event->type() == EventTypeNames::unload) { |
303 if (DOMWindow* executingWindow = this->executingWindow()) | 303 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
304 UseCounter::count(executingWindow->document(), UseCounter::DocumentU
nloadFired); | 304 UseCounter::count(executingWindow->document(), UseCounter::DocumentU
nloadFired); |
305 } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == E
ventTypeNames::DOMFocusOut) { | 305 } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == E
ventTypeNames::DOMFocusOut) { |
306 if (DOMWindow* executingWindow = this->executingWindow()) | 306 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
307 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI
nOutEvent); | 307 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI
nOutEvent); |
308 } else if (event->type() == EventTypeNames::focusin || event->type() == Even
tTypeNames::focusout) { | 308 } else if (event->type() == EventTypeNames::focusin || event->type() == Even
tTypeNames::focusout) { |
309 if (DOMWindow* executingWindow = this->executingWindow()) | 309 if (LocalDOMWindow* executingWindow = this->executingWindow()) |
310 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu
tEvent); | 310 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu
tEvent); |
311 } | 311 } |
312 | 312 |
313 size_t i = 0; | 313 size_t i = 0; |
314 size_t size = entry.size(); | 314 size_t size = entry.size(); |
315 if (!d->firingEventIterators) | 315 if (!d->firingEventIterators) |
316 d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); | 316 d->firingEventIterators = adoptPtr(new FiringEventIteratorVector); |
317 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size))
; | 317 d->firingEventIterators->append(FiringEventIterator(event->type(), i, size))
; |
318 for ( ; i < size; ++i) { | 318 for ( ; i < size; ++i) { |
319 RegisteredEventListener& registeredListener = entry[i]; | 319 RegisteredEventListener& registeredListener = entry[i]; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // they have one less listener to invoke. | 372 // they have one less listener to invoke. |
373 if (d->firingEventIterators) { | 373 if (d->firingEventIterators) { |
374 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 374 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
375 d->firingEventIterators->at(i).iterator = 0; | 375 d->firingEventIterators->at(i).iterator = 0; |
376 d->firingEventIterators->at(i).end = 0; | 376 d->firingEventIterators->at(i).end = 0; |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 } // namespace WebCore | 381 } // namespace WebCore |
OLD | NEW |