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

Unified Diff: content/browser/renderer_host/input/motion_event_web.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 | « no previous file | ui/events/blink/blink_event_util.cc » ('j') | ui/events/blink/blink_event_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/motion_event_web.cc
diff --git a/content/browser/renderer_host/input/motion_event_web.cc b/content/browser/renderer_host/input/motion_event_web.cc
index bc47cf8c17734a662dc43ad10a8662340fbed16f..82b6ed7861b6cd2c5c3fbe0fe8cc853b8d7c7772 100644
--- a/content/browser/renderer_host/input/motion_event_web.cc
+++ b/content/browser/renderer_host/input/motion_event_web.cc
@@ -14,6 +14,7 @@
#include "content/common/input/web_touch_event_traits.h"
using blink::WebInputEvent;
+using blink::WebPointerProperties;
using blink::WebTouchEvent;
using blink::WebTouchPoint;
@@ -157,9 +158,23 @@ base::TimeTicks MotionEventWeb::GetEventTime() const {
ui::MotionEvent::ToolType MotionEventWeb::GetToolType(
size_t pointer_index) const {
- // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128.
DCHECK_LT(pointer_index, GetPointerCount());
- return TOOL_TYPE_UNKNOWN;
+
+ const WebPointerProperties& pointer = event_.touches[pointer_index];
+
+ switch (pointer.pointerType) {
+ case WebPointerProperties::PointerTypeUnknown:
+ return TOOL_TYPE_UNKNOWN;
+ case WebPointerProperties::PointerTypeMouse:
+ return TOOL_TYPE_MOUSE;
+ case WebPointerProperties::PointerTypePen:
+ return TOOL_TYPE_STYLUS;
+ case WebPointerProperties::PointerTypeTouch:
+ return TOOL_TYPE_FINGER;
+ default:
+ NOTREACHED() << "Unhandled pointer type " << pointer.pointerType;
+ return TOOL_TYPE_UNKNOWN;
+ }
}
int MotionEventWeb::GetButtonState() const {
« no previous file with comments | « no previous file | ui/events/blink/blink_event_util.cc » ('j') | ui/events/blink/blink_event_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698