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

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

Issue 2269483002: Set the coordinates of the synthetic touch event correctly in SyntheticGestureTargetAura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Scale the position later Created 4 years, 4 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 | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 64e1c16b9f72172561d84f1da9cb712e9c378fa6..8d5c8022572759114afd84d0b15dab93628ffefd 100644
--- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
+++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
@@ -34,8 +34,6 @@ void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform(
const ui::LatencyInfo& latency_info) {
TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info);
for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) {
- touch_with_latency.event.touches[i].position.x *= device_scale_factor_;
- touch_with_latency.event.touches[i].position.y *= device_scale_factor_;
touch_with_latency.event.touches[i].radiusX *= device_scale_factor_;
touch_with_latency.event.touches[i].radiusY *= device_scale_factor_;
}
@@ -49,6 +47,15 @@ void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform(
for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
end = events.end(); iter != end; ++iter) {
(*iter)->ConvertLocationToTarget(window, host->window());
+
+ // Apply the screen scale factor to the event location after it has been
+ // transformed to the target.
+ gfx::PointF device_location =
+ gfx::ScalePoint((*iter)->location_f(), device_scale_factor_);
+ gfx::PointF device_root_location =
+ gfx::ScalePoint((*iter)->root_location_f(), device_scale_factor_);
+ (*iter)->set_location_f(device_location);
+ (*iter)->set_root_location_f(device_root_location);
ui::EventDispatchDetails details =
host->event_processor()->OnEventFromSource(*iter);
if (details.dispatcher_destroyed)
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698