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

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

Issue 1190013002: Pass MotionEvent tool type to Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOTREACHED message Created 5 years, 4 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 | « content/browser/renderer_host/input/motion_event_web.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b389600f23b33709d46b444a4dcb420368403f6b..ce800817c74070e2e5776ca8334a1323ade9ecd8 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -71,10 +71,30 @@ WebTouchPoint::State ToWebTouchPointState(const MotionEvent& event,
return WebTouchPoint::StateUndefined;
}
+WebTouchPoint::PointerType ToWebTouchPointPointerType(const MotionEvent& event,
+ size_t pointer_index) {
+ switch (event.GetToolType(pointer_index)) {
+ case MotionEvent::TOOL_TYPE_UNKNOWN:
+ return WebTouchPoint::PointerTypeUnknown;
+ case MotionEvent::TOOL_TYPE_FINGER:
+ return WebTouchPoint::PointerTypeTouch;
+ case MotionEvent::TOOL_TYPE_STYLUS:
+ return WebTouchPoint::PointerTypePen;
+ case MotionEvent::TOOL_TYPE_MOUSE:
+ return WebTouchPoint::PointerTypeMouse;
+ case MotionEvent::TOOL_TYPE_ERASER:
+ return WebTouchPoint::PointerTypeUnknown;
+ }
+ NOTREACHED() << "Invalid MotionEvent::ToolType = "
+ << event.GetToolType(pointer_index);
+ return WebTouchPoint::PointerTypeUnknown;
+}
+
WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
size_t pointer_index) {
WebTouchPoint touch;
touch.id = event.GetPointerId(pointer_index);
+ touch.pointerType = ToWebTouchPointPointerType(event, pointer_index);
touch.state = ToWebTouchPointState(event, pointer_index);
touch.position.x = event.GetX(pointer_index);
touch.position.y = event.GetY(pointer_index);
« no previous file with comments | « content/browser/renderer_host/input/motion_event_web.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698