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

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

Issue 2860793003: Pass through tilt_x and tilt_y to blink (Closed)
Patch Set: Pass through tilt_x and tilt_y to blink Created 3 years, 7 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 e58803770147f57cd976ea99a67bbc3852052b02..0286eeef06bdab1fdb73adb9e894492fb3441009 100644
--- a/content/browser/renderer_host/input/motion_event_web.cc
+++ b/content/browser/renderer_host/input/motion_event_web.cc
@@ -168,24 +168,22 @@ float MotionEventWeb::GetPressure(size_t pointer_index) const {
return 0.f;
}
-float MotionEventWeb::GetTilt(size_t pointer_index) const {
+float MotionEventWeb::GetTiltX(size_t pointer_index) const {
DCHECK_LT(pointer_index, GetPointerCount());
if (GetToolType(pointer_index) != TOOL_TYPE_STYLUS)
return 0.f;
- const WebPointerProperties& pointer = event_.touches[pointer_index];
+ return event_.touches[pointer_index].tilt_x;
+}
+
+float MotionEventWeb::GetTiltY(size_t pointer_index) const {
+ DCHECK_LT(pointer_index, GetPointerCount());
- float tilt_x_r = sin(pointer.tilt_x * M_PI / 180.f);
- float tilt_x_z = cos(pointer.tilt_x * M_PI / 180.f);
- float tilt_y_r = sin(pointer.tilt_y * M_PI / 180.f);
- float tilt_y_z = cos(pointer.tilt_y * M_PI / 180.f);
- float r_x = tilt_x_r * tilt_y_z;
- float r_y = tilt_y_r * tilt_x_z;
- float r = sqrt(r_x * r_x + r_y * r_y);
- float z = tilt_x_z * tilt_y_z;
+ if (GetToolType(pointer_index) != TOOL_TYPE_STYLUS)
+ return 0.f;
- return atan2(r, z);
+ return event_.touches[pointer_index].tilt_y;
}
base::TimeTicks MotionEventWeb::GetEventTime() const {

Powered by Google App Engine
This is Rietveld 408576698