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

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: Pass pointer_index 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..14351effe1670073e616281ee761066d5ec405ac 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -71,10 +71,29 @@ WebTouchPoint::State ToWebTouchPointState(const MotionEvent& event,
return WebTouchPoint::StateUndefined;
}
+WebTouchPoint::PointerType ToWebTouchPointPointerType(
+ const MotionEvent& event, size_t pointer_index) {
+ switch (event.GetToolType()) {
jdduke (slow) 2015/08/10 20:55:41 Wait, why aren't you calling event.GetToolType(poi
USE eero AT chromium.org 2015/08/10 22:43:37 Embarrassing. I will fix that tomorrow.
USE eero AT chromium.org 2015/08/11 14:37:08 Done. Thanks for spotting that and sorry for my mi
+ 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();
+ 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