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

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

Issue 2272993004: Clarify devtools console log when a passive event listener is preventDefaulted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add not reached Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/events/EventTarget.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008, The Android Open Source Project 2 * Copyright 2008, The Android Open Source Project
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright 10 * * Redistributions in binary form must reproduce the above copyright
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return true; 197 return true;
198 } 198 }
199 199
200 void TouchEvent::preventDefault() 200 void TouchEvent::preventDefault()
201 { 201 {
202 UIEventWithKeyState::preventDefault(); 202 UIEventWithKeyState::preventDefault();
203 203
204 // A common developer error is to wait too long before attempting to stop 204 // A common developer error is to wait too long before attempting to stop
205 // scrolling by consuming a touchmove event. Generate a warning if this 205 // scrolling by consuming a touchmove event. Generate a warning if this
206 // event is uncancelable. 206 // event is uncancelable.
207 if (!cancelable() && view() && view()->isLocalDOMWindow() && view()->frame() ) { 207 if (!cancelable() && handlingPassive() == PassiveMode::NotPassive && view() && view()->isLocalDOMWindow() && view()->frame()) {
208 toLocalDOMWindow(view())->frame()->console().addMessage(ConsoleMessage:: create(JSMessageSource, WarningMessageLevel, 208 toLocalDOMWindow(view())->frame()->console().addMessage(ConsoleMessage:: create(JSMessageSource, WarningMessageLevel,
209 "Ignored attempt to cancel a " + type() + " event with cancelable=fa lse, for example because scrolling is in progress and cannot be interrupted.")); 209 "Ignored attempt to cancel a " + type() + " event with cancelable=fa lse, for example because scrolling is in progress and cannot be interrupted."));
210 } 210 }
211 } 211 }
212 212
213 void TouchEvent::doneDispatchingEventAtCurrentTarget() 213 void TouchEvent::doneDispatchingEventAtCurrentTarget()
214 { 214 {
215 // Do not log for non-cancelable events, events that don't block 215 // Do not log for non-cancelable events, events that don't block
216 // scrolling, have more than one touch point or aren't on the main frame. 216 // scrolling, have more than one touch point or aren't on the main frame.
217 if (!cancelable() || !m_firstTouchMoveOrStart || !(m_touches && m_touches->l ength() == 1) || !(view() && view()->frame() && view()->frame()->isMainFrame())) 217 if (!cancelable() || !m_firstTouchMoveOrStart || !(m_touches && m_touches->l ength() == 1) || !(view() && view()->frame() && view()->frame()->isMainFrame()))
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return toTouchEvent(EventDispatchMediator::event()); 250 return toTouchEvent(EventDispatchMediator::event());
251 } 251 }
252 252
253 DispatchEventResult TouchEventDispatchMediator::dispatchEvent(EventDispatcher& d ispatcher) const 253 DispatchEventResult TouchEventDispatchMediator::dispatchEvent(EventDispatcher& d ispatcher) const
254 { 254 {
255 event().eventPath().adjustForTouchEvent(event()); 255 event().eventPath().adjustForTouchEvent(event());
256 return dispatcher.dispatch(); 256 return dispatcher.dispatch();
257 } 257 }
258 258
259 } // namespace blink 259 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventTarget.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698