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

Unified Diff: third_party/WebKit/Source/core/input/TouchEventManager.cpp

Issue 2414273003: Remove UserGesture on touch scrolls (Closed)
Patch Set: Improve comments 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
« no previous file with comments | « third_party/WebKit/Source/core/input/TouchEventManager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/TouchEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
index 8cbaab593786745703e2db82a91ca6fa5f5c0b07..54bddcf9a432ff66a204eeee84f46d20b70633e5 100644
--- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -5,7 +5,6 @@
#include "core/input/TouchEventManager.h"
#include "core/dom/Document.h"
-#include "core/dom/DocumentUserGestureToken.h"
#include "core/events/TouchEvent.h"
#include "core/frame/Deprecation.h"
#include "core/frame/EventHandlerRegistry.h"
@@ -91,11 +90,9 @@ TouchEventManager::TouchEventManager(LocalFrame* frame) : m_frame(frame) {
void TouchEventManager::clear() {
m_touchSequenceDocument.clear();
- m_touchSequenceUserGestureToken.clear();
m_targetForTouchID.clear();
m_regionForTouchID.clear();
m_touchPressed = false;
- m_touchScrollStarted = false;
m_currentEvent = PlatformEvent::NoType;
}
@@ -125,8 +122,7 @@ WebInputEventResult TouchEventManager::dispatchTouchEvents(
// Array of touches per state, used to assemble the |changedTouches| list.
ChangedTouches changedTouches[PlatformTouchPoint::TouchStateEnd];
- for (unsigned i = 0; i < touchInfos.size(); ++i) {
- const TouchInfo& touchInfo = touchInfos[i];
+ for (auto touchInfo : touchInfos) {
const PlatformTouchPoint& point = touchInfo.point;
PlatformTouchPoint::TouchState pointState = point.state();
@@ -171,7 +167,6 @@ WebInputEventResult TouchEventManager::dispatchTouchEvents(
if (allTouchesReleased) {
m_touchSequenceDocument.clear();
- m_touchSequenceUserGestureToken.clear();
}
WebInputEventResult eventResult = WebInputEventResult::NotHandled;
@@ -266,9 +261,6 @@ WebInputEventResult TouchEventManager::dispatchTouchEvents(
}
}
- if (allTouchesReleased)
- m_touchScrollStarted = false;
-
return eventResult;
}
@@ -433,7 +425,6 @@ bool TouchEventManager::reHitTestTouchPointsIfNeeded(
// there may be cases where the browser doesn't reliably release all
// touches. http://crbug.com/345372 tracks this.
m_touchSequenceDocument.clear();
- m_touchSequenceUserGestureToken.clear();
}
ASSERT(m_frame->view());
@@ -457,7 +448,6 @@ bool TouchEventManager::reHitTestTouchPointsIfNeeded(
!m_touchSequenceDocument->frame()) {
if (allTouchesReleased) {
m_touchSequenceDocument.clear();
- m_touchSequenceUserGestureToken.clear();
}
return false;
}
@@ -500,46 +490,6 @@ WebInputEventResult TouchEventManager::handleTouchEvent(
allTouchesReleased = false;
}
- // Whether a touch should be considered a "user gesture" or not is a tricky
- // question.
- // https://docs.google.com/document/d/1oF1T3O7_E4t1PYHV6gyCwHxOi3ystm0eSL5xZu7nvOg/edit#
-
- // The touchend corresponding to a tap is always a user gesture.
- bool isTap =
- event.touchPoints().size() == 1 &&
- event.touchPoints()[0].state() == PlatformTouchPoint::TouchReleased &&
- !event.causesScrollingIfUncanceled();
-
- // For now, disallow dragging as a user gesture when the events are being sent
- // to a cross-origin iframe (crbug.com/582140).
- bool isSameOrigin = false;
- if (m_touchSequenceDocument && m_touchSequenceDocument->frame()) {
- SecurityOrigin* securityOrigin = m_touchSequenceDocument->frame()
- ->securityContext()
- ->getSecurityOrigin();
- Frame* top = m_frame->tree().top();
- if (top &&
- securityOrigin->canAccess(top->securityContext()->getSecurityOrigin()))
- isSameOrigin = true;
- }
-
- std::unique_ptr<UserGestureIndicator> gestureIndicator;
- if (isTap || isSameOrigin) {
- gestureIndicator = wrapUnique(new UserGestureIndicator(
- m_touchSequenceUserGestureToken
- ? m_touchSequenceUserGestureToken.release()
- : DocumentUserGestureToken::create(m_touchSequenceDocument)));
-
- m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
- // These are cases we'd like to migrate to not hold a user gesture.
- if (event.type() == PlatformEvent::TouchStart ||
- event.type() == PlatformEvent::TouchMove ||
- (event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted)) {
- // Collect metrics in userGestureUtilized().
- m_touchSequenceUserGestureToken->setUserGestureUtilizedCallback(this);
- }
- }
-
return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
}
@@ -547,28 +497,4 @@ bool TouchEventManager::isAnyTouchActive() const {
return m_touchPressed;
}
-void TouchEventManager::userGestureUtilized() {
- // This is invoked for UserGestureIndicators created in
- // TouchEventManger::handleTouchEvent which perhaps represent touch actions
- // which shouldn't be considered a user-gesture. Trigger a UseCounter based
- // on the touch event that's currently being dispatched.
- UseCounter::Feature feature;
-
- switch (m_currentEvent) {
- case PlatformEvent::TouchStart:
- feature = UseCounter::TouchStartUserGestureUtilized;
- break;
- case PlatformEvent::TouchMove:
- feature = UseCounter::TouchMoveUserGestureUtilized;
- break;
- case PlatformEvent::TouchEnd:
- feature = UseCounter::TouchEndDuringScrollUserGestureUtilized;
- break;
- default:
- NOTREACHED();
- return;
- }
- Deprecation::countDeprecation(m_frame, feature);
-}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/input/TouchEventManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698