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

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_target_aura.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-event: mandol_line Created 5 years, 1 month 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
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 "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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ui::EventDispatchDetails details = 50 ui::EventDispatchDetails details =
51 host->event_processor()->OnEventFromSource(*iter); 51 host->event_processor()->OnEventFromSource(*iter);
52 if (details.dispatcher_destroyed) 52 if (details.dispatcher_destroyed)
53 break; 53 break;
54 } 54 }
55 } 55 }
56 56
57 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( 57 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
58 const blink::WebMouseWheelEvent& web_wheel, 58 const blink::WebMouseWheelEvent& web_wheel,
59 const ui::LatencyInfo&) { 59 const ui::LatencyInfo&) {
60 ui::MouseEvent mouse_event(ui::ET_MOUSEWHEEL, gfx::Point(), gfx::Point(),
61 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
60 gfx::PointF location(web_wheel.x * device_scale_factor_, 62 gfx::PointF location(web_wheel.x * device_scale_factor_,
61 web_wheel.y * device_scale_factor_); 63 web_wheel.y * device_scale_factor_);
62 ui::MouseEvent mouse_event(ui::ET_MOUSEWHEEL, location, location, 64 mouse_event.set_location_f(location);
63 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 65 mouse_event.set_root_location_f(location);
64 ui::MouseWheelEvent wheel_event( 66 ui::MouseWheelEvent wheel_event(
65 mouse_event, web_wheel.deltaX, web_wheel.deltaY); 67 mouse_event, web_wheel.deltaX, web_wheel.deltaY);
66 68
67 aura::Window* window = GetWindow(); 69 aura::Window* window = GetWindow();
68 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); 70 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow());
69 ui::EventDispatchDetails details = 71 ui::EventDispatchDetails details =
70 window->GetHost()->event_processor()->OnEventFromSource(&wheel_event); 72 window->GetHost()->event_processor()->OnEventFromSource(&wheel_event);
71 if (details.dispatcher_destroyed) 73 if (details.dispatcher_destroyed)
72 return; 74 return;
73 } 75 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 121 }
120 122
121 return 0; 123 return 0;
122 } 124 }
123 125
124 } // namespace 126 } // namespace
125 127
126 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( 128 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
127 const blink::WebMouseEvent& web_mouse, 129 const blink::WebMouseEvent& web_mouse,
128 const ui::LatencyInfo& latency_info) { 130 const ui::LatencyInfo& latency_info) {
131 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type);
132 int flags = WebMouseEventButtonToFlags(web_mouse.button);
133 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(),
134 ui::EventTimeForNow(), flags, flags);
129 gfx::PointF location(web_mouse.x * device_scale_factor_, 135 gfx::PointF location(web_mouse.x * device_scale_factor_,
130 web_mouse.y * device_scale_factor_); 136 web_mouse.y * device_scale_factor_);
131 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); 137 mouse_event.set_location_f(location);
132 int flags = WebMouseEventButtonToFlags(web_mouse.button); 138 mouse_event.set_root_location_f(location);
133 ui::MouseEvent mouse_event(event_type, location, location,
134 ui::EventTimeForNow(), flags, flags);
135 139
136 aura::Window* window = GetWindow(); 140 aura::Window* window = GetWindow();
137 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); 141 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
138 ui::EventDispatchDetails details = 142 ui::EventDispatchDetails details =
139 window->GetHost()->event_processor()->OnEventFromSource(&mouse_event); 143 window->GetHost()->event_processor()->OnEventFromSource(&mouse_event);
140 if (details.dispatcher_destroyed) 144 if (details.dispatcher_destroyed)
141 return; 145 return;
142 } 146 }
143 147
144 SyntheticGestureParams::GestureSourceType 148 SyntheticGestureParams::GestureSourceType
(...skipping 14 matching lines...) Expand all
159 ->min_distance_for_pinch_scroll_in_pixels(); 163 ->min_distance_for_pinch_scroll_in_pixels();
160 } 164 }
161 165
162 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 166 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
163 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 167 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
164 DCHECK(window); 168 DCHECK(window);
165 return window; 169 return window;
166 } 170 }
167 171
168 } // namespace content 172 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698