| 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 |
| 305 frame_->GetEventHandler().SendContextMenuEventForTouchSelection(); |
| 304 return event_result; | 306 return event_result; |
| 305 } | 307 } |
| 306 | 308 |
| 307 WebInputEventResult GestureManager::HandleGestureLongPress( | 309 WebInputEventResult GestureManager::HandleGestureLongPress( |
| 308 const GestureEventWithHitTestResults& targeted_event) { | 310 const GestureEventWithHitTestResults& targeted_event) { |
| 309 const WebGestureEvent& gesture_event = targeted_event.Event(); | 311 const WebGestureEvent& gesture_event = targeted_event.Event(); |
| 310 | 312 |
| 311 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests | 313 // 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 | 314 // 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 | 315 // overhaul of the touch drag-and-drop code and LongPress is such a special |
| (...skipping 13 matching lines...) Expand all Loading... |
| 327 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { | 329 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { |
| 328 long_tap_should_invoke_context_menu_ = true; | 330 long_tap_should_invoke_context_menu_ = true; |
| 329 return WebInputEventResult::kHandledSystem; | 331 return WebInputEventResult::kHandledSystem; |
| 330 } | 332 } |
| 331 | 333 |
| 332 Node* inner_node = hit_test_result.InnerNode(); | 334 Node* inner_node = hit_test_result.InnerNode(); |
| 333 if (inner_node && inner_node->GetLayoutObject() && | 335 if (inner_node && inner_node->GetLayoutObject() && |
| 334 selection_controller_->HandleGestureLongPress(gesture_event, | 336 selection_controller_->HandleGestureLongPress(gesture_event, |
| 335 hit_test_result)) { | 337 hit_test_result)) { |
| 336 mouse_event_manager_->FocusDocumentView(); | 338 mouse_event_manager_->FocusDocumentView(); |
| 339 frame_->GetEventHandler().SendContextMenuEventForTouchSelection(); |
| 337 return WebInputEventResult::kHandledSystem; | 340 return WebInputEventResult::kHandledSystem; |
| 338 } | 341 } |
| 339 | 342 |
| 340 return SendContextMenuEventForGesture(targeted_event); | 343 return SendContextMenuEventForGesture(targeted_event); |
| 341 } | 344 } |
| 342 | 345 |
| 343 WebInputEventResult GestureManager::HandleGestureLongTap( | 346 WebInputEventResult GestureManager::HandleGestureLongTap( |
| 344 const GestureEventWithHitTestResults& targeted_event) { | 347 const GestureEventWithHitTestResults& targeted_event) { |
| 345 #if !OS(ANDROID) | 348 #if !OS(ANDROID) |
| 346 if (long_tap_should_invoke_context_menu_) { | 349 if (long_tap_should_invoke_context_menu_) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 432 } |
| 430 return WebInputEventResult::kNotHandled; | 433 return WebInputEventResult::kNotHandled; |
| 431 } | 434 } |
| 432 | 435 |
| 433 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() | 436 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() |
| 434 const { | 437 const { |
| 435 return last_show_press_timestamp_; | 438 return last_show_press_timestamp_; |
| 436 } | 439 } |
| 437 | 440 |
| 438 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |