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

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

Issue 2633233002: Add the pointer type of pen to the synthetic WebMousEvent (Closed)
Patch Set: Make disallow copy private 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 | « content/browser/BUILD.gn ('k') | 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (modifiers & blink::WebInputEvent::LeftButtonDown) 118 if (modifiers & blink::WebInputEvent::LeftButtonDown)
119 flags |= ui::EF_LEFT_MOUSE_BUTTON; 119 flags |= ui::EF_LEFT_MOUSE_BUTTON;
120 if (modifiers & blink::WebInputEvent::MiddleButtonDown) 120 if (modifiers & blink::WebInputEvent::MiddleButtonDown)
121 flags |= ui::EF_MIDDLE_MOUSE_BUTTON; 121 flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
122 if (modifiers & blink::WebInputEvent::RightButtonDown) 122 if (modifiers & blink::WebInputEvent::RightButtonDown)
123 flags |= ui::EF_RIGHT_MOUSE_BUTTON; 123 flags |= ui::EF_RIGHT_MOUSE_BUTTON;
124 124
125 return flags; 125 return flags;
126 } 126 }
127 127
128 ui::EventPointerType WebMousePointerTypeToEventPointerType(
129 blink::WebPointerProperties::PointerType type) {
130 if (type == blink::WebPointerProperties::PointerType::Mouse)
131 return ui::EventPointerType::POINTER_TYPE_MOUSE;
132 if (type == blink::WebPointerProperties::PointerType::Pen)
133 return ui::EventPointerType::POINTER_TYPE_PEN;
134 NOTREACHED() << "Unexpected mouse event pointer type";
135 return ui::EventPointerType::POINTER_TYPE_UNKNOWN;
136 }
137
128 } // namespace 138 } // namespace
129 139
130 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( 140 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
131 const blink::WebMouseEvent& web_mouse, 141 const blink::WebMouseEvent& web_mouse_event,
132 const ui::LatencyInfo& latency_info) { 142 const ui::LatencyInfo& latency_info) {
133 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type()); 143 ui::EventType event_type =
134 int flags = WebEventModifiersToEventFlags(web_mouse.modifiers()); 144 WebMouseEventTypeToEventType(web_mouse_event.type());
145 int flags = WebEventModifiersToEventFlags(web_mouse_event.modifiers());
135 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(), 146 ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(),
136 ui::EventTimeForNow(), flags, flags); 147 ui::EventTimeForNow(), flags, flags);
137 gfx::PointF location(web_mouse.x * device_scale_factor_, 148 gfx::PointF location(web_mouse_event.x * device_scale_factor_,
138 web_mouse.y * device_scale_factor_); 149 web_mouse_event.y * device_scale_factor_);
139 mouse_event.set_location_f(location); 150 mouse_event.set_location_f(location);
140 mouse_event.set_root_location_f(location); 151 mouse_event.set_root_location_f(location);
152 ui::PointerDetails pointer_details = mouse_event.pointer_details();
153 pointer_details.pointer_type =
154 WebMousePointerTypeToEventPointerType(web_mouse_event.pointerType);
155 mouse_event.set_pointer_details(pointer_details);
141 156
142 aura::Window* window = GetWindow(); 157 aura::Window* window = GetWindow();
143 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); 158 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
144 ui::EventDispatchDetails details = 159 ui::EventDispatchDetails details =
145 window->GetHost()->event_processor()->OnEventFromSource(&mouse_event); 160 window->GetHost()->event_processor()->OnEventFromSource(&mouse_event);
146 if (details.dispatcher_destroyed) 161 if (details.dispatcher_destroyed)
147 return; 162 return;
148 } 163 }
149 164
150 SyntheticGestureParams::GestureSourceType 165 SyntheticGestureParams::GestureSourceType
(...skipping 14 matching lines...) Expand all
165 ->min_distance_for_pinch_scroll_in_pixels(); 180 ->min_distance_for_pinch_scroll_in_pixels();
166 } 181 }
167 182
168 aura::Window* SyntheticGestureTargetAura::GetWindow() const { 183 aura::Window* SyntheticGestureTargetAura::GetWindow() const {
169 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); 184 aura::Window* window = render_widget_host()->GetView()->GetNativeView();
170 DCHECK(window); 185 DCHECK(window);
171 return window; 186 return window;
172 } 187 }
173 188
174 } // namespace content 189 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/renderer_host/input/synthetic_mouse_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698