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

Unified Diff: sky/viewer/converters/input_event_types.cc

Issue 876853005: Add wheel support to sky-scrollable (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files Created 5 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
« no previous file with comments | « sky/framework/sky-scrollable.sky ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/viewer/converters/input_event_types.cc
diff --git a/sky/viewer/converters/input_event_types.cc b/sky/viewer/converters/input_event_types.cc
index 10ee2614d6edacd7ef9386f7d08cb581d5d73282..6c8892ba7e98c5e9c33963dd1cceda15ffdafe60 100644
--- a/sky/viewer/converters/input_event_types.cc
+++ b/sky/viewer/converters/input_event_types.cc
@@ -165,14 +165,6 @@ scoped_ptr<blink::WebInputEvent> BuildWebGestureEvent(
web_event->x = event->location_data->in_view_location->x / device_pixel_ratio;
web_event->y = event->location_data->in_view_location->y / device_pixel_ratio;
- // TODO(erg): Remove this null check as parallel to above.
- if (!event->location_data->screen_location.is_null()) {
- web_event->globalX =
- event->location_data->screen_location->x / device_pixel_ratio;
- web_event->globalY =
- event->location_data->screen_location->y / device_pixel_ratio;
- }
-
return web_event.Pass();
}
@@ -204,6 +196,26 @@ scoped_ptr<blink::WebInputEvent> BuildWebKeyboardEvent(
return web_event.Pass();
}
+scoped_ptr<blink::WebInputEvent> BuildWebWheelEvent(
+ const mojo::EventPtr& event, float device_pixel_ratio) {
+ scoped_ptr<blink::WebWheelEvent> web_event(new blink::WebWheelEvent);
+
+ web_event->modifiers = EventFlagsToWebInputEventModifiers(event->flags);
+ web_event->timeStampMS =
+ base::TimeDelta::FromInternalValue(event->time_stamp).InMillisecondsF();
+
+ web_event->type = blink::WebInputEvent::WheelEvent;
+
+ const auto& location = event->location_data->in_view_location;
+ web_event->x = location->x / device_pixel_ratio;
+ web_event->y = location->y / device_pixel_ratio;
+
+ web_event->offsetX = event->wheel_data->x_offset / device_pixel_ratio;
+ web_event->offsetY = event->wheel_data->y_offset / device_pixel_ratio;
+
+ return web_event.Pass();
+}
+
} // namespace
scoped_ptr<blink::WebInputEvent> ConvertEvent(const mojo::EventPtr& event,
@@ -242,6 +254,9 @@ scoped_ptr<blink::WebInputEvent> ConvertEvent(const mojo::EventPtr& event,
event->action == mojo::EVENT_TYPE_KEY_RELEASED) &&
event->key_data) {
return BuildWebKeyboardEvent(event, device_pixel_ratio);
+ } else if (event->action == mojo::EVENT_TYPE_MOUSEWHEEL &&
+ event->wheel_data) {
+ return BuildWebWheelEvent(event, device_pixel_ratio);
}
return scoped_ptr<blink::WebInputEvent>();
« no previous file with comments | « sky/framework/sky-scrollable.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698