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

Side by Side 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: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 10 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
11 #include "content/browser/renderer_host/ui_events_helper.h" 11 #include "content/browser/renderer_host/ui_events_helper.h"
12 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 12 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/aura/window_tree_host.h" 15 #include "ui/aura/window_tree_host.h"
15 #include "ui/events/event_processor.h" 16 #include "ui/events/event_processor.h"
16 #include "ui/events/event_utils.h" 17 #include "ui/events/event_utils.h"
17 #include "ui/events/gesture_detection/gesture_configuration.h" 18 #include "ui/events/gesture_detection/gesture_configuration.h"
18 19
19 using blink::WebTouchEvent; 20 using blink::WebTouchEvent;
20 using blink::WebMouseWheelEvent; 21 using blink::WebMouseWheelEvent;
21 22
22 namespace content { 23 namespace content {
23 24
24 SyntheticGestureTargetAura::SyntheticGestureTargetAura( 25 SyntheticGestureTargetAura::SyntheticGestureTargetAura(
25 RenderWidgetHostImpl* host) 26 RenderWidgetHostImpl* host)
26 : SyntheticGestureTargetBase(host) { 27 : SyntheticGestureTargetBase(host) {
27 blink::WebScreenInfo screenInfo; 28 blink::WebScreenInfo screenInfo;
28 host->GetWebScreenInfo(&screenInfo); 29 host->GetWebScreenInfo(&screenInfo);
29 device_scale_factor_ = screenInfo.deviceScaleFactor; 30 device_scale_factor_ = screenInfo.deviceScaleFactor;
30 } 31 }
31 32
32 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( 33 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform(
33 const WebTouchEvent& web_touch, 34 const WebTouchEvent& web_touch,
34 const ui::LatencyInfo& latency_info) { 35 const ui::LatencyInfo& latency_info) {
35 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info); 36 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info);
36 for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) { 37 for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) {
37 touch_with_latency.event.touches[i].position.x *= device_scale_factor_;
38 touch_with_latency.event.touches[i].position.y *= device_scale_factor_;
bokan 2016/08/25 12:36:51 Why did this get removed in the latest patch?
lanwei 2016/08/25 15:19:57 If we use local coordinates, then we will use even
bokan 2016/08/25 18:53:07 Hmm, in that case, why did we need this in the fir
39 touch_with_latency.event.touches[i].radiusX *= device_scale_factor_; 38 touch_with_latency.event.touches[i].radiusX *= device_scale_factor_;
40 touch_with_latency.event.touches[i].radiusY *= device_scale_factor_; 39 touch_with_latency.event.touches[i].radiusY *= device_scale_factor_;
41 } 40 }
42 ScopedVector<ui::TouchEvent> events; 41 ScopedVector<ui::TouchEvent> events;
43 bool conversion_success = MakeUITouchEventsFromWebTouchEvents( 42 bool conversion_success = MakeUITouchEventsFromWebTouchEvents(
44 touch_with_latency, &events, LOCAL_COORDINATES); 43 touch_with_latency, &events, LOCAL_COORDINATES);
45 DCHECK(conversion_success); 44 DCHECK(conversion_success);
46 45
47 aura::Window* window = GetWindow(); 46 aura::Window* window = GetWindow();
48 aura::WindowTreeHost* host = window->GetHost(); 47 aura::WindowTreeHost* host = window->GetHost();
48
49 // Synthetic touch events will be transformed here before being sent to the
50 // EventProcessor, so they should not be transformed again later in
51 // WindowEventDispatcher.
52 host->dispatcher()->set_transform_events(false);
49 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), 53 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
50 end = events.end(); iter != end; ++iter) { 54 end = events.end(); iter != end; ++iter) {
51 (*iter)->ConvertLocationToTarget(window, host->window()); 55 (*iter)->ConvertLocationToTarget(window, host->window());
52 ui::EventDispatchDetails details = 56 ui::EventDispatchDetails details =
53 host->event_processor()->OnEventFromSource(*iter); 57 host->event_processor()->OnEventFromSource(*iter);
54 if (details.dispatcher_destroyed) 58 if (details.dispatcher_destroyed)
55 break; 59 break;
56 } 60 }
57 } 61 }
58 62
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ->min_distance_for_pinch_scroll_in_pixels(); 169 ->min_distance_for_pinch_scroll_in_pixels();
166 } 170 }
167 171
168 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 172 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
169 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 173 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
170 DCHECK(window); 174 DCHECK(window);
171 return window; 175 return window;
172 } 176 }
173 177
174 } // namespace content 178 } // namespace content
OLDNEW
« 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