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

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

Issue 2680973010: Log when PreventDefaulting event forced uncancellable. (Closed)
Patch Set: Rebase Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/events/TouchEventTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/TouchEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/TouchEvent.cpp b/third_party/WebKit/Source/core/events/TouchEvent.cpp
index 066d2c9db8dbecbd529dc828fd56e07c39c97779..d8fbe16ed16f51d6bd72da3fb1214ae40f5b2310 100644
--- a/third_party/WebKit/Source/core/events/TouchEvent.cpp
+++ b/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -253,15 +253,37 @@ void TouchEvent::preventDefault() {
// A common developer error is to wait too long before attempting to stop
// scrolling by consuming a touchmove event. Generate a warning if this
// event is uncancelable.
+ MessageSource messageSource = JSMessageSource;
String warningMessage;
switch (handlingPassive()) {
case PassiveMode::NotPassive:
case PassiveMode::NotPassiveDefault:
if (!cancelable()) {
- warningMessage = "Ignored attempt to cancel a " + type() +
- " event with cancelable=false, for example "
- "because scrolling is in progress and "
- "cannot be interrupted.";
+ UseCounter::count(view()->frame(),
+ UseCounter::UncancellableTouchEventPreventDefaulted);
+
+ if (m_nativeEvent &&
+ m_nativeEvent->dispatchType ==
+ WebInputEvent::
+ ListenersForcedNonBlockingDueToMainThreadResponsiveness) {
+ // Non blocking due to main thread responsiveness.
+ UseCounter::count(
+ view()->frame(),
+ UseCounter::
+ UncancellableTouchEventDueToMainThreadResponsivenessPreventDefaulted);
+ messageSource = InterventionMessageSource;
+ warningMessage =
+ "Ignored attempt to cancel a " + type() +
+ " event with cancelable=false. This event was forced to be "
+ "non-cancellable because the page was too busy to handle the "
+ "event promptly.";
+ } else {
+ // Non blocking for any other reason.
+ warningMessage = "Ignored attempt to cancel a " + type() +
+ " event with cancelable=false, for example "
+ "because scrolling is in progress and "
+ "cannot be interrupted.";
+ }
}
break;
case PassiveMode::PassiveForcedDocumentLevel:
@@ -269,6 +291,7 @@ void TouchEvent::preventDefault() {
// an author may use touch action but call preventDefault for interop with
// browsers that don't support touch-action.
if (m_currentTouchAction == TouchActionAuto) {
+ messageSource = InterventionMessageSource;
warningMessage =
"Unable to preventDefault inside passive event listener due to "
"target being treated as passive. See "
@@ -282,7 +305,7 @@ void TouchEvent::preventDefault() {
if (!warningMessage.isEmpty() && view() && view()->isLocalDOMWindow() &&
view()->frame()) {
toLocalDOMWindow(view())->frame()->console().addMessage(
- ConsoleMessage::create(JSMessageSource, WarningMessageLevel,
+ ConsoleMessage::create(messageSource, WarningMessageLevel,
warningMessage));
}
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/events/TouchEventTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698