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

Unified Diff: mojo/converters/blink/blink_input_events_type_converters.cc

Issue 1880673002: Pass PointerType from Mojo EventPtr to WebInputEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/converters/blink/blink_input_events_type_converters.cc
diff --git a/mojo/converters/blink/blink_input_events_type_converters.cc b/mojo/converters/blink/blink_input_events_type_converters.cc
index c7857c924172ed2d3618cc98385f2ac911e8ec1c..c6890efba9558bad33eaa726c77ba75d702ebf10 100644
--- a/mojo/converters/blink/blink_input_events_type_converters.cc
+++ b/mojo/converters/blink/blink_input_events_type_converters.cc
@@ -63,6 +63,20 @@ int GetClickCount(int flags) {
return 1;
}
+blink::WebPointerProperties::PointerType EventPointerKindToWebPointerType(
+ mus::mojom::PointerKind pointer_kind) {
+ switch (pointer_kind) {
+ case mus::mojom::PointerKind::MOUSE:
+ return blink::WebPointerProperties::PointerType::Mouse;
+ case mus::mojom::PointerKind::TOUCH:
+ return blink::WebPointerProperties::PointerType::Touch;
+ case mus::mojom::PointerKind::PEN:
+ return blink::WebPointerProperties::PointerType::Pen;
+ }
+ NOTREACHED();
+ return blink::WebPointerProperties::PointerType::Unknown;
+}
+
void SetWebMouseEventLocation(const mus::mojom::LocationData& location_data,
blink::WebMouseEvent* web_event) {
web_event->x = static_cast<int>(location_data.x);
@@ -74,7 +88,8 @@ void SetWebMouseEventLocation(const mus::mojom::LocationData& location_data,
scoped_ptr<blink::WebInputEvent> BuildWebMouseEventFrom(
const mus::mojom::EventPtr& event) {
scoped_ptr<blink::WebMouseEvent> web_event(new blink::WebMouseEvent);
- // TODO(crbug.com/593375): Set pointerType from event->pointer_data->kind
+ web_event->pointerType =
+ EventPointerKindToWebPointerType(event->pointer_data->kind);
if (event->pointer_data && event->pointer_data->location)
SetWebMouseEventLocation(*(event->pointer_data->location), web_event.get());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698