Chromium Code Reviews| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 118 |
| 119 inline LocalDOMWindow* EventTarget::executingWindow() | 119 inline LocalDOMWindow* EventTarget::executingWindow() |
| 120 { | 120 { |
| 121 if (ExecutionContext* context = getExecutionContext()) | 121 if (ExecutionContext* context = getExecutionContext()) |
| 122 return context->executingWindow(); | 122 return context->executingWindow(); |
| 123 return nullptr; | 123 return nullptr; |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) | 126 bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) |
| 127 { | 127 { |
| 128 if (LocalDOMWindow* executingWindow = this->executingWindow()) { | |
| 129 UseCounter::count(executingWindow->document(), UseCounter::PointerEventA ddListenerCount); | |
| 130 } | |
| 128 EventListenerOptions options; | 131 EventListenerOptions options; |
| 129 setDefaultEventListenerOptionsLegacy(options, useCapture); | 132 setDefaultEventListenerOptionsLegacy(options, useCapture); |
| 130 return addEventListenerInternal(eventType, listener, options); | 133 return addEventListenerInternal(eventType, listener, options); |
| 131 } | 134 } |
| 132 | 135 |
| 133 bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, const EventListenerOptionsOrBoolean& optionsUnion) | 136 bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, const EventListenerOptionsOrBoolean& optionsUnion) |
| 134 { | 137 { |
| 135 if (optionsUnion.isBoolean()) | 138 if (optionsUnion.isBoolean()) |
| 136 return addEventListener(eventType, listener, optionsUnion.getAsBoolean() ); | 139 return addEventListener(eventType, listener, optionsUnion.getAsBoolean() ); |
| 137 if (optionsUnion.isEventListenerOptions()) { | 140 if (optionsUnion.isEventListenerOptions()) { |
| 138 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); | 141 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); |
| 139 return addEventListener(eventType, listener, options); | 142 return addEventListener(eventType, listener, options); |
| 140 } | 143 } |
| 141 return addEventListener(eventType, listener); | 144 return addEventListener(eventType, listener); |
| 142 } | 145 } |
| 143 | 146 |
| 144 bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, EventListenerOptions& options) | 147 bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, EventListenerOptions& options) |
| 145 { | 148 { |
| 149 if (LocalDOMWindow* executingWindow = this->executingWindow()) { | |
| 150 UseCounter::count(executingWindow->document(), UseCounter::PointerEventA ddListenerCount); | |
| 151 } | |
| 146 setDefaultEventListenerOptions(options); | 152 setDefaultEventListenerOptions(options); |
| 147 return addEventListenerInternal(eventType, listener, options); | 153 return addEventListenerInternal(eventType, listener, options); |
|
mustaq
2016/05/03 14:40:22
- Check if it is a PointerEvent type. Otherwise, w
tdresser
2016/05/03 16:13:46
Whoooops.
Good catch...
| |
| 148 } | 154 } |
| 149 | 155 |
| 150 bool EventTarget::addEventListenerInternal(const AtomicString& eventType, EventL istener* listener, const EventListenerOptions& options) | 156 bool EventTarget::addEventListenerInternal(const AtomicString& eventType, EventL istener* listener, const EventListenerOptions& options) |
| 151 { | 157 { |
| 152 if (!listener) | 158 if (!listener) |
| 153 return false; | 159 return false; |
| 154 | 160 |
| 155 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo ggerIfIsolatedWorld(); | 161 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo ggerIfIsolatedWorld(); |
| 156 if (activityLogger) { | 162 if (activityLogger) { |
| 157 Vector<String> argv; | 163 Vector<String> argv; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 // they have one less listener to invoke. | 497 // they have one less listener to invoke. |
| 492 if (d->firingEventIterators) { | 498 if (d->firingEventIterators) { |
| 493 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { | 499 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { |
| 494 d->firingEventIterators->at(i).iterator = 0; | 500 d->firingEventIterators->at(i).iterator = 0; |
| 495 d->firingEventIterators->at(i).end = 0; | 501 d->firingEventIterators->at(i).end = 0; |
| 496 } | 502 } |
| 497 } | 503 } |
| 498 } | 504 } |
| 499 | 505 |
| 500 } // namespace blink | 506 } // namespace blink |
| OLD | NEW |