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

Side by Side Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 1956733002: Remove EventListenerOptions runtime enable setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_add_event_listener_options
Patch Set: Amend unit tests Created 4 years, 7 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
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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 { 53 {
54 options.setCapture(useCapture); 54 options.setCapture(useCapture);
55 } 55 }
56 56
57 void setDefaultAddEventListenerOptionsLegacy(AddEventListenerOptions& options, b ool useCapture) 57 void setDefaultAddEventListenerOptionsLegacy(AddEventListenerOptions& options, b ool useCapture)
58 { 58 {
59 setDefaultEventListenerOptionsLegacy(options, useCapture); 59 setDefaultEventListenerOptionsLegacy(options, useCapture);
60 options.setPassive(false); 60 options.setPassive(false);
61 } 61 }
62 62
63 void setDefaultEventListenerOptions(EventListenerOptions& options)
64 {
65 // The default for capture is based on whether the eventListenerOptions
66 // runtime setting is enabled. That is
67 // addEventListener('type', function(e) {}, {});
68 // behaves differently under the setting. With the setting off
69 // capture is true; with the setting on capture is false.
70 if (!options.hasCapture())
71 options.setCapture(!RuntimeEnabledFeatures::eventListenerOptionsEnabled( ));
72 }
73
74 void setDefaultAddEventListenerOptions(AddEventListenerOptions& options) 63 void setDefaultAddEventListenerOptions(AddEventListenerOptions& options)
75 { 64 {
76 setDefaultEventListenerOptions(options);
77 if (!options.hasPassive()) 65 if (!options.hasPassive())
78 options.setPassive(false); 66 options.setPassive(false);
79 } 67 }
80 68
81 } // namespace 69 } // namespace
82 70
83 EventTargetData::EventTargetData() 71 EventTargetData::EventTargetData()
84 { 72 {
85 } 73 }
86 74
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return removeEventListener(eventType, listener, optionsUnion.getAsBoolea n()); 182 return removeEventListener(eventType, listener, optionsUnion.getAsBoolea n());
195 if (optionsUnion.isEventListenerOptions()) { 183 if (optionsUnion.isEventListenerOptions()) {
196 EventListenerOptions options = optionsUnion.getAsEventListenerOptions(); 184 EventListenerOptions options = optionsUnion.getAsEventListenerOptions();
197 return removeEventListener(eventType, listener, options); 185 return removeEventListener(eventType, listener, options);
198 } 186 }
199 return removeEventListener(eventType, listener); 187 return removeEventListener(eventType, listener);
200 } 188 }
201 189
202 bool EventTarget::removeEventListener(const AtomicString& eventType, const Event Listener* listener, EventListenerOptions& options) 190 bool EventTarget::removeEventListener(const AtomicString& eventType, const Event Listener* listener, EventListenerOptions& options)
203 { 191 {
204 setDefaultEventListenerOptions(options);
205 return removeEventListenerInternal(eventType, listener, options); 192 return removeEventListenerInternal(eventType, listener, options);
206 } 193 }
207 194
208 bool EventTarget::removeEventListenerInternal(const AtomicString& eventType, con st EventListener* listener, const EventListenerOptions& options) 195 bool EventTarget::removeEventListenerInternal(const AtomicString& eventType, con st EventListener* listener, const EventListenerOptions& options)
209 { 196 {
210 if (!listener) 197 if (!listener)
211 return false; 198 return false;
212 199
213 EventTargetData* d = eventTargetData(); 200 EventTargetData* d = eventTargetData();
214 if (!d) 201 if (!d)
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // they have one less listener to invoke. 501 // they have one less listener to invoke.
515 if (d->firingEventIterators) { 502 if (d->firingEventIterators) {
516 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 503 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
517 d->firingEventIterators->at(i).iterator = 0; 504 d->firingEventIterators->at(i).iterator = 0;
518 d->firingEventIterators->at(i).end = 0; 505 d->firingEventIterators->at(i).end = 0;
519 } 506 }
520 } 507 }
521 } 508 }
522 509
523 } // namespace blink 510 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventListenerOptions.idl ('k') | third_party/WebKit/Source/core/events/EventTarget.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698