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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // GestureScrollBegin). 177 // GestureScrollBegin).
178 touch_event_queue_->PrependTouchScrollNotification(); 178 touch_event_queue_->PrependTouchScrollNotification();
179 touch_scroll_started_sent_ = true; 179 touch_scroll_started_sent_ = true;
180 } 180 }
181 touch_event_queue_->OnGestureScrollEvent(gesture_event); 181 touch_event_queue_->OnGestureScrollEvent(gesture_event);
182 } 182 }
183 183
184 gesture_event_queue_.QueueEvent(gesture_event); 184 gesture_event_queue_.QueueEvent(gesture_event);
185 } 185 }
186 186
187 void InputRouterImpl::SendTouchEvent( 187 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
188 const TouchEventWithLatencyInfo& touch_event) { 188 SetMovementXYForTouchPoints(&touch_event.event);
189 input_stream_validator_.Validate(touch_event.event); 189 input_stream_validator_.Validate(touch_event.event);
190 touch_event_queue_->QueueEvent(touch_event); 190 touch_event_queue_->QueueEvent(touch_event);
191 } 191 }
192 192
193 // Forwards MouseEvent without passing it through 193 // Forwards MouseEvent without passing it through
194 // TouchpadTapSuppressionController. 194 // TouchpadTapSuppressionController.
195 void InputRouterImpl::SendMouseEventImmediately( 195 void InputRouterImpl::SendMouseEventImmediately(
196 const MouseEventWithLatencyInfo& mouse_event) { 196 const MouseEventWithLatencyInfo& mouse_event) {
197 if (mouse_event.event.type() == blink::WebInputEvent::MouseMove) 197 if (mouse_event.event.type() == blink::WebInputEvent::MouseMove)
198 mouse_move_queue_.push_back(mouse_event); 198 mouse_move_queue_.push_back(mouse_event);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 return; 631 return;
632 632
633 flush_requested_ = false; 633 flush_requested_ = false;
634 client_->DidFlush(); 634 client_->DidFlush();
635 } 635 }
636 636
637 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { 637 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) {
638 frame_tree_node_id_ = frameTreeNodeId; 638 frame_tree_node_id_ = frameTreeNodeId;
639 } 639 }
640 640
641 void InputRouterImpl::SetMovementXYForTouchPoints(blink::WebTouchEvent* event) {
642 for (size_t i = 0; i < event->touchesLength; ++i) {
643 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.
644 if (touchPoint->state == blink::WebTouchPoint::StateMoved) {
645 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.
646 touchPoint->movementX = touchPoint->screenPosition.x - lastPosition.x();
647 touchPoint->movementY = touchPoint->screenPosition.y - lastPosition.y();
648 global_touch_position_[touchPoint->id].SetPoint(
649 touchPoint->screenPosition.x, touchPoint->screenPosition.y);
650 } else {
651 touchPoint->movementX = 0;
652 touchPoint->movementY = 0;
653 if (event->touches[i].state == blink::WebTouchPoint::StateReleased ||
654 event->touches[i].state == blink::WebTouchPoint::StateCancelled) {
655 global_touch_position_.erase(event->touches[i].id);
656 } else if (event->touches[i].state ==
657 blink::WebTouchPoint::StatePressed) {
658 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.
659 touchPoint->screenPosition.x, touchPoint->screenPosition.y);
660 }
661 }
662 }
663 }
664
641 } // namespace content 665 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698