Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Unified Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Move the logic to InputRouterImpl Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698