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

Side by Side 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: remove setting and apply the behavior change to all platforms Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/input/GestureManager.h" 5 #include "core/input/GestureManager.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/editing/SelectionController.h" 8 #include "core/editing/SelectionController.h"
9 #include "core/events/GestureEvent.h" 9 #include "core/events/GestureEvent.h"
10 #include "core/frame/FrameHost.h" 10 #include "core/frame/FrameHost.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit hHitTestResults& targetedEvent) 249 WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit hHitTestResults& targetedEvent)
250 { 250 {
251 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); 251 const PlatformGestureEvent& gestureEvent = targetedEvent.event();
252 252
253 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the 253 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests here (re-using the
254 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code 254 // supplied HitTestResult), but that will require some overhaul of the touch drag-and-drop code
255 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice. 255 // and LongPress is such a special scenario that it's unlikely to matter muc h in practice.
256 256
257 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition());
258 HitTestResult hitTestResult = m_frame->eventHandler().hitTestResultAtPoint(h itTestPoint);
259
257 m_longTapShouldInvokeContextMenu = false; 260 m_longTapShouldInvokeContextMenu = false;
258 if (m_frame->eventHandler().handleDragDropIfPossible(targetedEvent)) { 261 bool hitTestContainsLinks = hitTestResult.URLElement() || !hitTestResult.abs oluteLinkURL().isNull() || !hitTestResult.absoluteImageURL().isNull() || !hitTes tResult.absoluteMediaURL().isNull();
dcheng 2016/08/29 19:45:08 This isn't just links, right? It's images and vide
hush (inactive) 2016/08/29 20:49:49 Yes. Long pressing on images and videos should ope
dcheng 2016/08/29 21:10:03 As discussed offline, I think we can just check Hi
hush (inactive) 2016/08/29 21:14:53 Done.
262
263 if (!hitTestContainsLinks && m_frame->eventHandler().handleDragDropIfPossibl e(targetedEvent)) {
259 m_longTapShouldInvokeContextMenu = true; 264 m_longTapShouldInvokeContextMenu = true;
260 return WebInputEventResult::HandledSystem; 265 return WebInputEventResult::HandledSystem;
261 } 266 }
262 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition()); 267
263 HitTestResult result = m_frame->eventHandler().hitTestResultAtPoint(hitTestP oint); 268 if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResul t)) {
264 if (m_selectionController->handleGestureLongPress(gestureEvent, result)) {
265 m_frame->eventHandler().focusDocumentView(); 269 m_frame->eventHandler().focusDocumentView();
266 return WebInputEventResult::HandledSystem; 270 return WebInputEventResult::HandledSystem;
267 } 271 }
268 272
269 return sendContextMenuEventForGesture(targetedEvent); 273 return sendContextMenuEventForGesture(targetedEvent);
270 } 274 }
271 275
272 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH itTestResults& targetedEvent) 276 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH itTestResults& targetedEvent)
273 { 277 {
274 #if !OS(ANDROID) 278 #if !OS(ANDROID)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 350
347 return &m_frame->page()->frameHost(); 351 return &m_frame->page()->frameHost();
348 } 352 }
349 353
350 double GestureManager::getLastShowPressTimestamp() const 354 double GestureManager::getLastShowPressTimestamp() const
351 { 355 {
352 return m_lastShowPressTimestamp; 356 return m_lastShowPressTimestamp;
353 } 357 }
354 358
355 } // namespace blink 359 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698