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

Unified Diff: ui/events/blink/blink_event_util.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 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 | « third_party/WebKit/public/platform/WebTouchPoint.h ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/blink/blink_event_util.cc
diff --git a/ui/events/blink/blink_event_util.cc b/ui/events/blink/blink_event_util.cc
index 65fc18dbe5d152e1c6f1ac6aa3532e08b7e50621..6205e6385d1d6093bac531e7b596ceb2c46b5d26 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -758,10 +758,9 @@ std::unique_ptr<blink::WebInputEvent> TranslateAndScaleWebInputEvent(
blink::WebMouseWheelEvent* wheel_event = new blink::WebMouseWheelEvent;
scaled_event.reset(wheel_event);
*wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event);
- wheel_event->x += delta.x();
- wheel_event->y += delta.y();
- wheel_event->x *= scale;
- wheel_event->y *= scale;
+ float x = (wheel_event->positionInWidget().x + delta.x()) * scale;
+ float y = (wheel_event->positionInWidget().y + delta.y()) * scale;
+ wheel_event->setPositionInWidget(x, y);
if (!wheel_event->scrollByPage) {
wheel_event->deltaX *= scale;
wheel_event->deltaY *= scale;
@@ -772,10 +771,9 @@ std::unique_ptr<blink::WebInputEvent> TranslateAndScaleWebInputEvent(
blink::WebMouseEvent* mouse_event = new blink::WebMouseEvent;
scaled_event.reset(mouse_event);
*mouse_event = static_cast<const blink::WebMouseEvent&>(event);
- mouse_event->x += delta.x();
- mouse_event->y += delta.y();
- mouse_event->x *= scale;
- mouse_event->y *= scale;
+ float x = (mouse_event->positionInWidget().x + delta.x()) * scale;
+ float y = (mouse_event->positionInWidget().y + delta.y()) * scale;
+ mouse_event->setPositionInWidget(x, y);
mouse_event->movementX *= scale;
mouse_event->movementY *= scale;
} else if (blink::WebInputEvent::isTouchEventType(event.type())) {
« no previous file with comments | « third_party/WebKit/public/platform/WebTouchPoint.h ('k') | ui/events/blink/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698