Chromium Code Reviews| Index: content/browser/renderer_host/input/input_router_impl.cc |
| diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc |
| index 1dc0f2ccd07bfd3a03d0e7b821edf4bd3e263b45..fc254a79d1e598e636101f35f958e40dd7288859 100644 |
| --- a/content/browser/renderer_host/input/input_router_impl.cc |
| +++ b/content/browser/renderer_host/input/input_router_impl.cc |
| @@ -184,8 +184,8 @@ void InputRouterImpl::SendGestureEvent( |
| gesture_event_queue_.QueueEvent(gesture_event); |
| } |
| -void InputRouterImpl::SendTouchEvent( |
| - const TouchEventWithLatencyInfo& touch_event) { |
| +void InputRouterImpl::SendTouchEvent(TouchEventWithLatencyInfo touch_event) { |
|
Navid Zolghadr
2017/02/08 17:18:49
InputRouterImpl particularly was a better place fo
sadrul
2017/02/09 03:11:34
(I left a comment in input_router.h)
I think the
|
| + SetMovementXYForTouchPoints(&touch_event.event); |
| input_stream_validator_.Validate(touch_event.event); |
| touch_event_queue_->QueueEvent(touch_event); |
| } |
| @@ -638,4 +638,28 @@ void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { |
| frame_tree_node_id_ = frameTreeNodeId; |
| } |
| +void InputRouterImpl::SetMovementXYForTouchPoints(blink::WebTouchEvent* event) { |
| + for (size_t i = 0; i < event->touchesLength; ++i) { |
| + blink::WebTouchPoint* touchPoint = &event->touches[i]; |
|
sadrul
2017/02/09 03:11:34
touch_point (that's the style used in non-blink ch
Navid Zolghadr
2017/02/09 16:35:08
Done.
|
| + if (touchPoint->state == blink::WebTouchPoint::StateMoved) { |
| + const gfx::Point& lastPosition = global_touch_position_[touchPoint->id]; |
|
sadrul
2017/02/09 03:11:34
last_position
Navid Zolghadr
2017/02/09 16:35:08
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( |
|
sadrul
2017/02/09 03:11:34
Do you want to DCHECK that |touch_point->id| is no
Navid Zolghadr
2017/02/09 16:35:08
Done.
|
| + touchPoint->screenPosition.x, touchPoint->screenPosition.y); |
| + } |
| + } |
| + } |
| +} |
| + |
| } // namespace content |