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/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 if (event_result == WebInputEventResult::kHandledSystem) { | |
|
bokan
2017/05/24 19:15:52
Is a synthetic mouse up/release being kHandledSyst
| |
| 306 frame_->GetEventHandler().SendContextMenuEventForTouchSelection( | |
| 307 kMenuSourceTouch); | |
| 308 } | |
| 309 | |
| 304 return event_result; | 310 return event_result; |
| 305 } | 311 } |
| 306 | 312 |
| 307 WebInputEventResult GestureManager::HandleGestureLongPress( | 313 WebInputEventResult GestureManager::HandleGestureLongPress( |
| 308 const GestureEventWithHitTestResults& targeted_event) { | 314 const GestureEventWithHitTestResults& targeted_event) { |
| 309 const WebGestureEvent& gesture_event = targeted_event.Event(); | 315 const WebGestureEvent& gesture_event = targeted_event.Event(); |
| 310 | 316 |
| 311 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests | 317 // 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 | 318 // 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 | 319 // 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 && | 332 if (!hit_test_contains_links && |
| 327 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { | 333 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { |
| 328 long_tap_should_invoke_context_menu_ = true; | 334 long_tap_should_invoke_context_menu_ = true; |
| 329 return WebInputEventResult::kHandledSystem; | 335 return WebInputEventResult::kHandledSystem; |
| 330 } | 336 } |
| 331 | 337 |
| 332 Node* inner_node = hit_test_result.InnerNode(); | 338 Node* inner_node = hit_test_result.InnerNode(); |
| 333 if (inner_node && inner_node->GetLayoutObject() && | 339 if (inner_node && inner_node->GetLayoutObject() && |
| 334 selection_controller_->HandleGestureLongPress(hit_test_result)) { | 340 selection_controller_->HandleGestureLongPress(hit_test_result)) { |
| 335 mouse_event_manager_->FocusDocumentView(); | 341 mouse_event_manager_->FocusDocumentView(); |
| 336 return WebInputEventResult::kHandledSystem; | |
| 337 } | 342 } |
| 338 | 343 |
| 339 return SendContextMenuEventForGesture(targeted_event); | 344 return SendContextMenuEventForGesture(targeted_event); |
| 340 } | 345 } |
| 341 | 346 |
| 342 WebInputEventResult GestureManager::HandleGestureLongTap( | 347 WebInputEventResult GestureManager::HandleGestureLongTap( |
| 343 const GestureEventWithHitTestResults& targeted_event) { | 348 const GestureEventWithHitTestResults& targeted_event) { |
| 344 #if !OS(ANDROID) | 349 #if !OS(ANDROID) |
| 345 if (long_tap_should_invoke_context_menu_) { | 350 if (long_tap_should_invoke_context_menu_) { |
| 346 long_tap_should_invoke_context_menu_ = false; | 351 long_tap_should_invoke_context_menu_ = false; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 } | 432 } |
| 428 return WebInputEventResult::kNotHandled; | 433 return WebInputEventResult::kNotHandled; |
| 429 } | 434 } |
| 430 | 435 |
| 431 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() | 436 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() |
| 432 const { | 437 const { |
| 433 return last_show_press_timestamp_; | 438 return last_show_press_timestamp_; |
| 434 } | 439 } |
| 435 | 440 |
| 436 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |