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

Unified Diff: components/html_viewer/blink_input_events_type_converters.cc

Issue 1344223002: Revert of Overhaul Mandoline event transport code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « components/html_viewer/DEPS ('k') | components/html_viewer/html_frame.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/blink_input_events_type_converters.cc
diff --git a/components/html_viewer/blink_input_events_type_converters.cc b/components/html_viewer/blink_input_events_type_converters.cc
index b1446ec92d7acdb47b585aaa9bd410e660e37576..0e8b1d67fbf74861e3b229ed23447b59591195d4 100644
--- a/components/html_viewer/blink_input_events_type_converters.cc
+++ b/components/html_viewer/blink_input_events_type_converters.cc
@@ -61,18 +61,18 @@
return 1;
}
-void SetWebMouseEventLocation(const mojo::LocationData& location_data,
+void SetWebMouseEventLocation(const mojo::PointerData& pointer_data,
blink::WebMouseEvent* web_event) {
- web_event->x = static_cast<int>(location_data.x);
- web_event->y = static_cast<int>(location_data.y);
- web_event->globalX = static_cast<int>(location_data.screen_x);
- web_event->globalY = static_cast<int>(location_data.screen_y);
+ web_event->x = static_cast<int>(pointer_data.x);
+ web_event->y = static_cast<int>(pointer_data.y);
+ web_event->globalX = static_cast<int>(pointer_data.screen_x);
+ web_event->globalY = static_cast<int>(pointer_data.screen_y);
}
scoped_ptr<blink::WebInputEvent> BuildWebMouseEventFrom(const EventPtr& event) {
scoped_ptr<blink::WebMouseEvent> web_event(new blink::WebMouseEvent);
- SetWebMouseEventLocation(*(event->pointer_data->location), web_event.get());
+ SetWebMouseEventLocation(*(event->pointer_data), web_event.get());
web_event->modifiers = EventFlagsToWebEventModifiers(event->flags);
web_event->timeStampSeconds = EventTimeToWebEventTime(event);
@@ -145,42 +145,20 @@
web_event->modifiers = EventFlagsToWebEventModifiers(event->flags);
web_event->timeStampSeconds = EventTimeToWebEventTime(event);
- SetWebMouseEventLocation(*(event->wheel_data->location), web_event.get());
+ SetWebMouseEventLocation(*(event->pointer_data), web_event.get());
- // TODO(rjkroege): Update the following code once Blink supports
- // DOM Level 3 wheel events
- // (http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents)
- web_event->deltaX = event->wheel_data->delta_x;
- web_event->deltaY = event->wheel_data->delta_y;
+ if ((event->flags & mojo::EVENT_FLAGS_SHIFT_DOWN) != 0 &&
+ event->pointer_data->horizontal_wheel == 0) {
+ web_event->deltaX = event->pointer_data->horizontal_wheel;
+ web_event->deltaY = 0;
+ } else {
+ web_event->deltaX = event->pointer_data->horizontal_wheel;
+ web_event->deltaY = event->pointer_data->vertical_wheel;
+ }
+ // TODO(sky): resole this, doesn't work for desktop.
web_event->wheelTicksX = web_event->deltaX / kPixelsPerTick;
web_event->wheelTicksY = web_event->deltaY / kPixelsPerTick;
-
- // TODO(rjkroege): Mandoline currently only generates WHEEL_MODE_LINE
- // wheel events so the other modes are not yet tested. Verify that
- // the implementation is correct.
- switch (event->wheel_data->mode) {
- case mojo::WHEEL_MODE_PIXEL:
- web_event->hasPreciseScrollingDeltas = true;
- web_event->scrollByPage = false;
- web_event->canScroll = true;
- break;
- case mojo::WHEEL_MODE_LINE:
- web_event->hasPreciseScrollingDeltas = false;
- web_event->scrollByPage = false;
- web_event->canScroll = true;
- break;
- case mojo::WHEEL_MODE_PAGE:
- web_event->hasPreciseScrollingDeltas = false;
- web_event->scrollByPage = true;
- web_event->canScroll = true;
- break;
- case mojo::WHEEL_MODE_SCALING:
- web_event->hasPreciseScrollingDeltas = false;
- web_event->scrollByPage = false;
- web_event->canScroll = false;
- break;
- }
return web_event.Pass();
}
@@ -191,20 +169,20 @@
scoped_ptr<blink::WebInputEvent>
TypeConverter<scoped_ptr<blink::WebInputEvent>, EventPtr>::Convert(
const EventPtr& event) {
- switch (event->action) {
- case mojo::EVENT_TYPE_POINTER_DOWN:
- case mojo::EVENT_TYPE_POINTER_UP:
- case mojo::EVENT_TYPE_POINTER_CANCEL:
- case mojo::EVENT_TYPE_POINTER_MOVE:
- if (event->pointer_data->kind == mojo::POINTER_KIND_MOUSE)
- return BuildWebMouseEventFrom(event);
- case mojo::EVENT_TYPE_WHEEL:
+ if (event->action == mojo::EVENT_TYPE_POINTER_DOWN ||
+ event->action == mojo::EVENT_TYPE_POINTER_UP ||
+ event->action == mojo::EVENT_TYPE_POINTER_CANCEL ||
+ event->action == mojo::EVENT_TYPE_POINTER_MOVE) {
+ if (event->pointer_data->horizontal_wheel != 0 ||
+ event->pointer_data->vertical_wheel != 0) {
return BuildWebMouseWheelEventFrom(event);
- case mojo::EVENT_TYPE_KEY_PRESSED:
- case mojo::EVENT_TYPE_KEY_RELEASED:
- return BuildWebKeyboardEvent(event);
- case mojo::EVENT_TYPE_UNKNOWN:
- return nullptr;
+ }
+ if (event->pointer_data->kind == mojo::POINTER_KIND_MOUSE)
+ return BuildWebMouseEventFrom(event);
+ } else if ((event->action == mojo::EVENT_TYPE_KEY_PRESSED ||
+ event->action == mojo::EVENT_TYPE_KEY_RELEASED) &&
+ event->key_data) {
+ return BuildWebKeyboardEvent(event);
}
return nullptr;
}
« no previous file with comments | « components/html_viewer/DEPS ('k') | components/html_viewer/html_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698