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

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

Issue 755403006: Added experimental Touch.tilt, Touch.tiltDirection support for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused code (event_sender.cc) Created 5 years, 9 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/web_input_event_util.cc
diff --git a/content/browser/renderer_host/input/web_input_event_util.cc b/content/browser/renderer_host/input/web_input_event_util.cc
index 150d83e8ee55a5024ce24dfefe0bba853db8207c..957ec7c8a83c79ae0e53be712c6b12d069c411be 100644
--- a/content/browser/renderer_host/input/web_input_event_util.cc
+++ b/content/browser/renderer_host/input/web_input_event_util.cc
@@ -9,6 +9,7 @@
#include <cmath>
+#include "base/float_util.h"
#include "base/strings/string_util.h"
#include "content/common/input/web_touch_event_traits.h"
#include "ui/events/event_constants.h"
@@ -235,6 +236,14 @@ WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
touch.rotationAngle = orientation_deg + 90;
}
+ float tilt = event.GetTilt(pointer_index);
+ touch.tilt = base::IsNaN(tilt) ?
+ std::numeric_limits<float>::quiet_NaN() : (180.f / M_PI * tilt);
+
+ float tilt_direction = event.GetTiltDirection(pointer_index);
+ touch.tiltDirection = base::IsNaN(tilt_direction) ?
+ std::numeric_limits<float>::quiet_NaN() : (180.f / M_PI * tilt_direction);
+
touch.force = event.GetPressure(pointer_index);
return touch;

Powered by Google App Engine
This is Rietveld 408576698