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

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

Issue 2125683002: Add option to force document level passive event listeners as a runtime feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 0e63681afa13968b740bfcbab3032796d84d8acf..92bd274edfce15a084ab1bacf2935052978e3aef 100644
--- a/third_party/WebKit/Source/core/events/EventTarget.cpp
+++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -199,6 +199,20 @@ void EventTarget::setDefaultAddEventListenerOptions(const AtomicString& eventTyp
}
}
+ if (RuntimeEnabledFeatures::passiveDocumentEventListenersEnabled()) {
+ if (!options.hasPassive()) {
+ if (Node* node = toNode()) {
+ if (node->isDocumentNode() || node->document().documentElement() == node || node->document().body() == node) {
+ options.setPassive(true);
+ return;
+ }
+ } else if (toLocalDOMWindow()) {
+ options.setPassive(true);
+ return;
+ }
+ }
+ }
+
if (Settings* settings = windowSettings(executingWindow())) {
switch (settings->passiveListenerDefault()) {
case PassiveListenerDefault::False:
@@ -212,17 +226,6 @@ void EventTarget::setDefaultAddEventListenerOptions(const AtomicString& eventTyp
case PassiveListenerDefault::ForceAllTrue:
options.setPassive(true);
break;
- case PassiveListenerDefault::DocumentTrue:
- if (!options.hasPassive()) {
- if (Node* node = toNode()) {
- if (node->isDocumentNode() || node->document().documentElement() == node || node->document().body() == node) {
- options.setPassive(true);
- }
- } else if (toLocalDOMWindow()) {
- options.setPassive(true);
- }
- }
- break;
}
} else {
if (!options.hasPassive())

Powered by Google App Engine
This is Rietveld 408576698