OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
6 | 6 |
7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
9 #include "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
10 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 10 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 device_scale_factor_ = screenInfo.deviceScaleFactor; | 27 device_scale_factor_ = screenInfo.deviceScaleFactor; |
28 } | 28 } |
29 | 29 |
30 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( | 30 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( |
31 const WebTouchEvent& web_touch, | 31 const WebTouchEvent& web_touch, |
32 const ui::LatencyInfo& latency_info) { | 32 const ui::LatencyInfo& latency_info) { |
33 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info); | 33 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info); |
34 for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) { | 34 for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) { |
35 touch_with_latency.event.touches[i].position.x *= device_scale_factor_; | 35 touch_with_latency.event.touches[i].position.x *= device_scale_factor_; |
36 touch_with_latency.event.touches[i].position.y *= device_scale_factor_; | 36 touch_with_latency.event.touches[i].position.y *= device_scale_factor_; |
37 touch_with_latency.event.touches[i].radiusX *= device_scale_factor_; | 37 touch_with_latency.event.touches[i].width *= device_scale_factor_; |
38 touch_with_latency.event.touches[i].radiusY *= device_scale_factor_; | 38 touch_with_latency.event.touches[i].height *= device_scale_factor_; |
39 } | 39 } |
40 ScopedVector<ui::TouchEvent> events; | 40 ScopedVector<ui::TouchEvent> events; |
41 bool conversion_success = MakeUITouchEventsFromWebTouchEvents( | 41 bool conversion_success = MakeUITouchEventsFromWebTouchEvents( |
42 touch_with_latency, &events, LOCAL_COORDINATES); | 42 touch_with_latency, &events, LOCAL_COORDINATES); |
43 DCHECK(conversion_success); | 43 DCHECK(conversion_success); |
44 | 44 |
45 aura::Window* window = GetWindow(); | 45 aura::Window* window = GetWindow(); |
46 aura::WindowTreeHost* host = window->GetHost(); | 46 aura::WindowTreeHost* host = window->GetHost(); |
47 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), | 47 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), |
48 end = events.end(); iter != end; ++iter) { | 48 end = events.end(); iter != end; ++iter) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 ->min_distance_for_pinch_scroll_in_pixels(); | 159 ->min_distance_for_pinch_scroll_in_pixels(); |
160 } | 160 } |
161 | 161 |
162 aura::Window* SyntheticGestureTargetAura::GetWindow() const { | 162 aura::Window* SyntheticGestureTargetAura::GetWindow() const { |
163 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); | 163 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); |
164 DCHECK(window); | 164 DCHECK(window); |
165 return window; | 165 return window; |
166 } | 166 } |
167 | 167 |
168 } // namespace content | 168 } // namespace content |
OLD | NEW |