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

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

Issue 2247963002: Suppress drag and drop on links on touch screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase mac result so it uses the expected txt shared by all platforms Created 4 years, 4 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
Index: third_party/WebKit/Source/core/input/GestureManager.cpp
diff --git a/third_party/WebKit/Source/core/input/GestureManager.cpp b/third_party/WebKit/Source/core/input/GestureManager.cpp
index 8d4d8390eb015b979de2c88dc43261cbc08c0766..823c22e6d78ba9da3c6711387fe461616a1d2f09 100644
--- a/third_party/WebKit/Source/core/input/GestureManager.cpp
+++ b/third_party/WebKit/Source/core/input/GestureManager.cpp
@@ -254,14 +254,18 @@ WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit
// supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code
// and LongPress is such a special scenario that it's unlikely to matter much in practice.
+ IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.position());
+ HitTestResult hitTestResult = m_frame->eventHandler().hitTestResultAtPoint(hitTestPoint);
+
m_longTapShouldInvokeContextMenu = false;
- if (m_frame->eventHandler().handleDragDropIfPossible(targetedEvent)) {
+ bool hitTestContainsLinks = hitTestResult.URLElement() || !hitTestResult.absoluteImageURL().isNull() || !hitTestResult.absoluteMediaURL().isNull();
+
+ if (!hitTestContainsLinks && m_frame->eventHandler().handleDragDropIfPossible(targetedEvent)) {
m_longTapShouldInvokeContextMenu = true;
return WebInputEventResult::HandledSystem;
}
- IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.position());
- HitTestResult result = m_frame->eventHandler().hitTestResultAtPoint(hitTestPoint);
- if (m_selectionController->handleGestureLongPress(gestureEvent, result)) {
+
+ if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResult)) {
m_frame->eventHandler().focusDocumentView();
return WebInputEventResult::HandledSystem;
}

Powered by Google App Engine
This is Rietveld 408576698