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 "content/browser/renderer_host/render_widget_host_view_event_handler.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" |
6 | 6 |
7 #include "base/metrics/user_metrics_action.h" | 7 #include "base/metrics/user_metrics_action.h" |
8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" | 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
9 #include "content/browser/renderer_host/overscroll_controller.h" | 9 #include "content/browser/renderer_host/overscroll_controller.h" |
10 #include "content/browser/renderer_host/render_view_host_delegate.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 // It is important to always mark events as being handled asynchronously when | 464 // It is important to always mark events as being handled asynchronously when |
465 // they are forwarded. This ensures that the current event does not get | 465 // they are forwarded. This ensures that the current event does not get |
466 // processed by the gesture recognizer before events currently awaiting | 466 // processed by the gesture recognizer before events currently awaiting |
467 // dispatch in the touch queue. | 467 // dispatch in the touch queue. |
468 event->DisableSynchronousHandling(); | 468 event->DisableSynchronousHandling(); |
469 | 469 |
470 // Set unchanged touch point to StateStationary for touchmove and | 470 // Set unchanged touch point to StateStationary for touchmove and |
471 // touchcancel to make sure only send one ack per WebTouchEvent. | 471 // touchcancel to make sure only send one ack per WebTouchEvent. |
472 MarkUnchangedTouchPointsAsStationary(&touch_event, event->touch_id()); | 472 MarkUnchangedTouchPointsAsStationary(&touch_event, event->touch_id()); |
| 473 // Set the last position of each touch point and calculate the movement delta |
| 474 // and set it in each touch point. |
| 475 host_view_->SetMovementXYForTouchPoints(&touch_event); |
| 476 |
473 if (ShouldRouteEvent(event)) { | 477 if (ShouldRouteEvent(event)) { |
474 host_->delegate()->GetInputEventRouter()->RouteTouchEvent( | 478 host_->delegate()->GetInputEventRouter()->RouteTouchEvent( |
475 host_view_, &touch_event, *event->latency()); | 479 host_view_, &touch_event, *event->latency()); |
476 } else { | 480 } else { |
477 ProcessTouchEvent(touch_event, *event->latency()); | 481 ProcessTouchEvent(touch_event, *event->latency()); |
478 } | 482 } |
479 } | 483 } |
480 | 484 |
481 void RenderWidgetHostViewEventHandler::OnGestureEvent(ui::GestureEvent* event) { | 485 void RenderWidgetHostViewEventHandler::OnGestureEvent(ui::GestureEvent* event) { |
482 TRACE_EVENT0("input", "RenderWidgetHostViewBase::OnGestureEvent"); | 486 TRACE_EVENT0("input", "RenderWidgetHostViewBase::OnGestureEvent"); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 host_->ForwardWheelEventWithLatencyInfo(event, latency); | 861 host_->ForwardWheelEventWithLatencyInfo(event, latency); |
858 } | 862 } |
859 | 863 |
860 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( | 864 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( |
861 const blink::WebTouchEvent& event, | 865 const blink::WebTouchEvent& event, |
862 const ui::LatencyInfo& latency) { | 866 const ui::LatencyInfo& latency) { |
863 host_->ForwardTouchEventWithLatencyInfo(event, latency); | 867 host_->ForwardTouchEventWithLatencyInfo(event, latency); |
864 } | 868 } |
865 | 869 |
866 } // namespace content | 870 } // namespace content |
OLD | NEW |