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

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

Issue 2634183002: Support multi-button press for synthetic mouse events (Closed)
Patch Set: button Created 3 years, 11 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 | content/browser/renderer_host/input/synthetic_mouse_driver.h » ('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"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 NOTREACHED() << "WebInputEvent::ContextMenu not supported by" 105 NOTREACHED() << "WebInputEvent::ContextMenu not supported by"
106 "SyntheticGestureTargetAura"; 106 "SyntheticGestureTargetAura";
107 107
108 default: 108 default:
109 NOTREACHED(); 109 NOTREACHED();
110 } 110 }
111 111
112 return ui::ET_UNKNOWN; 112 return ui::ET_UNKNOWN;
113 } 113 }
114 114
115 int WebMouseEventButtonToFlags(blink::WebMouseEvent::Button button) { 115 int WebEventModifiersToEventFlags(int modifiers) {
116 switch (button) { 116 int flags = 0;
117 case blink::WebMouseEvent::Button::Left:
118 return ui::EF_LEFT_MOUSE_BUTTON;
119 117
120 case blink::WebMouseEvent::Button::Middle: 118 if (modifiers & blink::WebInputEvent::LeftButtonDown)
121 return ui::EF_MIDDLE_MOUSE_BUTTON; 119 flags |= ui::EF_LEFT_MOUSE_BUTTON;
120 if (modifiers & blink::WebInputEvent::MiddleButtonDown)
121 flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
122 if (modifiers & blink::WebInputEvent::RightButtonDown)
123 flags |= ui::EF_RIGHT_MOUSE_BUTTON;
122 124
123 case blink::WebMouseEvent::Button::Right: 125 return flags;
124 return ui::EF_RIGHT_MOUSE_BUTTON;
125
126 default:
127 NOTREACHED();
128 }
129
130 return 0;
131 } 126 }
132 127
133 } // namespace 128 } // namespace
134 129
135 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( 130 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
136 const blink::WebMouseEvent& web_mouse, 131 const blink::WebMouseEvent& web_mouse,
137 const ui::LatencyInfo& latency_info) { 132 const ui::LatencyInfo& latency_info) {
138 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type()); 133 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type());
139 int flags = WebMouseEventButtonToFlags(web_mouse.button); 134 int flags = WebEventModifiersToEventFlags(web_mouse.modifiers());
140 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(), 135 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(),
141 ui::EventTimeForNow(), flags, flags); 136 ui::EventTimeForNow(), flags, flags);
142 gfx::PointF location(web_mouse.x * device_scale_factor_, 137 gfx::PointF location(web_mouse.x * device_scale_factor_,
143 web_mouse.y * device_scale_factor_); 138 web_mouse.y * device_scale_factor_);
144 mouse_event.set_location_f(location); 139 mouse_event.set_location_f(location);
145 mouse_event.set_root_location_f(location); 140 mouse_event.set_root_location_f(location);
146 141
147 aura::Window* window = GetWindow(); 142 aura::Window* window = GetWindow();
148 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); 143 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
149 ui::EventDispatchDetails details = 144 ui::EventDispatchDetails details =
(...skipping 20 matching lines...) Expand all
170 ->min_distance_for_pinch_scroll_in_pixels(); 165 ->min_distance_for_pinch_scroll_in_pixels();
171 } 166 }
172 167
173 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 168 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
174 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 169 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
175 DCHECK(window); 170 DCHECK(window);
176 return window; 171 return window;
177 } 172 }
178 173
179 } // namespace content 174 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/synthetic_mouse_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698