| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/renderer_host/render_widget_host_input_event_router.h" | 5 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 // need to wrap the diverted pinch events in a GestureScrollBegin/End. | 720 // need to wrap the diverted pinch events in a GestureScrollBegin/End. |
| 721 // TODO(wjmaclean,kenrb,tdresser): When scroll latching lands, we can | 721 // TODO(wjmaclean,kenrb,tdresser): When scroll latching lands, we can |
| 722 // revisit how this code should work. | 722 // revisit how this code should work. |
| 723 // https://crbug.com/526463 | 723 // https://crbug.com/526463 |
| 724 auto* rwhi = | 724 auto* rwhi = |
| 725 static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost()); | 725 static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost()); |
| 726 // If the root view is the current gesture target, then we explicitly don't | 726 // If the root view is the current gesture target, then we explicitly don't |
| 727 // send a GestureScrollBegin, as by the time we see GesturePinchBegin there | 727 // send a GestureScrollBegin, as by the time we see GesturePinchBegin there |
| 728 // should have been one. | 728 // should have been one. |
| 729 if (root_view != touchscreen_gesture_target_.target && | 729 if (root_view != touchscreen_gesture_target_.target && |
| 730 !rwhi->is_in_touchscreen_gesture_scroll()) { | 730 !rwhi->is_in_gesture_scroll( |
| 731 blink::WebGestureDevice::kWebGestureDeviceTouchscreen)) { |
| 731 gesture_pinch_did_send_scroll_begin_ = true; | 732 gesture_pinch_did_send_scroll_begin_ = true; |
| 732 SendGestureScrollBegin(root_view, *event); | 733 SendGestureScrollBegin(root_view, *event); |
| 733 } | 734 } |
| 734 } | 735 } |
| 735 | 736 |
| 736 if (in_touchscreen_gesture_pinch_) { | 737 if (in_touchscreen_gesture_pinch_) { |
| 737 root_view->ProcessGestureEvent(*event, latency); | 738 root_view->ProcessGestureEvent(*event, latency); |
| 738 if (event->GetType() == blink::WebInputEvent::kGesturePinchEnd) { | 739 if (event->GetType() == blink::WebInputEvent::kGesturePinchEnd) { |
| 739 in_touchscreen_gesture_pinch_ = false; | 740 in_touchscreen_gesture_pinch_ = false; |
| 740 // If the root view wasn't already receiving the gesture stream, then we | 741 // If the root view wasn't already receiving the gesture stream, then we |
| 741 // need to wrap the diverted pinch events in a GestureScrollBegin/End. | 742 // need to wrap the diverted pinch events in a GestureScrollBegin/End. |
| 742 auto* rwhi = | 743 auto* rwhi = |
| 743 static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost()); | 744 static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost()); |
| 744 if (root_view != touchscreen_gesture_target_.target && | 745 if (root_view != touchscreen_gesture_target_.target && |
| 745 gesture_pinch_did_send_scroll_begin_ && | 746 gesture_pinch_did_send_scroll_begin_ && |
| 746 rwhi->is_in_touchscreen_gesture_scroll()) { | 747 rwhi->is_in_gesture_scroll( |
| 748 blink::WebGestureDevice::kWebGestureDeviceTouchscreen)) { |
| 747 SendGestureScrollEnd(root_view, *event); | 749 SendGestureScrollEnd(root_view, *event); |
| 748 } | 750 } |
| 749 gesture_pinch_did_send_scroll_begin_ = false; | 751 gesture_pinch_did_send_scroll_begin_ = false; |
| 750 } | 752 } |
| 751 return; | 753 return; |
| 752 } | 754 } |
| 753 | 755 |
| 754 // We use GestureTapDown to detect the start of a gesture sequence since there | 756 // We use GestureTapDown to detect the start of a gesture sequence since there |
| 755 // is no WebGestureEvent equivalent for ET_GESTURE_BEGIN. Note that this | 757 // is no WebGestureEvent equivalent for ET_GESTURE_BEGIN. Note that this |
| 756 // means the GestureFlingCancel that always comes between ET_GESTURE_BEGIN and | 758 // means the GestureFlingCancel that always comes between ET_GESTURE_BEGIN and |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 if (!touchpad_gesture_target_.target) | 827 if (!touchpad_gesture_target_.target) |
| 826 return; | 828 return; |
| 827 | 829 |
| 828 // TODO(mohsen): Add tests to check event location. | 830 // TODO(mohsen): Add tests to check event location. |
| 829 event->x += touchpad_gesture_target_.delta.x(); | 831 event->x += touchpad_gesture_target_.delta.x(); |
| 830 event->y += touchpad_gesture_target_.delta.y(); | 832 event->y += touchpad_gesture_target_.delta.y(); |
| 831 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency); | 833 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency); |
| 832 } | 834 } |
| 833 | 835 |
| 834 } // namespace content | 836 } // namespace content |
| OLD | NEW |