| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return nullptr; | 104 return nullptr; |
| 105 } | 105 } |
| 106 | 106 |
| 107 inline LocalDOMWindow* EventTarget::executingWindow() | 107 inline LocalDOMWindow* EventTarget::executingWindow() |
| 108 { | 108 { |
| 109 if (ExecutionContext* context = executionContext()) | 109 if (ExecutionContext* context = executionContext()) |
| 110 return context->executingWindow(); | 110 return context->executingWindow(); |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener> listener, bool useCapture) | 114 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtrWill
BeRawPtr<EventListener> listener, bool useCapture) |
| 115 { | 115 { |
| 116 EventListenerOptions options; | 116 EventListenerOptions options; |
| 117 setDefaultEventListenerOptionsLegacy(options, useCapture); | 117 setDefaultEventListenerOptionsLegacy(options, useCapture); |
| 118 return addEventListenerInternal(eventType, listener, options); | 118 return addEventListenerInternal(eventType, listener, options); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener> listener, const EventListenerOptionsOrBoolean& optionsUnion) | 121 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtrWill
BeRawPtr<EventListener> listener, const EventListenerOptionsOrBoolean& optionsUn
ion) |
| 122 { | 122 { |
| 123 if (optionsUnion.isBoolean()) | 123 if (optionsUnion.isBoolean()) |
| 124 return addEventListener(eventType, listener, optionsUnion.getAsBoolean()
); | 124 return addEventListener(eventType, listener, optionsUnion.getAsBoolean()
); |
| 125 if (optionsUnion.isEventListenerOptions()) { | 125 if (optionsUnion.isEventListenerOptions()) { |
| 126 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); | 126 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); |
| 127 return addEventListener(eventType, listener, options); | 127 return addEventListener(eventType, listener, options); |
| 128 } | 128 } |
| 129 return addEventListener(eventType, listener); | 129 return addEventListener(eventType, listener); |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<Eve
ntListener> listener, EventListenerOptions& options) | 132 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtrWill
BeRawPtr<EventListener> listener, EventListenerOptions& options) |
| 133 { | 133 { |
| 134 setDefaultEventListenerOptions(options); | 134 setDefaultEventListenerOptions(options); |
| 135 return addEventListenerInternal(eventType, listener, options); | 135 return addEventListenerInternal(eventType, listener, options); |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool EventTarget::addEventListenerInternal(const AtomicString& eventType, PassRe
fPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& options) | 138 bool EventTarget::addEventListenerInternal(const AtomicString& eventType, PassRe
fPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& options) |
| 139 { | 139 { |
| 140 if (!listener) | 140 if (!listener) |
| 141 return false; | 141 return false; |
| 142 | 142 |
| 143 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo
ggerIfIsolatedWorld(); | 143 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo
ggerIfIsolatedWorld(); |
| 144 if (activityLogger) { | 144 if (activityLogger) { |
| 145 Vector<String> argv; | 145 Vector<String> argv; |
| 146 argv.append(toNode() ? toNode()->nodeName() : interfaceName()); | 146 argv.append(toNode() ? toNode()->nodeName() : interfaceName()); |
| 147 argv.append(eventType); | 147 argv.append(eventType); |
| 148 activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data
()); | 148 activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data
()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 return ensureEventTargetData().eventListenerMap.add(eventType, listener, opt
ions); | 151 return ensureEventTargetData().eventListenerMap.add(eventType, listener, opt
ions); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool EventTarget::removeEventListener(const AtomicString& eventType, PassRefPtrW
illBeRawPtr<EventListener> listener, bool useCapture) | 154 bool EventTarget::removeEventListener(const AtomicString& eventType, PassRefPtrW
illBeRawPtr<EventListener> listener, bool useCapture) |
| 155 { | 155 { |
| 156 EventListenerOptions options; | 156 EventListenerOptions options; |
| 157 setDefaultEventListenerOptionsLegacy(options, useCapture); | 157 setDefaultEventListenerOptionsLegacy(options, useCapture); |
| 158 return removeEventListenerInternal(eventType, listener, options); | 158 return removeEventListenerInternal(eventType, listener, options); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool EventTarget::removeEventListener(const AtomicString& eventType, PassRefPtr<
EventListener> listener, const EventListenerOptionsOrBoolean& optionsUnion) | 161 bool EventTarget::removeEventListener(const AtomicString& eventType, PassRefPtrW
illBeRawPtr<EventListener> listener, const EventListenerOptionsOrBoolean& option
sUnion) |
| 162 { | 162 { |
| 163 if (optionsUnion.isBoolean()) | 163 if (optionsUnion.isBoolean()) |
| 164 return removeEventListener(eventType, listener, optionsUnion.getAsBoolea
n()); | 164 return removeEventListener(eventType, listener, optionsUnion.getAsBoolea
n()); |
| 165 if (optionsUnion.isEventListenerOptions()) { | 165 if (optionsUnion.isEventListenerOptions()) { |
| 166 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); | 166 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); |
| 167 return removeEventListener(eventType, listener, options); | 167 return removeEventListener(eventType, listener, options); |
| 168 } | 168 } |
| 169 return removeEventListener(eventType, listener); | 169 return removeEventListener(eventType, listener); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool EventTarget::removeEventListener(const AtomicString& eventType, PassRefPtr<
EventListener> listener, EventListenerOptions& options) | 172 bool EventTarget::removeEventListener(const AtomicString& eventType, PassRefPtrW
illBeRawPtr<EventListener> listener, EventListenerOptions& options) |
| 173 { | 173 { |
| 174 setDefaultEventListenerOptions(options); | 174 setDefaultEventListenerOptions(options); |
| 175 return removeEventListenerInternal(eventType, listener, options); | 175 return removeEventListenerInternal(eventType, listener, options); |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool EventTarget::removeEventListenerInternal(const AtomicString& eventType, Pas
sRefPtr<EventListener> listener, const EventListenerOptions& options) | 178 bool EventTarget::removeEventListenerInternal(const AtomicString& eventType, Pas
sRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& options
) |
| 179 { | 179 { |
| 180 if (!listener) | 180 if (!listener) |
| 181 return false; | 181 return false; |
| 182 | 182 |
| 183 EventTargetData* d = eventTargetData(); | 183 EventTargetData* d = eventTargetData(); |
| 184 if (!d) | 184 if (!d) |
| 185 return false; | 185 return false; |
| 186 | 186 |
| 187 size_t indexOfRemovedListener; | 187 size_t indexOfRemovedListener; |
| 188 | 188 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // they have one less listener to invoke. | 465 // they have one less listener to invoke. |
| 466 if (d->firingEventIterators) { | 466 if (d->firingEventIterators) { |
| 467 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 467 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
| 468 d->firingEventIterators->at(i).iterator = 0; | 468 d->firingEventIterators->at(i).iterator = 0; |
| 469 d->firingEventIterators->at(i).end = 0; | 469 d->firingEventIterators->at(i).end = 0; |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 | 473 |
| 474 } // namespace blink | 474 } // namespace blink |
| OLD | NEW |