Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index 71bde17b44c3d978dee81d1b5c9e99ab48666b4f..028f022a8a06f20b1686583636451e17406d3a83 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -68,6 +68,7 @@ using base::android::ConvertUTF8ToJavaString; |
using base::android::ScopedJavaLocalRef; |
using blink::WebGestureEvent; |
using blink::WebInputEvent; |
+using blink::WebPointerProperties; |
namespace content { |
@@ -152,6 +153,23 @@ int ToGestureEventType(WebInputEvent::Type type) { |
} |
} |
+WebPointerProperties::PointerType ToWebPointerType(int tool_type) { |
Rick Byers
2016/03/07 17:52:20
I think there's an existing process for sharing en
mustaq
2016/03/07 21:50:42
Reused the method in blink_event_util here.
Rick Byers
2016/03/08 15:43:37
Ah, even better - thanks!
|
+ switch (tool_type) { |
+ case 0: |
+ return WebPointerProperties::PointerType::Unknown; |
+ case 1: |
+ return WebPointerProperties::PointerType::Touch; |
+ case 2: |
+ case 4: |
+ return WebPointerProperties::PointerType::Pen; |
+ case 3: |
+ return WebPointerProperties::PointerType::Mouse; |
+ default: |
+ NOTREACHED() << "Invalid tool type: " << tool_type; |
+ return WebPointerProperties::PointerType::Unknown; |
+ } |
+} |
+ |
} // namespace |
// Enables a callback when the underlying WebContents is destroyed, to enable |
@@ -981,7 +999,8 @@ jboolean ContentViewCoreImpl::SendMouseMoveEvent( |
const JavaParamRef<jobject>& obj, |
jlong time_ms, |
jfloat x, |
- jfloat y) { |
+ jfloat y, |
+ jint tool_type) { |
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
if (!rwhv) |
return false; |
@@ -989,7 +1008,8 @@ jboolean ContentViewCoreImpl::SendMouseMoveEvent( |
blink::WebMouseEvent event = WebMouseEventBuilder::Build( |
WebInputEvent::MouseMove, |
blink::WebMouseEvent::ButtonNone, |
- time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1); |
+ time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1, |
+ ToWebPointerType(tool_type)); |
rwhv->SendMouseEvent(event); |
return true; |