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

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: Whoops missed updating a file 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 namespace { 60 namespace {
61 61
62 enum PassiveForcedListenerResultType { 62 enum PassiveForcedListenerResultType {
63 PreventDefaultNotCalled, 63 PreventDefaultNotCalled,
64 DocumentLevelTouchPreventDefaultCalled, 64 DocumentLevelTouchPreventDefaultCalled,
65 PassiveForcedListenerResultTypeMax 65 PassiveForcedListenerResultTypeMax
66 }; 66 };
67 67
68 Event::PassiveMode eventPassiveMode( 68 Event::PassiveMode eventPassiveMode(
69 const RegisteredEventListener& eventListener) { 69 const RegisteredEventListener& eventListener) {
70 if (!eventListener.passive()) 70 if (!eventListener.passive()) {
71 return Event::PassiveMode::NotPassive; 71 if (eventListener.passiveSpecified())
72 return Event::PassiveMode::NotPassive;
73 return Event::PassiveMode::NotPassiveDefault;
74 }
72 if (eventListener.passiveForcedForDocumentTarget()) 75 if (eventListener.passiveForcedForDocumentTarget())
73 return Event::PassiveMode::PassiveForcedDocumentLevel; 76 return Event::PassiveMode::PassiveForcedDocumentLevel;
74 return Event::PassiveMode::Passive; 77 if (eventListener.passiveSpecified())
78 return Event::PassiveMode::Passive;
79 return Event::PassiveMode::PassiveDefault;
75 } 80 }
76 81
77 Settings* windowSettings(LocalDOMWindow* executingWindow) { 82 Settings* windowSettings(LocalDOMWindow* executingWindow) {
78 if (executingWindow) { 83 if (executingWindow) {
79 if (LocalFrame* frame = executingWindow->frame()) { 84 if (LocalFrame* frame = executingWindow->frame()) {
80 return frame->settings(); 85 return frame->settings();
81 } 86 }
82 } 87 }
83 return nullptr; 88 return nullptr;
84 } 89 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 198
194 inline LocalDOMWindow* EventTarget::executingWindow() { 199 inline LocalDOMWindow* EventTarget::executingWindow() {
195 if (ExecutionContext* context = getExecutionContext()) 200 if (ExecutionContext* context = getExecutionContext())
196 return context->executingWindow(); 201 return context->executingWindow();
197 return nullptr; 202 return nullptr;
198 } 203 }
199 204
200 void EventTarget::setDefaultAddEventListenerOptions( 205 void EventTarget::setDefaultAddEventListenerOptions(
201 const AtomicString& eventType, 206 const AtomicString& eventType,
202 AddEventListenerOptionsResolved& options) { 207 AddEventListenerOptionsResolved& options) {
208 options.setPassiveSpecified(options.hasPassive());
209
203 if (!isScrollBlockingEvent(eventType)) { 210 if (!isScrollBlockingEvent(eventType)) {
204 if (!options.hasPassive()) 211 if (!options.hasPassive())
205 options.setPassive(false); 212 options.setPassive(false);
206 return; 213 return;
207 } 214 }
208 215
209 if (LocalDOMWindow* executingWindow = this->executingWindow()) { 216 if (LocalDOMWindow* executingWindow = this->executingWindow()) {
210 if (options.hasPassive()) { 217 if (options.hasPassive()) {
211 UseCounter::count(executingWindow->document(), 218 UseCounter::count(executingWindow->document(),
212 options.passive() 219 options.passive()
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // they have one less listener to invoke. 773 // they have one less listener to invoke.
767 if (d->firingEventIterators) { 774 if (d->firingEventIterators) {
768 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 775 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
769 d->firingEventIterators->at(i).iterator = 0; 776 d->firingEventIterators->at(i).iterator = 0;
770 d->firingEventIterators->at(i).end = 0; 777 d->firingEventIterators->at(i).end = 0;
771 } 778 }
772 } 779 }
773 } 780 }
774 781
775 } // namespace blink 782 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698