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

Unified Diff: third_party/WebKit/Source/core/events/TouchEvent.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 side-by-side diff with in-line comments
Download patch
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 9821312462af9c5127ff4c3469587cd7be3343b4..685e4c01bfc205f05536e96ce2bb62f9b81ca6b4 100644
--- a/third_party/WebKit/Source/core/events/TouchEvent.cpp
+++ b/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -210,7 +210,8 @@ TouchEvent::TouchEvent(TouchList* touches,
bool cancelable,
bool causesScrollingIfUncanceled,
bool firstTouchMoveOrStart,
- double platformTimeStamp)
+ double platformTimeStamp,
+ TouchAction currentTouchAction)
// Pass a sourceCapabilities including the ability to fire touchevents when
// creating this touchevent, which is always created from input device
// capabilities from EventHandler.
@@ -228,7 +229,8 @@ TouchEvent::TouchEvent(TouchList* touches,
m_changedTouches(changedTouches),
m_causesScrollingIfUncanceled(causesScrollingIfUncanceled),
m_firstTouchMoveOrStart(firstTouchMoveOrStart),
- m_defaultPreventedBeforeCurrentTarget(false) {}
+ m_defaultPreventedBeforeCurrentTarget(false),
+ m_currentTouchAction(currentTouchAction) {}
TouchEvent::TouchEvent(const AtomicString& type,
const TouchEventInit& initializer)
@@ -265,6 +267,24 @@ void TouchEvent::preventDefault() {
"because scrolling is in progress and "
"cannot be interrupted."));
}
+
+ if ((type() == EventTypeNames::touchstart ||
+ type() == EventTypeNames::touchmove) &&
+ view()->frame() && m_currentTouchAction == TouchActionAuto) {
+ switch (handlingPassive()) {
+ case PassiveMode::NotPassiveDefault:
+ UseCounter::count(view()->frame(),
+ UseCounter::TouchEventPreventedNoTouchAction);
+ break;
+ case PassiveMode::PassiveForcedDocumentLevel:
+ UseCounter::count(
+ view()->frame(),
+ UseCounter::TouchEventPreventedForcedDocumentPassiveNoTouchAction);
+ break;
+ default:
+ break;
+ }
+ }
}
void TouchEvent::doneDispatchingEventAtCurrentTarget() {

Powered by Google App Engine
This is Rietveld 408576698