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( | |
aelias_OOO_until_Jul13
2017/05/23 20:52:05
How about putting this behind "if (event_result ==
amaralp1
2017/05/24 08:30:34
Done.
| |
306 kMenuSourceTouch); | |
304 return event_result; | 307 return event_result; |
305 } | 308 } |
306 | 309 |
307 WebInputEventResult GestureManager::HandleGestureLongPress( | 310 WebInputEventResult GestureManager::HandleGestureLongPress( |
308 const GestureEventWithHitTestResults& targeted_event) { | 311 const GestureEventWithHitTestResults& targeted_event) { |
309 const WebGestureEvent& gesture_event = targeted_event.Event(); | 312 const WebGestureEvent& gesture_event = targeted_event.Event(); |
310 | 313 |
311 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests | 314 // 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 | 315 // 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 | 316 // 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 && | 329 if (!hit_test_contains_links && |
327 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { | 330 mouse_event_manager_->HandleDragDropIfPossible(targeted_event)) { |
328 long_tap_should_invoke_context_menu_ = true; | 331 long_tap_should_invoke_context_menu_ = true; |
329 return WebInputEventResult::kHandledSystem; | 332 return WebInputEventResult::kHandledSystem; |
330 } | 333 } |
331 | 334 |
332 Node* inner_node = hit_test_result.InnerNode(); | 335 Node* inner_node = hit_test_result.InnerNode(); |
333 if (inner_node && inner_node->GetLayoutObject() && | 336 if (inner_node && inner_node->GetLayoutObject() && |
334 selection_controller_->HandleGestureLongPress(hit_test_result)) { | 337 selection_controller_->HandleGestureLongPress(hit_test_result)) { |
335 mouse_event_manager_->FocusDocumentView(); | 338 mouse_event_manager_->FocusDocumentView(); |
339 frame_->GetEventHandler().SendContextMenuEventForTouchSelection( | |
340 kMenuSourceLongPress); | |
336 return WebInputEventResult::kHandledSystem; | 341 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_) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 } | 433 } |
429 return WebInputEventResult::kNotHandled; | 434 return WebInputEventResult::kNotHandled; |
430 } | 435 } |
431 | 436 |
432 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() | 437 WTF::Optional<WTF::TimeTicks> GestureManager::GetLastShowPressTimestamp() |
433 const { | 438 const { |
434 return last_show_press_timestamp_; | 439 return last_show_press_timestamp_; |
435 } | 440 } |
436 | 441 |
437 } // namespace blink | 442 } // namespace blink |
OLD | NEW |