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

Side by Side Diff: third_party/WebKit/Source/platform/WebTouchEvent.cpp

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Wrap ForwardTouchEventWithLatencyInfo to always reset points 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "public/platform/WebTouchEvent.h" 5 #include "public/platform/WebTouchEvent.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 WebTouchEvent WebTouchEvent::flattenTransform() const { 9 WebTouchEvent WebTouchEvent::flattenTransform() const {
10 WebTouchEvent transformedEvent = *this; 10 WebTouchEvent transformedEvent = *this;
11 for (unsigned i = 0; i < touchesLength; ++i) { 11 for (unsigned i = 0; i < touchesLength; ++i) {
12 transformedEvent.touches[i] = touchPointInRootFrame(i); 12 transformedEvent.touches[i] = touchPointInRootFrame(i);
13 } 13 }
14 transformedEvent.m_frameTranslate.x = 0; 14 transformedEvent.m_frameTranslate.x = 0;
15 transformedEvent.m_frameTranslate.y = 0; 15 transformedEvent.m_frameTranslate.y = 0;
16 transformedEvent.m_frameScale = 1; 16 transformedEvent.m_frameScale = 1;
17 17
18 return transformedEvent; 18 return transformedEvent;
19 } 19 }
20 20
21 WebTouchPoint WebTouchEvent::touchPointInRootFrame(unsigned point) const { 21 WebTouchPoint WebTouchEvent::touchPointInRootFrame(unsigned point) const {
22 DCHECK_LT(point, touchesLength); 22 DCHECK_LT(point, touchesLength);
23 if (point >= touchesLength) 23 if (point >= touchesLength)
24 return WebTouchPoint(); 24 return WebTouchPoint();
25 25
26 WebTouchPoint transformedPoint = touches[point]; 26 WebTouchPoint transformedPoint = touches[point];
27 transformedPoint.radiusX /= m_frameScale; 27 transformedPoint.radiusX /= m_frameScale;
28 transformedPoint.radiusY /= m_frameScale; 28 transformedPoint.radiusY /= m_frameScale;
29 transformedPoint.movementX /= m_frameScale;
30 transformedPoint.movementY /= m_frameScale;
29 transformedPoint.position.x = 31 transformedPoint.position.x =
30 (transformedPoint.position.x / m_frameScale) + m_frameTranslate.x; 32 (transformedPoint.position.x / m_frameScale) + m_frameTranslate.x;
31 transformedPoint.position.y = 33 transformedPoint.position.y =
32 (transformedPoint.position.y / m_frameScale) + m_frameTranslate.y; 34 (transformedPoint.position.y / m_frameScale) + m_frameTranslate.y;
33 return transformedPoint; 35 return transformedPoint;
34 } 36 }
35 37
36 } // namespace blink 38 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698