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

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

Issue 1187273004: Pass MotionEvent tilt angles to Blink on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/motion_event_web.cc
diff --git a/content/browser/renderer_host/input/motion_event_web.cc b/content/browser/renderer_host/input/motion_event_web.cc
index bc47cf8c17734a662dc43ad10a8662340fbed16f..65152590073e93e12757e0fc5c9dc36bb57af8c5 100644
--- a/content/browser/renderer_host/input/motion_event_web.cc
+++ b/content/browser/renderer_host/input/motion_event_web.cc
@@ -149,6 +149,37 @@ float MotionEventWeb::GetPressure(size_t pointer_index) const {
return 0.f;
}
+// TODO(e_hakkinen): Remove either this and GetTiltOrientation or GetTiltX and
+// GetTiltY.
+float MotionEventWeb::GetTilt(size_t pointer_index) const {
+ DCHECK_LT(pointer_index, GetPointerCount());
+ // TODO(e_hakkinen): Remove one of these.
+ return event_.touches[pointer_index].tiltRad;
+ return event_.touches[pointer_index].tilt * M_PI / 180.f;
+}
+
+// TODO(e_hakkinen): Remove either this and GetTilt or GetTiltX and GetTiltY.
+float MotionEventWeb::GetTiltOrientation(size_t pointer_index) const {
+ DCHECK_LT(pointer_index, GetPointerCount());
+ // TODO(e_hakkinen): Remove one of these.
+ return event_.touches[pointer_index].tiltOrientationRad;
+ return event_.touches[pointer_index].tiltOrientation * M_PI / 180.f;
+}
+
+// TODO(e_hakkinen): Remove either this and GetTiltY or GetTilt and
+// GetTiltOrientation.
+float MotionEventWeb::GetTiltX(size_t pointer_index) const {
+ DCHECK_LT(pointer_index, GetPointerCount());
+ return event_.touches[pointer_index].tiltX * M_PI / 180.f;
+}
+
+// TODO(e_hakkinen): Remove either this and GetTiltX or GetTilt and
+// GetTiltOrientation.
+float MotionEventWeb::GetTiltY(size_t pointer_index) const {
+ DCHECK_LT(pointer_index, GetPointerCount());
+ return event_.touches[pointer_index].tiltY * M_PI / 180.f;
+}
+
base::TimeTicks MotionEventWeb::GetEventTime() const {
return base::TimeTicks() +
base::TimeDelta::FromMicroseconds(event_.timeStampSeconds *

Powered by Google App Engine
This is Rietveld 408576698