| 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 | 10 |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 // should have been one. | 642 // should have been one. |
| 643 if (root_view != touchscreen_gesture_target_.target && | 643 if (root_view != touchscreen_gesture_target_.target && |
| 644 !rwhi->is_in_touchscreen_gesture_scroll()) { | 644 !rwhi->is_in_touchscreen_gesture_scroll()) { |
| 645 gesture_pinch_did_send_scroll_begin_ = true; | 645 gesture_pinch_did_send_scroll_begin_ = true; |
| 646 SendGestureScrollBegin(root_view, *event); | 646 SendGestureScrollBegin(root_view, *event); |
| 647 } | 647 } |
| 648 } | 648 } |
| 649 | 649 |
| 650 if (in_touchscreen_gesture_pinch_) { | 650 if (in_touchscreen_gesture_pinch_) { |
| 651 root_view->ProcessGestureEvent(*event, latency); | 651 root_view->ProcessGestureEvent(*event, latency); |
| 652 if (event->type == blink::WebInputEvent::GesturePinchUpdate) |
| 653 root_view->UpdatePageScaleFactor(event->data.pinchUpdate.scale); |
| 652 if (event->type == blink::WebInputEvent::GesturePinchEnd) { | 654 if (event->type == blink::WebInputEvent::GesturePinchEnd) { |
| 653 in_touchscreen_gesture_pinch_ = false; | 655 in_touchscreen_gesture_pinch_ = false; |
| 654 // If the root view wasn't already receiving the gesture stream, then we | 656 // If the root view wasn't already receiving the gesture stream, then we |
| 655 // need to wrap the diverted pinch events in a GestureScrollBegin/End. | 657 // need to wrap the diverted pinch events in a GestureScrollBegin/End. |
| 656 auto rwhi = | 658 auto rwhi = |
| 657 static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost()); | 659 static_cast<RenderWidgetHostImpl*>(root_view->GetRenderWidgetHost()); |
| 658 if (root_view != touchscreen_gesture_target_.target && | 660 if (root_view != touchscreen_gesture_target_.target && |
| 659 gesture_pinch_did_send_scroll_begin_ && | 661 gesture_pinch_did_send_scroll_begin_ && |
| 660 rwhi->is_in_touchscreen_gesture_scroll()) { | 662 rwhi->is_in_touchscreen_gesture_scroll()) { |
| 661 SendGestureScrollEnd(root_view, *event); | 663 SendGestureScrollEnd(root_view, *event); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 if (!touchpad_gesture_target_.target) | 741 if (!touchpad_gesture_target_.target) |
| 740 return; | 742 return; |
| 741 | 743 |
| 742 // TODO(mohsen): Add tests to check event location. | 744 // TODO(mohsen): Add tests to check event location. |
| 743 event->x += touchpad_gesture_target_.delta.x(); | 745 event->x += touchpad_gesture_target_.delta.x(); |
| 744 event->y += touchpad_gesture_target_.delta.y(); | 746 event->y += touchpad_gesture_target_.delta.y(); |
| 745 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency); | 747 touchpad_gesture_target_.target->ProcessGestureEvent(*event, latency); |
| 746 } | 748 } |
| 747 | 749 |
| 748 } // namespace content | 750 } // namespace content |
| OLD | NEW |