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

Unified Diff: ui/events/gesture_detection/gesture_event_data.cc

Issue 2925883003: [Touch Adjustment] Pass primary_pointer_type to WebGestureEvent and disable adjustment for stylus (Closed)
Patch Set: jochen and dtapuska's comments: Add default value Created 3 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
« no previous file with comments | « ui/events/gesture_detection/gesture_event_data.h ('k') | ui/events/gesture_event_details.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_detection/gesture_event_data.cc
diff --git a/ui/events/gesture_detection/gesture_event_data.cc b/ui/events/gesture_detection/gesture_event_data.cc
index 17af37551e79de466c813017ccf69293ef607665..74a11be246af54e0ba47817f1f43e82ceac6eb5a 100644
--- a/ui/events/gesture_detection/gesture_event_data.cc
+++ b/ui/events/gesture_detection/gesture_event_data.cc
@@ -8,6 +8,28 @@
namespace ui {
+namespace {
+
+EventPointerType ToEventPointerType(MotionEvent::ToolType tool_type) {
+ switch (tool_type) {
+ case MotionEvent::TOOL_TYPE_UNKNOWN:
+ return EventPointerType::POINTER_TYPE_UNKNOWN;
+ case MotionEvent::TOOL_TYPE_FINGER:
+ return EventPointerType::POINTER_TYPE_TOUCH;
+ case MotionEvent::TOOL_TYPE_STYLUS:
+ return EventPointerType::POINTER_TYPE_PEN;
+ case MotionEvent::TOOL_TYPE_MOUSE:
+ return EventPointerType::POINTER_TYPE_MOUSE;
+ case MotionEvent::TOOL_TYPE_ERASER:
+ return EventPointerType::POINTER_TYPE_ERASER;
+ default:
+ NOTREACHED() << "Invalid ToolType = " << tool_type;
+ return EventPointerType::POINTER_TYPE_UNKNOWN;
+ }
+}
+
+} // anonymous namespace
+
GestureEventData::GestureEventData(const GestureEventDetails& details,
int motion_event_id,
MotionEvent::ToolType primary_tool_type,
@@ -32,6 +54,7 @@ GestureEventData::GestureEventData(const GestureEventDetails& details,
unique_touch_event_id(unique_touch_event_id) {
DCHECK_GE(motion_event_id, 0);
DCHECK_NE(0U, touch_point_count);
+ this->details.set_primary_pointer_type(ToEventPointerType(primary_tool_type));
this->details.set_touch_points(static_cast<int>(touch_point_count));
this->details.set_bounding_box(bounding_box);
}
@@ -48,6 +71,7 @@ GestureEventData::GestureEventData(EventType type,
raw_y(other.raw_y),
flags(other.flags),
unique_touch_event_id(other.unique_touch_event_id) {
+ details.set_primary_pointer_type(other.details.primary_pointer_type());
details.set_touch_points(other.details.touch_points());
details.set_bounding_box(other.details.bounding_box_f());
}
« no previous file with comments | « ui/events/gesture_detection/gesture_event_data.h ('k') | ui/events/gesture_event_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698