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

Unified Diff: ui/events/blink/blink_event_util.cc

Issue 1152463004: Fix motion event orientation handling for styluses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: ui/events/blink/blink_event_util.cc
diff --git a/ui/events/blink/blink_event_util.cc b/ui/events/blink/blink_event_util.cc
index 9a3a648ae3306e5517b87255acd1c5d0f1fac847..47ed7873c763e6f3754e7c8e90312e0dc7b905c8 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -103,9 +103,15 @@ WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
DCHECK_GE(major_radius, 0);
DCHECK_GE(minor_radius, 0);
DCHECK_GE(major_radius, minor_radius);
+ // Orientation lies in [-90, 90] for a touch screen or pad and in [-180, 180]
+ // for a stylus.
// Allow a small bound tolerance to account for floating point conversion.
- DCHECK_GT(orientation_deg, -90.01f);
- DCHECK_LT(orientation_deg, 90.01f);
+ DCHECK_GT(orientation_deg, -180.01f);
+ DCHECK_LT(orientation_deg, 180.01f);
+ if (orientation_deg >= 90.f)
sky 2015/05/26 19:51:04 Why do you need to do this and 113?
Rick Byers 2015/05/26 20:21:33 Presumably because the TouchEvent extensions note
mustaq 2015/05/26 21:25:59 I agree with Rick that using "orientation" to repr
+ orientation_deg -= 180.f;
+ if (orientation_deg <= -90.f)
+ orientation_deg += 180.f;
if (orientation_deg >= 0) {
// The case orientation_deg == 0 is handled here on purpose: although the
// 'else' block is equivalent in this case, we want to pass the 0 value
« no previous file with comments | « no previous file | ui/events/gesture_detection/motion_event.h » ('j') | ui/events/gesture_detection/motion_event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698