| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 if (root_view != touchscreen_gesture_target_.target && | 783 if (root_view != touchscreen_gesture_target_.target && |
| 784 gesture_pinch_did_send_scroll_begin_ && | 784 gesture_pinch_did_send_scroll_begin_ && |
| 785 rwhi->is_in_touchscreen_gesture_scroll()) { | 785 rwhi->is_in_touchscreen_gesture_scroll()) { |
| 786 SendGestureScrollEnd(root_view, *event); | 786 SendGestureScrollEnd(root_view, *event); |
| 787 } | 787 } |
| 788 gesture_pinch_did_send_scroll_begin_ = false; | 788 gesture_pinch_did_send_scroll_begin_ = false; |
| 789 } | 789 } |
| 790 return; | 790 return; |
| 791 } | 791 } |
| 792 | 792 |
| 793 // We use GestureTapDown to detect the start of a gesture sequence since there | 793 // On Android it is possible for touchscreen gesture events to arrive that |
| 794 // is no WebGestureEvent equivalent for ET_GESTURE_BEGIN. Note that this | 794 // are not associated with touch events, because non-synthetic events can be |
| 795 // means the GestureFlingCancel that always comes between ET_GESTURE_BEGIN and | 795 // created by ContentView. In that case the target queue will be empty. |
| 796 // GestureTapDown is sent to the previous target, in case it is still in a | 796 if (touchscreen_gesture_target_queue_.empty()) { |
| 797 // fling. | 797 gfx::Point transformed_point; |
| 798 if (event->GetType() == blink::WebInputEvent::kGestureTapDown) { | 798 gfx::Point original_point(event->x, event->y); |
| 799 bool no_target = touchscreen_gesture_target_queue_.empty(); | 799 touchscreen_gesture_target_.target = |
| 800 // This UMA metric is temporary, and will be removed once it has fulfilled | 800 FindEventTarget(root_view, original_point, &transformed_point); |
| 801 // it's purpose, namely telling us when the incidents of empty | 801 touchscreen_gesture_target_.delta = transformed_point - original_point; |
| 802 // gesture-queues has dropped to zero. https://crbug.com/642008 | 802 } else if (event->GetType() == blink::WebInputEvent::kGestureTapDown) { |
| 803 UMA_HISTOGRAM_BOOLEAN("Event.FrameEventRouting.NoGestureTarget", no_target); | 803 // We use GestureTapDown to detect the start of a gesture sequence since |
| 804 if (no_target) { | 804 // there is no WebGestureEvent equivalent for ET_GESTURE_BEGIN. Note that |
| 805 LOG(ERROR) << "Gesture sequence start detected with no target available."; | 805 // this means the GestureFlingCancel that always comes between |
| 806 // Ignore this gesture sequence as no target is available. | 806 // ET_GESTURE_BEGIN and GestureTapDown is sent to the previous target, in |
| 807 // TODO(wjmaclean): this only happens on Windows, and should not happen. | 807 // case it is still in a fling. |
| 808 // https://crbug.com/595422 | |
| 809 touchscreen_gesture_target_.target = nullptr; | |
| 810 return; | |
| 811 } | |
| 812 | |
| 813 touchscreen_gesture_target_ = touchscreen_gesture_target_queue_.front(); | 808 touchscreen_gesture_target_ = touchscreen_gesture_target_queue_.front(); |
| 814 touchscreen_gesture_target_queue_.pop_front(); | 809 touchscreen_gesture_target_queue_.pop_front(); |
| 815 | 810 |
| 816 // Abort any scroll bubbling in progress to avoid double entry. | 811 // Abort any scroll bubbling in progress to avoid double entry. |
| 817 if (touchscreen_gesture_target_.target && | 812 if (touchscreen_gesture_target_.target && |
| 818 touchscreen_gesture_target_.target == | 813 touchscreen_gesture_target_.target == |
| 819 bubbling_gesture_scroll_target_.target) { | 814 bubbling_gesture_scroll_target_.target) { |
| 820 SendGestureScrollEnd(bubbling_gesture_scroll_target_.target, | 815 SendGestureScrollEnd(bubbling_gesture_scroll_target_.target, |
| 821 DummyGestureScrollUpdate(event->TimeStampSeconds())); | 816 DummyGestureScrollUpdate(event->TimeStampSeconds())); |
| 822 CancelScrollBubbling(bubbling_gesture_scroll_target_.target); | 817 CancelScrollBubbling(bubbling_gesture_scroll_target_.target); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 std::vector<RenderWidgetHostView*> | 868 std::vector<RenderWidgetHostView*> |
| 874 RenderWidgetHostInputEventRouter::GetRenderWidgetHostViewsForTests() const { | 869 RenderWidgetHostInputEventRouter::GetRenderWidgetHostViewsForTests() const { |
| 875 std::vector<RenderWidgetHostView*> hosts; | 870 std::vector<RenderWidgetHostView*> hosts; |
| 876 for (auto entry : owner_map_) | 871 for (auto entry : owner_map_) |
| 877 hosts.push_back(entry.second); | 872 hosts.push_back(entry.second); |
| 878 | 873 |
| 879 return hosts; | 874 return hosts; |
| 880 } | 875 } |
| 881 | 876 |
| 882 } // namespace content | 877 } // namespace content |
| OLD | NEW |