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/dom/DocumentUserGestureToken.h" | 8 #include "core/dom/DocumentUserGestureToken.h" |
9 #include "core/editing/SelectionController.h" | 9 #include "core/editing/SelectionController.h" |
10 #include "core/events/GestureEvent.h" | 10 #include "core/events/GestureEvent.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 bool style_changed = | 294 bool style_changed = |
295 pre_dispatch_style_version != frame_->GetDocument()->StyleVersion(); | 295 pre_dispatch_style_version != frame_->GetDocument()->StyleVersion(); |
296 | 296 |
297 IntPoint tapped_position_in_viewport = | 297 IntPoint tapped_position_in_viewport = |
298 frame_->GetPage()->GetVisualViewport().RootFrameToViewport( | 298 frame_->GetPage()->GetVisualViewport().RootFrameToViewport( |
299 tapped_position); | 299 tapped_position); |
300 frame_->GetChromeClient().ShowUnhandledTapUIIfNeeded( | 300 frame_->GetChromeClient().ShowUnhandledTapUIIfNeeded( |
301 tapped_position_in_viewport, tapped_node, | 301 tapped_position_in_viewport, tapped_node, |
302 dom_tree_changed || style_changed); | 302 dom_tree_changed || style_changed); |
303 } | 303 } |
| 304 |
304 return event_result; | 305 return event_result; |
305 } | 306 } |
306 | 307 |
307 WebInputEventResult GestureManager::HandleGestureLongPress( | 308 WebInputEventResult GestureManager::HandleGestureLongPress( |
308 const GestureEventWithHitTestResults& targeted_event) { | 309 const GestureEventWithHitTestResults& targeted_event) { |
309 const WebGestureEvent& gesture_event = targeted_event.Event(); | 310 const WebGestureEvent& gesture_event = targeted_event.Event(); |
310 | 311 |
311 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests | 312 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests |
312 // here (re-using the supplied HitTestResult), but that will require some | 313 // here (re-using the supplied HitTestResult), but that will require some |
313 // overhaul of the touch drag-and-drop code and LongPress is such a special | 314 // overhaul of the touch drag-and-drop code and LongPress is such a special |
(...skipping 12 matching lines...) Expand all Loading... |
326 if (!hit_test_contains_links && | 327 if (!hit_test_contains_links && |
327 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { | 328 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { |
328 long_tap_should_invoke_context_menu_ = true; | 329 long_tap_should_invoke_context_menu_ = true; |
329 return WebInputEventResult::kHandledSystem; | 330 return WebInputEventResult::kHandledSystem; |
330 } | 331 } |
331 | 332 |
332 Node* inner_node = hit_test_result.InnerNode(); | 333 Node* inner_node = hit_test_result.InnerNode(); |
333 if (inner_node && inner_node->GetLayoutObject() && | 334 if (inner_node && inner_node->GetLayoutObject() && |
334 selection_controller_->HandleGestureLongPress(hit_test_result)) { | 335 selection_controller_->HandleGestureLongPress(hit_test_result)) { |
335 mouse_event_manager_->FocusDocumentView(); | 336 mouse_event_manager_->FocusDocumentView(); |
336 return WebInputEventResult::kHandledSystem; | |
337 } | 337 } |
338 | 338 |
339 return SendContextMenuEventForGesture(targeted_event); | 339 return SendContextMenuEventForGesture(targeted_event); |
340 } | 340 } |
341 | 341 |
342 WebInputEventResult GestureManager::HandleGestureLongTap( | 342 WebInputEventResult GestureManager::HandleGestureLongTap( |
343 const GestureEventWithHitTestResults& targeted_event) { | 343 const GestureEventWithHitTestResults& targeted_event) { |
344 #if !OS(ANDROID) | 344 #if !OS(ANDROID) |
345 if (long_tap_should_invoke_context_menu_) { | 345 if (long_tap_should_invoke_context_menu_) { |
346 long_tap_should_invoke_context_menu_ = false; | 346 long_tap_should_invoke_context_menu_ = false; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 427 } |
428 return WebInputEventResult::kNotHandled; | 428 return WebInputEventResult::kNotHandled; |
429 } | 429 } |
430 | 430 |
431 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() | 431 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() |
432 const { | 432 const { |
433 return last_show_press_timestamp_; | 433 return last_show_press_timestamp_; |
434 } | 434 } |
435 | 435 |
436 } // namespace blink | 436 } // namespace blink |
OLD | NEW |