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

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

Issue 2475443004: Add use counter when touch-action isn't used when preventDefault'd. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static const double kBlockedWarningThresholdMillis = 100.0; 62 static const double kBlockedWarningThresholdMillis = 100.0;
63 63
64 enum PassiveForcedListenerResultType { 64 enum PassiveForcedListenerResultType {
65 PreventDefaultNotCalled, 65 PreventDefaultNotCalled,
66 DocumentLevelTouchPreventDefaultCalled, 66 DocumentLevelTouchPreventDefaultCalled,
67 PassiveForcedListenerResultTypeMax 67 PassiveForcedListenerResultTypeMax
68 }; 68 };
69 69
70 Event::PassiveMode eventPassiveMode( 70 Event::PassiveMode eventPassiveMode(
71 const RegisteredEventListener& eventListener) { 71 const RegisteredEventListener& eventListener) {
72 if (!eventListener.passive()) 72 if (!eventListener.passive()) {
73 return Event::PassiveMode::NotPassive; 73 if (eventListener.passiveSpecified())
74 return Event::PassiveMode::NotPassive;
75 return Event::PassiveMode::NotPassiveDefault;
76 }
74 if (eventListener.passiveForcedForDocumentTarget()) 77 if (eventListener.passiveForcedForDocumentTarget())
75 return Event::PassiveMode::PassiveForcedDocumentLevel; 78 return Event::PassiveMode::PassiveForcedDocumentLevel;
76 return Event::PassiveMode::Passive; 79 if (eventListener.passiveSpecified())
80 return Event::PassiveMode::Passive;
81 return Event::PassiveMode::PassiveDefault;
77 } 82 }
78 83
79 Settings* windowSettings(LocalDOMWindow* executingWindow) { 84 Settings* windowSettings(LocalDOMWindow* executingWindow) {
80 if (executingWindow) { 85 if (executingWindow) {
81 if (LocalFrame* frame = executingWindow->frame()) { 86 if (LocalFrame* frame = executingWindow->frame()) {
82 return frame->settings(); 87 return frame->settings();
83 } 88 }
84 } 89 }
85 return nullptr; 90 return nullptr;
86 } 91 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 190
186 inline LocalDOMWindow* EventTarget::executingWindow() { 191 inline LocalDOMWindow* EventTarget::executingWindow() {
187 if (ExecutionContext* context = getExecutionContext()) 192 if (ExecutionContext* context = getExecutionContext())
188 return context->executingWindow(); 193 return context->executingWindow();
189 return nullptr; 194 return nullptr;
190 } 195 }
191 196
192 void EventTarget::setDefaultAddEventListenerOptions( 197 void EventTarget::setDefaultAddEventListenerOptions(
193 const AtomicString& eventType, 198 const AtomicString& eventType,
194 AddEventListenerOptionsResolved& options) { 199 AddEventListenerOptionsResolved& options) {
200 options.setPassiveSpecified(options.hasPassive());
201
195 if (!isScrollBlockingEvent(eventType)) { 202 if (!isScrollBlockingEvent(eventType)) {
196 if (!options.hasPassive()) 203 if (!options.hasPassive())
197 options.setPassive(false); 204 options.setPassive(false);
198 return; 205 return;
199 } 206 }
200 207
201 if (LocalDOMWindow* executingWindow = this->executingWindow()) { 208 if (LocalDOMWindow* executingWindow = this->executingWindow()) {
202 if (options.hasPassive()) { 209 if (options.hasPassive()) {
203 UseCounter::count(executingWindow->document(), 210 UseCounter::count(executingWindow->document(),
204 options.passive() 211 options.passive()
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // they have one less listener to invoke. 765 // they have one less listener to invoke.
759 if (d->firingEventIterators) { 766 if (d->firingEventIterators) {
760 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 767 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
761 d->firingEventIterators->at(i).iterator = 0; 768 d->firingEventIterators->at(i).iterator = 0;
762 d->firingEventIterators->at(i).end = 0; 769 d->firingEventIterators->at(i).end = 0;
763 } 770 }
764 } 771 }
765 } 772 }
766 773
767 } // namespace blink 774 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.cpp ('k') | third_party/WebKit/Source/core/events/RegisteredEventListener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698