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

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

Issue 1760183002: Fixed missing pointerTypes for touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed line-lengths, added a bug ref. Created 4 years, 9 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/blink/blink_event_util.h ('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 00bff44e3b79aba5391aafe63cdbfbadf06bccdc..135c58e9a60a7a852f2a61c10e26cc14307eac8b 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -23,6 +23,7 @@
using blink::WebGestureEvent;
using blink::WebInputEvent;
+using blink::WebPointerProperties;
using blink::WebTouchEvent;
using blink::WebTouchPoint;
@@ -81,30 +82,11 @@ 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::PointerType::Unknown;
- case MotionEvent::TOOL_TYPE_FINGER:
- return WebTouchPoint::PointerType::Touch;
- case MotionEvent::TOOL_TYPE_STYLUS:
- return WebTouchPoint::PointerType::Pen;
- case MotionEvent::TOOL_TYPE_MOUSE:
- return WebTouchPoint::PointerType::Mouse;
- case MotionEvent::TOOL_TYPE_ERASER:
- return WebTouchPoint::PointerType::Unknown;
- }
- NOTREACHED() << "Invalid MotionEvent::ToolType = "
- << event.GetToolType(pointer_index);
- return WebTouchPoint::PointerType::Unknown;
-}
-
WebTouchPoint CreateWebTouchPoint(const MotionEvent& event,
size_t pointer_index) {
WebTouchPoint touch;
touch.id = event.GetPointerId(pointer_index);
- touch.pointerType = ToWebTouchPointPointerType(event, pointer_index);
+ touch.pointerType = ToWebPointerType(event.GetToolType(pointer_index));
touch.state = ToWebTouchPointState(event, pointer_index);
touch.position.x = event.GetX(pointer_index);
touch.position.y = event.GetY(pointer_index);
@@ -462,4 +444,22 @@ scoped_ptr<blink::WebInputEvent> ScaleWebInputEvent(
return scaled_event;
}
+WebPointerProperties::PointerType ToWebPointerType(
+ MotionEvent::ToolType tool_type) {
+ switch (tool_type) {
+ case MotionEvent::TOOL_TYPE_UNKNOWN:
+ return WebPointerProperties::PointerType::Unknown;
+ case MotionEvent::TOOL_TYPE_FINGER:
+ return WebPointerProperties::PointerType::Touch;
+ case MotionEvent::TOOL_TYPE_STYLUS:
+ return WebPointerProperties::PointerType::Pen;
+ case MotionEvent::TOOL_TYPE_MOUSE:
+ return WebPointerProperties::PointerType::Mouse;
+ case MotionEvent::TOOL_TYPE_ERASER:
+ return WebPointerProperties::PointerType::Unknown;
+ }
+ NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type;
+ return WebPointerProperties::PointerType::Unknown;
+}
+
} // namespace ui
« no previous file with comments | « ui/events/blink/blink_event_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698