Chromium Code Reviews| 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() + |
|
bokan
2017/02/10 00:24:06
Just checking - you intend for the ForcedNonBlocki
tdresser
2017/02/10 13:24:57
We consider the "due to fling case" to be equivale
bokan
2017/02/10 15:36:16
Acknowledged.
|
| + " 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)); |
| } |