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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Truncated to int on input, git cl format 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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 break; 63 break;
64 } 64 }
65 } 65 }
66 66
67 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( 67 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
68 const blink::WebMouseWheelEvent& web_wheel, 68 const blink::WebMouseWheelEvent& web_wheel,
69 const ui::LatencyInfo&) { 69 const ui::LatencyInfo&) {
70 ui::MouseWheelEvent wheel_event( 70 ui::MouseWheelEvent wheel_event(
71 gfx::Vector2d(web_wheel.deltaX, web_wheel.deltaY), gfx::Point(), 71 gfx::Vector2d(web_wheel.deltaX, web_wheel.deltaY), gfx::Point(),
72 gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 72 gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
73 gfx::PointF location(web_wheel.x * device_scale_factor_, 73 gfx::PointF location(web_wheel.positionInWidget().x * device_scale_factor_,
74 web_wheel.y * device_scale_factor_); 74 web_wheel.positionInWidget().y * device_scale_factor_);
75 wheel_event.set_location_f(location); 75 wheel_event.set_location_f(location);
76 wheel_event.set_root_location_f(location); 76 wheel_event.set_root_location_f(location);
77 77
78 aura::Window* window = GetWindow(); 78 aura::Window* window = GetWindow();
79 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); 79 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow());
80 ui::EventDispatchDetails details = 80 ui::EventDispatchDetails details =
81 window->GetHost()->event_sink()->OnEventFromSource(&wheel_event); 81 window->GetHost()->event_sink()->OnEventFromSource(&wheel_event);
82 if (details.dispatcher_destroyed) 82 if (details.dispatcher_destroyed)
83 return; 83 return;
84 } 84 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } // namespace 140 } // namespace
141 141
142 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( 142 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
143 const blink::WebMouseEvent& web_mouse_event, 143 const blink::WebMouseEvent& web_mouse_event,
144 const ui::LatencyInfo& latency_info) { 144 const ui::LatencyInfo& latency_info) {
145 ui::EventType event_type = 145 ui::EventType event_type =
146 WebMouseEventTypeToEventType(web_mouse_event.type()); 146 WebMouseEventTypeToEventType(web_mouse_event.type());
147 int flags = WebEventModifiersToEventFlags(web_mouse_event.modifiers()); 147 int flags = WebEventModifiersToEventFlags(web_mouse_event.modifiers());
148 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(), 148 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(),
149 ui::EventTimeForNow(), flags, flags); 149 ui::EventTimeForNow(), flags, flags);
150 gfx::PointF location(web_mouse_event.x * device_scale_factor_, 150 gfx::PointF location(
151 web_mouse_event.y * device_scale_factor_); 151 web_mouse_event.positionInWidget().x * device_scale_factor_,
152 web_mouse_event.positionInWidget().y * device_scale_factor_);
152 mouse_event.set_location_f(location); 153 mouse_event.set_location_f(location);
153 mouse_event.set_root_location_f(location); 154 mouse_event.set_root_location_f(location);
154 ui::PointerDetails pointer_details = mouse_event.pointer_details(); 155 ui::PointerDetails pointer_details = mouse_event.pointer_details();
155 pointer_details.pointer_type = 156 pointer_details.pointer_type =
156 WebMousePointerTypeToEventPointerType(web_mouse_event.pointerType); 157 WebMousePointerTypeToEventPointerType(web_mouse_event.pointerType);
157 mouse_event.set_pointer_details(pointer_details); 158 mouse_event.set_pointer_details(pointer_details);
158 159
159 aura::Window* window = GetWindow(); 160 aura::Window* window = GetWindow();
160 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); 161 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
161 ui::EventDispatchDetails details = 162 ui::EventDispatchDetails details =
(...skipping 20 matching lines...) Expand all
182 ->min_distance_for_pinch_scroll_in_pixels(); 183 ->min_distance_for_pinch_scroll_in_pixels();
183 } 184 }
184 185
185 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 186 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
186 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 187 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
187 DCHECK(window); 188 DCHECK(window);
188 return window; 189 return window;
189 } 190 }
190 191
191 } // namespace content 192 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698