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

Unified Diff: content/browser/renderer_host/input/synthetic_gesture_target_aura.cc

Issue 2633233002: Add the pointer type of pen to the synthetic WebMousEvent (Closed)
Patch Set: pen type Created 3 years, 11 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
Index: content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
index d08f69069270a214356c1b253ec036c5f1c0e857..b58482d9852955af68d9c7bd47e8f1b8299f235f 100644
--- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
+++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
@@ -125,6 +125,16 @@ int WebEventModifiersToEventFlags(int modifiers) {
return flags;
}
+ui::EventPointerType WebMousePointerTypeToEventPointerType(
+ blink::WebPointerProperties::PointerType type) {
+ if (type == blink::WebPointerProperties::PointerType::Mouse)
+ return ui::EventPointerType::POINTER_TYPE_MOUSE;
+ if (type == blink::WebPointerProperties::PointerType::Pen)
+ return ui::EventPointerType::POINTER_TYPE_PEN;
+ NOTREACHED() << "Unexpected mouse event pointer type";
+ return ui::EventPointerType::POINTER_TYPE_UNKNOWN;
+}
+
} // namespace
void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
@@ -138,6 +148,10 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
web_mouse.y * device_scale_factor_);
mouse_event.set_location_f(location);
mouse_event.set_root_location_f(location);
+ ui::PointerDetails pointer_details = mouse_event.pointer_details();
+ pointer_details.pointer_type =
+ WebMousePointerTypeToEventPointerType(web_mouse.pointerType);
+ mouse_event.set_pointer_details(pointer_details);
aura::Window* window = GetWindow();
mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());

Powered by Google App Engine
This is Rietveld 408576698