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/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 Loading... |
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.position.x = window_x; |
131 result.y = window_y; | 131 result.position.y = window_y; |
132 result.clickCount = click_count; | 132 result.clickCount = click_count; |
133 | 133 |
134 int button = action_button; | 134 int button = action_button; |
135 // For events other than MouseDown/Up, action_button is not defined. So we are | 135 // 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. | 136 // determining |button| value from |modifiers| as is done in other platforms. |
137 if (type != WebInputEvent::MouseDown && type != WebInputEvent::MouseUp) { | 137 if (type != WebInputEvent::MouseDown && type != WebInputEvent::MouseUp) { |
138 if (modifiers & ui::EF_LEFT_MOUSE_BUTTON) | 138 if (modifiers & ui::EF_LEFT_MOUSE_BUTTON) |
139 button = ui::MotionEvent::BUTTON_PRIMARY; | 139 button = ui::MotionEvent::BUTTON_PRIMARY; |
140 else if (modifiers & ui::EF_MIDDLE_MOUSE_BUTTON) | 140 else if (modifiers & ui::EF_MIDDLE_MOUSE_BUTTON) |
141 button = ui::MotionEvent::BUTTON_TERTIARY; | 141 button = ui::MotionEvent::BUTTON_TERTIARY; |
(...skipping 11 matching lines...) Expand all Loading... |
153 } | 153 } |
154 | 154 |
155 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, | 155 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, |
156 float ticks_y, | 156 float ticks_y, |
157 float tick_multiplier, | 157 float tick_multiplier, |
158 double time_sec, | 158 double time_sec, |
159 int window_x, | 159 int window_x, |
160 int window_y) { | 160 int window_y) { |
161 WebMouseWheelEvent result(WebInputEvent::MouseWheel, | 161 WebMouseWheelEvent result(WebInputEvent::MouseWheel, |
162 WebInputEvent::NoModifiers, time_sec); | 162 WebInputEvent::NoModifiers, time_sec); |
163 result.x = window_x; | 163 result.position.x = window_x; |
164 result.y = window_y; | 164 result.position.y = window_y; |
165 result.button = WebMouseEvent::Button::NoButton; | 165 result.button = WebMouseEvent::Button::NoButton; |
166 result.hasPreciseScrollingDeltas = true; | 166 result.hasPreciseScrollingDeltas = true; |
167 result.deltaX = ticks_x * tick_multiplier; | 167 result.deltaX = ticks_x * tick_multiplier; |
168 result.deltaY = ticks_y * tick_multiplier; | 168 result.deltaY = ticks_y * tick_multiplier; |
169 result.wheelTicksX = ticks_x; | 169 result.wheelTicksX = ticks_x; |
170 result.wheelTicksY = ticks_y; | 170 result.wheelTicksY = ticks_y; |
171 | 171 |
172 return result; | 172 return result; |
173 } | 173 } |
174 | 174 |
175 WebGestureEvent WebGestureEventBuilder::Build(WebInputEvent::Type type, | 175 WebGestureEvent WebGestureEventBuilder::Build(WebInputEvent::Type type, |
176 double time_sec, | 176 double time_sec, |
177 int x, | 177 int x, |
178 int y) { | 178 int y) { |
179 DCHECK(WebInputEvent::isGestureEventType(type)); | 179 DCHECK(WebInputEvent::isGestureEventType(type)); |
180 WebGestureEvent result(type, WebInputEvent::NoModifiers, time_sec); | 180 WebGestureEvent result(type, WebInputEvent::NoModifiers, time_sec); |
181 | 181 |
182 result.x = x; | 182 result.x = x; |
183 result.y = y; | 183 result.y = y; |
184 result.sourceDevice = blink::WebGestureDeviceTouchscreen; | 184 result.sourceDevice = blink::WebGestureDeviceTouchscreen; |
185 | 185 |
186 return result; | 186 return result; |
187 } | 187 } |
188 | 188 |
189 } // namespace content | 189 } // namespace content |
OLD | NEW |