| Index: content/browser/renderer_host/input/motion_event_android.cc
|
| diff --git a/content/browser/renderer_host/input/motion_event_android.cc b/content/browser/renderer_host/input/motion_event_android.cc
|
| index 8d36c812cc0084dc9ba3d5cb2d9fa0459ff23832..15a2aca39c547d4dac1f3f12742db61450dcaf57 100644
|
| --- a/content/browser/renderer_host/input/motion_event_android.cc
|
| +++ b/content/browser/renderer_host/input/motion_event_android.cc
|
| @@ -258,6 +258,21 @@ float MotionEventAndroid::GetOrientation(size_t pointer_index) const {
|
| AttachCurrentThread(), event_.obj(), pointer_index));
|
| }
|
|
|
| +float MotionEventAndroid::GetTouchOrientation(size_t pointer_index) const {
|
| + float orientation = GetOrientation(pointer_index);
|
| + // The meaning of the motion event orientation is overloaded on Android.
|
| + // * For a touch screen or pad, it's the orientation of the touch major axis
|
| + // clockwise from vertical. The value lies in [-PI/1, PI/2].
|
| + // * For a stylus, it indicates the direction in which the stylus is pointing
|
| + // clockwise from top. The value lies in [-PI, PI].
|
| + // Map to touch major axis orientation.
|
| + if (orientation <= -M_PI_2)
|
| + return orientation + M_PI;
|
| + if (orientation >= M_PI_2)
|
| + return orientation - M_PI;
|
| + return orientation;
|
| +}
|
| +
|
| float MotionEventAndroid::GetPressure(size_t pointer_index) const {
|
| DCHECK_LT(pointer_index, cached_pointer_count_);
|
| // Note that this early return is a special case exercised only in testing, as
|
|
|