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

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

Issue 1563623002: Support registering and dispatching passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust comments in layout tests Created 4 years, 11 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 8cd66c359df7180d1f6474ab597a7a2d126f3bf1..a1cc09b7edb149a62d0f61c4346fe1f47c3a8bfb 100644
--- a/third_party/WebKit/Source/core/events/EventTarget.cpp
+++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -52,6 +52,7 @@ namespace {
void setDefaultEventListenerOptionsLegacy(EventListenerOptions& options, bool useCapture)
{
options.setCapture(useCapture);
+ options.setPassive(false);
}
void setDefaultEventListenerOptions(EventListenerOptions& options)
@@ -63,6 +64,8 @@ void setDefaultEventListenerOptions(EventListenerOptions& options)
// capture is true; with the setting on capture is false.
if (!options.hasCapture())
options.setCapture(!RuntimeEnabledFeatures::eventListenerOptionsEnabled());
+ if (!options.hasPassive())
+ options.setPassive(false);
}
} // namespace
@@ -428,11 +431,15 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
if (!context)
break;
+ event->setHandlingPassive(registeredListener.passive);
+
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willHandleEvent(this, event, registeredListener.listener.get(), registeredListener.useCapture);
// To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
// event listeners, even though that violates some versions of the DOM spec.
registeredListener.listener->handleEvent(context, event);
+ event->setHandlingPassive(false);
+
RELEASE_ASSERT(i <= size);
InspectorInstrumentation::didHandleEvent(cookie);

Powered by Google App Engine
This is Rietveld 408576698