Chromium Code Reviews| 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()); | |
|
dtapuska
2016/08/17 13:39:49
Seems reasonable. I'd like to see a test exercisin
hush (inactive)
2016/08/17 18:09:46
Is it OK for the test to be Android only? The adde
dtapuska
2016/08/17 18:12:46
I believe there are virtual LayoutTests for androi
| |
| 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 willTryDragDrop = true; |
| 262 | |
| 263 #if OS(ANDROID) | |
| 264 if (hitTestResult.URLElement() || !hitTestResult.absoluteLinkURL().isNull() || !hitTestResult.absoluteImageURL().isNull() || !hitTestResult.absoluteMediaURL ().isNull()) | |
| 265 willTryDragDrop = false; | |
| 266 #endif | |
| 267 if (willTryDragDrop && m_frame->eventHandler().handleDragDropIfPossible(targ etedEvent)) { | |
| 259 m_longTapShouldInvokeContextMenu = true; | 268 m_longTapShouldInvokeContextMenu = true; |
| 260 return WebInputEventResult::HandledSystem; | 269 return WebInputEventResult::HandledSystem; |
| 261 } | 270 } |
| 262 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po sition()); | 271 |
| 263 HitTestResult result = m_frame->eventHandler().hitTestResultAtPoint(hitTestP oint); | 272 if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResul t)) { |
| 264 if (m_selectionController->handleGestureLongPress(gestureEvent, result)) { | |
| 265 m_frame->eventHandler().focusDocumentView(); | 273 m_frame->eventHandler().focusDocumentView(); |
| 266 return WebInputEventResult::HandledSystem; | 274 return WebInputEventResult::HandledSystem; |
| 267 } | 275 } |
| 268 | 276 |
| 269 return sendContextMenuEventForGesture(targetedEvent); | 277 return sendContextMenuEventForGesture(targetedEvent); |
| 270 } | 278 } |
| 271 | 279 |
| 272 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH itTestResults& targetedEvent) | 280 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH itTestResults& targetedEvent) |
| 273 { | 281 { |
| 274 #if !OS(ANDROID) | 282 #if !OS(ANDROID) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 | 354 |
| 347 return &m_frame->page()->frameHost(); | 355 return &m_frame->page()->frameHost(); |
| 348 } | 356 } |
| 349 | 357 |
| 350 double GestureManager::getLastShowPressTimestamp() const | 358 double GestureManager::getLastShowPressTimestamp() const |
| 351 { | 359 { |
| 352 return m_lastShowPressTimestamp; | 360 return m_lastShowPressTimestamp; |
| 353 } | 361 } |
| 354 | 362 |
| 355 } // namespace blink | 363 } // namespace blink |
| OLD | NEW |