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

Unified Diff: content/browser/renderer_host/render_widget_host_view_base.cc

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Initialize m_frameScale in PointerEventFactoryTest 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/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

Powered by Google App Engine
This is Rietveld 408576698