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

Unified Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 1922093003: Add AddEventListenerOptions addEventListenerOptions interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/events/EventTarget.cpp
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp
index 55f80e05075c26069a4d01113f5e57cbda2da11d..be7d44b56131554be39135e30de53d296a8c9b3a 100644
--- a/third_party/WebKit/Source/core/events/EventTarget.cpp
+++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -52,6 +52,11 @@ namespace {
void setDefaultEventListenerOptionsLegacy(EventListenerOptions& options, bool useCapture)
{
options.setCapture(useCapture);
+}
+
+void setDefaultAddEventListenerOptionsLegacy(AddEventListenerOptions& options, bool useCapture)
+{
+ setDefaultEventListenerOptionsLegacy(options, useCapture);
options.setPassive(false);
}
@@ -64,6 +69,11 @@ void setDefaultEventListenerOptions(EventListenerOptions& options)
// capture is true; with the setting on capture is false.
if (!options.hasCapture())
options.setCapture(!RuntimeEnabledFeatures::eventListenerOptionsEnabled());
+}
+
+void setDefaultAddEventListenerOptions(AddEventListenerOptions& options)
+{
+ setDefaultEventListenerOptions(options);
if (!options.hasPassive())
options.setPassive(false);
}
@@ -125,29 +135,29 @@ inline LocalDOMWindow* EventTarget::executingWindow()
bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture)
{
- EventListenerOptions options;
- setDefaultEventListenerOptionsLegacy(options, useCapture);
+ AddEventListenerOptions options;
+ setDefaultAddEventListenerOptionsLegacy(options, useCapture);
return addEventListenerInternal(eventType, listener, options);
}
-bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, const EventListenerOptionsOrBoolean& optionsUnion)
+bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, const AddEventListenerOptionsOrBoolean& optionsUnion)
{
if (optionsUnion.isBoolean())
return addEventListener(eventType, listener, optionsUnion.getAsBoolean());
- if (optionsUnion.isEventListenerOptions()) {
- EventListenerOptions options = optionsUnion.getAsEventListenerOptions();
+ if (optionsUnion.isAddEventListenerOptions()) {
+ AddEventListenerOptions options = optionsUnion.getAsAddEventListenerOptions();
return addEventListener(eventType, listener, options);
}
return addEventListener(eventType, listener);
}
-bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, EventListenerOptions& options)
+bool EventTarget::addEventListener(const AtomicString& eventType, EventListener* listener, AddEventListenerOptions& options)
{
- setDefaultEventListenerOptions(options);
+ setDefaultAddEventListenerOptions(options);
return addEventListenerInternal(eventType, listener, options);
}
-bool EventTarget::addEventListenerInternal(const AtomicString& eventType, EventListener* listener, const EventListenerOptions& options)
+bool EventTarget::addEventListenerInternal(const AtomicString& eventType, EventListener* listener, const AddEventListenerOptions& options)
{
if (!listener)
return false;
« no previous file with comments | « third_party/WebKit/Source/core/events/EventTarget.h ('k') | third_party/WebKit/Source/core/events/EventTarget.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698