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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm 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/web_input_event_builders_android.h " 5 #include "content/browser/renderer_host/input/web_input_event_builders_android.h "
6 6
7 #include <android/input.h> 7 #include <android/input.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/events/android/key_event_utils.h" 10 #include "ui/events/android/key_event_utils.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 int pointer_id, 120 int pointer_id,
121 float pressure, 121 float pressure,
122 float orientation_rad, 122 float orientation_rad,
123 float tilt_rad, 123 float tilt_rad,
124 int action_button, 124 int action_button,
125 int tool_type) { 125 int tool_type) {
126 DCHECK(WebInputEvent::isMouseEventType(type)); 126 DCHECK(WebInputEvent::isMouseEventType(type));
127 WebMouseEvent result(type, ui::EventFlagsToWebEventModifiers(modifiers), 127 WebMouseEvent result(type, ui::EventFlagsToWebEventModifiers(modifiers),
128 time_sec); 128 time_sec);
129 129
130 result.x = window_x; 130 result.setPositionInWidget(window_x, window_y);
131 result.y = window_y;
132 result.clickCount = click_count; 131 result.clickCount = click_count;
133 132
134 int button = action_button; 133 int button = action_button;
135 // For events other than MouseDown/Up, action_button is not defined. So we are 134 // For events other than MouseDown/Up, action_button is not defined. So we are
136 // determining |button| value from |modifiers| as is done in other platforms. 135 // determining |button| value from |modifiers| as is done in other platforms.
137 if (type != WebInputEvent::MouseDown && type != WebInputEvent::MouseUp) { 136 if (type != WebInputEvent::MouseDown && type != WebInputEvent::MouseUp) {
138 if (modifiers & ui::EF_LEFT_MOUSE_BUTTON) 137 if (modifiers & ui::EF_LEFT_MOUSE_BUTTON)
139 button = ui::MotionEvent::BUTTON_PRIMARY; 138 button = ui::MotionEvent::BUTTON_PRIMARY;
140 else if (modifiers & ui::EF_MIDDLE_MOUSE_BUTTON) 139 else if (modifiers & ui::EF_MIDDLE_MOUSE_BUTTON)
141 button = ui::MotionEvent::BUTTON_TERTIARY; 140 button = ui::MotionEvent::BUTTON_TERTIARY;
(...skipping 11 matching lines...) Expand all
153 } 152 }
154 153
155 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, 154 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x,
156 float ticks_y, 155 float ticks_y,
157 float tick_multiplier, 156 float tick_multiplier,
158 double time_sec, 157 double time_sec,
159 int window_x, 158 int window_x,
160 int window_y) { 159 int window_y) {
161 WebMouseWheelEvent result(WebInputEvent::MouseWheel, 160 WebMouseWheelEvent result(WebInputEvent::MouseWheel,
162 WebInputEvent::NoModifiers, time_sec); 161 WebInputEvent::NoModifiers, time_sec);
163 result.x = window_x; 162 result.setPositionInWidget(window_x, window_y);
164 result.y = window_y;
165 result.button = WebMouseEvent::Button::NoButton; 163 result.button = WebMouseEvent::Button::NoButton;
166 result.hasPreciseScrollingDeltas = true; 164 result.hasPreciseScrollingDeltas = true;
167 result.deltaX = ticks_x * tick_multiplier; 165 result.deltaX = ticks_x * tick_multiplier;
168 result.deltaY = ticks_y * tick_multiplier; 166 result.deltaY = ticks_y * tick_multiplier;
169 result.wheelTicksX = ticks_x; 167 result.wheelTicksX = ticks_x;
170 result.wheelTicksY = ticks_y; 168 result.wheelTicksY = ticks_y;
171 169
172 return result; 170 return result;
173 } 171 }
174 172
175 WebGestureEvent WebGestureEventBuilder::Build(WebInputEvent::Type type, 173 WebGestureEvent WebGestureEventBuilder::Build(WebInputEvent::Type type,
176 double time_sec, 174 double time_sec,
177 int x, 175 int x,
178 int y) { 176 int y) {
179 DCHECK(WebInputEvent::isGestureEventType(type)); 177 DCHECK(WebInputEvent::isGestureEventType(type));
180 WebGestureEvent result(type, WebInputEvent::NoModifiers, time_sec); 178 WebGestureEvent result(type, WebInputEvent::NoModifiers, time_sec);
181 179
182 result.x = x; 180 result.x = x;
183 result.y = y; 181 result.y = y;
184 result.sourceDevice = blink::WebGestureDeviceTouchscreen; 182 result.sourceDevice = blink::WebGestureDeviceTouchscreen;
185 183
186 return result; 184 return result;
187 } 185 }
188 186
189 } // namespace content 187 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698