Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_base.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc |
| index d09da0790d0df887ac8265565c89e265dfe90e46..d890f235e28dbf25d2e12f07c900b7a191cd71fc 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_base.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_base.cc |
| @@ -507,4 +507,29 @@ cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { |
| return cc::SurfaceId(); |
| } |
| +void RenderWidgetHostViewBase::SetMovementXYForTouchPoints( |
| + blink::WebTouchEvent* event) { |
| + for (size_t i = 0; i < event->touchesLength; ++i) { |
| + auto& touchPoint = event->touches[i]; |
|
sadrul
2017/02/07 03:48:30
touch_point
Perhaps you could make this a pointer
Navid Zolghadr
2017/02/08 17:18:49
Done.
|
| + if (touchPoint.state == blink::WebTouchPoint::StateMoved) { |
| + gfx::Point& lastPosition = global_touch_position_[touchPoint.id]; |
|
sadrul
2017/02/07 03:48:30
const gfx::Point& last_position
Navid Zolghadr
2017/02/08 17:18:49
Done.
|
| + touchPoint.movementX = touchPoint.screenPosition.x - lastPosition.x(); |
| + touchPoint.movementY = touchPoint.screenPosition.y - lastPosition.y(); |
| + global_touch_position_[touchPoint.id].SetPoint( |
| + touchPoint.screenPosition.x, touchPoint.screenPosition.y); |
| + } else { |
| + touchPoint.movementX = 0; |
| + touchPoint.movementY = 0; |
| + if (event->touches[i].state == blink::WebTouchPoint::StateReleased || |
| + event->touches[i].state == blink::WebTouchPoint::StateCancelled) { |
| + global_touch_position_.erase(event->touches[i].id); |
| + } else if (event->touches[i].state == |
| + blink::WebTouchPoint::StatePressed) { |
| + global_touch_position_[touchPoint.id] = gfx::Point( |
| + touchPoint.screenPosition.x, touchPoint.screenPosition.y); |
| + } |
| + } |
| + } |
| +} |
| + |
| } // namespace content |