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

Unified Diff: third_party/WebKit/Source/platform/WebTouchEvent.cpp

Issue 2646163002: Remove PlatformTouchEvent/Point and use WebTouchEvent/Point instead (Closed)
Patch Set: Fix nit Created 3 years, 11 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: third_party/WebKit/Source/platform/WebTouchEvent.cpp
diff --git a/third_party/WebKit/Source/platform/WebTouchEvent.cpp b/third_party/WebKit/Source/platform/WebTouchEvent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3e58320b68272dcdd59d08f7b8fdfaf89d582cfe
--- /dev/null
+++ b/third_party/WebKit/Source/platform/WebTouchEvent.cpp
@@ -0,0 +1,36 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "public/platform/WebTouchEvent.h"
+
+namespace blink {
+
+WebTouchEvent WebTouchEvent::flattenTransform() const {
+ WebTouchEvent transformedEvent = *this;
+ for (unsigned i = 0; i < touchesLength; ++i) {
+ transformedEvent.touches[i] = touchPointInRootFrame(i);
+ }
+ transformedEvent.m_frameTranslate.x = 0;
+ transformedEvent.m_frameTranslate.y = 0;
+ transformedEvent.m_frameScale = 1;
+
+ return transformedEvent;
+}
+
+WebTouchPoint WebTouchEvent::touchPointInRootFrame(unsigned point) const {
+ DCHECK_LT(point, touchesLength);
+ if (point >= touchesLength)
+ return WebTouchPoint();
+
+ WebTouchPoint transformedPoint = touches[point];
+ transformedPoint.radiusX /= m_frameScale;
+ transformedPoint.radiusY /= m_frameScale;
+ transformedPoint.position.x =
+ (transformedPoint.position.x / m_frameScale) + m_frameTranslate.x;
+ transformedPoint.position.y =
+ (transformedPoint.position.y / m_frameScale) + m_frameTranslate.y;
+ return transformedPoint;
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/PlatformTouchPoint.h ('k') | third_party/WebKit/Source/web/InspectorOverlay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698