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

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

Issue 2287403002: Create MouseWheelEvent directly instead of through MouseEvent. (Closed)
Patch Set: test 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
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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ui::EventDispatchDetails details = 52 ui::EventDispatchDetails details =
53 host->event_processor()->OnEventFromSource(*iter); 53 host->event_processor()->OnEventFromSource(*iter);
54 if (details.dispatcher_destroyed) 54 if (details.dispatcher_destroyed)
55 break; 55 break;
56 } 56 }
57 } 57 }
58 58
59 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( 59 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
60 const blink::WebMouseWheelEvent& web_wheel, 60 const blink::WebMouseWheelEvent& web_wheel,
61 const ui::LatencyInfo&) { 61 const ui::LatencyInfo&) {
62 ui::MouseEvent mouse_event(ui::ET_MOUSEWHEEL, gfx::Point(), gfx::Point(), 62 ui::MouseWheelEvent wheel_event(
63 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 63 gfx::Vector2d(web_wheel.deltaX, web_wheel.deltaY), gfx::Point(),
64 gfx::Point(), ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
64 gfx::PointF location(web_wheel.x * device_scale_factor_, 65 gfx::PointF location(web_wheel.x * device_scale_factor_,
65 web_wheel.y * device_scale_factor_); 66 web_wheel.y * device_scale_factor_);
66 mouse_event.set_location_f(location); 67 wheel_event.set_location_f(location);
67 mouse_event.set_root_location_f(location); 68 wheel_event.set_root_location_f(location);
68 ui::MouseWheelEvent wheel_event(
69 mouse_event, web_wheel.deltaX, web_wheel.deltaY);
70 69
71 aura::Window* window = GetWindow(); 70 aura::Window* window = GetWindow();
72 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); 71 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow());
73 ui::EventDispatchDetails details = 72 ui::EventDispatchDetails details =
74 window->GetHost()->event_processor()->OnEventFromSource(&wheel_event); 73 window->GetHost()->event_processor()->OnEventFromSource(&wheel_event);
75 if (details.dispatcher_destroyed) 74 if (details.dispatcher_destroyed)
76 return; 75 return;
77 } 76 }
78 77
79 namespace { 78 namespace {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ->min_distance_for_pinch_scroll_in_pixels(); 164 ->min_distance_for_pinch_scroll_in_pixels();
166 } 165 }
167 166
168 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 167 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
169 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 168 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
170 DCHECK(window); 169 DCHECK(window);
171 return window; 170 return window;
172 } 171 }
173 172
174 } // namespace content 173 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698