| OLD | NEW |
| 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 Loading... |
| 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
oluteImageURL().isNull() || !hitTestResult.absoluteMediaURL().isNull(); |
| 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 Loading... |
| 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 |
| OLD | NEW |