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

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: Rebase 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..b4df51359f30b24c0c8c5e6142b2c2a341dee3ec 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() && 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() {
« no previous file with comments | « third_party/WebKit/Source/core/events/TouchEvent.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698