| 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 <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 Loading... |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } // namespace | 144 } // namespace |
| 145 | 145 |
| 146 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( | 146 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( |
| 147 const blink::WebMouseEvent& web_mouse_event, | 147 const blink::WebMouseEvent& web_mouse_event, |
| 148 const ui::LatencyInfo& latency_info) { | 148 const ui::LatencyInfo& latency_info) { |
| 149 ui::EventType event_type = | 149 ui::EventType event_type = |
| 150 WebMouseEventTypeToEventType(web_mouse_event.type()); | 150 WebMouseEventTypeToEventType(web_mouse_event.type()); |
| 151 int flags = WebEventModifiersToEventFlags(web_mouse_event.modifiers()); | 151 int flags = WebEventModifiersToEventFlags(web_mouse_event.modifiers()); |
| 152 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(), | 152 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(), |
| 153 ui::EventTimeForNow(), flags, flags); | 153 ui::EventTimeForNow(), flags, flags); |
| 154 gfx::PointF location(web_mouse_event.x * device_scale_factor_, | 154 gfx::PointF location( |
| 155 web_mouse_event.y * device_scale_factor_); | 155 web_mouse_event.positionInWidget().x * device_scale_factor_, |
| 156 web_mouse_event.positionInWidget().y * device_scale_factor_); |
| 156 mouse_event.set_location_f(location); | 157 mouse_event.set_location_f(location); |
| 157 mouse_event.set_root_location_f(location); | 158 mouse_event.set_root_location_f(location); |
| 158 ui::PointerDetails pointer_details = mouse_event.pointer_details(); | 159 ui::PointerDetails pointer_details = mouse_event.pointer_details(); |
| 159 pointer_details.pointer_type = | 160 pointer_details.pointer_type = |
| 160 WebMousePointerTypeToEventPointerType(web_mouse_event.pointerType); | 161 WebMousePointerTypeToEventPointerType(web_mouse_event.pointerType); |
| 161 mouse_event.set_pointer_details(pointer_details); | 162 mouse_event.set_pointer_details(pointer_details); |
| 162 | 163 |
| 163 aura::Window* window = GetWindow(); | 164 aura::Window* window = GetWindow(); |
| 164 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); | 165 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); |
| 165 ui::EventDispatchDetails details = | 166 ui::EventDispatchDetails details = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 186 ->min_distance_for_pinch_scroll_in_pixels(); | 187 ->min_distance_for_pinch_scroll_in_pixels(); |
| 187 } | 188 } |
| 188 | 189 |
| 189 aura::Window* SyntheticGestureTargetAura::GetWindow() const { | 190 aura::Window* SyntheticGestureTargetAura::GetWindow() const { |
| 190 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); | 191 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); |
| 191 DCHECK(window); | 192 DCHECK(window); |
| 192 return window; | 193 return window; |
| 193 } | 194 } |
| 194 | 195 |
| 195 } // namespace content | 196 } // namespace content |
| OLD | NEW |