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

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

Issue 1956493002: Remove user gestures on touches other than tap in cross-origin iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with trunk Created 4 years, 7 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/input/EventHandler.cpp ('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 b9d4ce34a59e7419d82c69c22c6d15690a7fc71e..23c662db3de37c89c572522c479f0b4547ae49c8 100644
--- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -467,21 +467,35 @@ WebInputEventResult TouchEventManager::handleTouchEvent(
// Whether a touch should be considered a "user gesture" or not is a tricky question.
// https://docs.google.com/document/d/1oF1T3O7_E4t1PYHV6gyCwHxOi3ystm0eSL5xZu7nvOg/edit#
- // TODO(rbyers): Disable user gesture in some cases but retain logging for now (crbug.com/582140).
- OwnPtr<UserGestureIndicator> gestureIndicator;
- if (event.touchPoints().size() == 1
+
+ // 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()) {
- // This is a touchend corresponding to a tap, definitely a user gesture. So don't supply
- // a UserGestureUtilizedCallback.
- gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture));
- } else {
- // This is some other touch event that perhaps shouldn't be considered a user gesture. So
- // use a UserGestureUtilizedCallback to get metrics / deprecation warnings.
+ && !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;
+ }
+
+ OwnPtr<UserGestureIndicator> gestureIndicator;
+ if (isTap || isSameOrigin) {
+ UserGestureUtilizedCallback* callback = 0;
+ if (!isTap) {
+ // This is some other touch event that we currently consider a user gesture. So
+ // use a UserGestureUtilizedCallback to get metrics.
+ callback = &m_touchSequenceDocument->frame()->eventHandler();
+ }
+
if (m_touchSequenceUserGestureToken)
- gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), &m_touchSequenceDocument->frame()->eventHandler()));
+ gestureIndicator = adoptPtr(new UserGestureIndicator(m_touchSequenceUserGestureToken.release(), callback));
else
- gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture, &m_touchSequenceDocument->frame()->eventHandler()));
+ gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingUserGesture, callback));
m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
}
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698