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/common/input/synthetic_web_input_event_builders.h" | 5 #include "content/common/input/synthetic_web_input_event_builders.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
9 #include "ui/events/base_event_utils.h" | 9 #include "ui/events/base_event_utils.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (touchesLength == touchesLengthCap) | 175 if (touchesLength == touchesLengthCap) |
176 return -1; | 176 return -1; |
177 WebTouchPoint& point = touches[touchesLength]; | 177 WebTouchPoint& point = touches[touchesLength]; |
178 point.id = touchesLength; | 178 point.id = touchesLength; |
179 point.position.x = point.screenPosition.x = x; | 179 point.position.x = point.screenPosition.x = x; |
180 point.position.y = point.screenPosition.y = y; | 180 point.position.y = point.screenPosition.y = y; |
181 point.state = WebTouchPoint::StatePressed; | 181 point.state = WebTouchPoint::StatePressed; |
182 point.radiusX = point.radiusY = 1.f; | 182 point.radiusX = point.radiusY = 1.f; |
183 point.rotationAngle = 1.f; | 183 point.rotationAngle = 1.f; |
184 point.force = 1.f; | 184 point.force = 1.f; |
| 185 // TODO(e_hakkinen): Leave only either tilt and tiltOrientation, tiltRad and |
| 186 // tiltOrientationRad or tiltX and tiltY. |
| 187 point.tilt = point.tiltOrientation = 0.f; |
| 188 point.tiltRad = point.tiltOrientationRad = 0.f; |
| 189 point.tiltX = point.tiltY = 0.f; |
185 ++touchesLength; | 190 ++touchesLength; |
186 WebTouchEventTraits::ResetType( | 191 WebTouchEventTraits::ResetType( |
187 WebInputEvent::TouchStart, timeStampSeconds, this); | 192 WebInputEvent::TouchStart, timeStampSeconds, this); |
188 return point.id; | 193 return point.id; |
189 } | 194 } |
190 | 195 |
191 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { | 196 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { |
192 CHECK_GE(index, 0); | 197 CHECK_GE(index, 0); |
193 CHECK_LT(index, touchesLengthCap); | 198 CHECK_LT(index, touchesLengthCap); |
194 // Always set this bit to avoid otherwise unexpected touchmove suppression. | 199 // Always set this bit to avoid otherwise unexpected touchmove suppression. |
(...skipping 21 matching lines...) Expand all Loading... |
216 touches[index].state = WebTouchPoint::StateCancelled; | 221 touches[index].state = WebTouchPoint::StateCancelled; |
217 WebTouchEventTraits::ResetType( | 222 WebTouchEventTraits::ResetType( |
218 WebInputEvent::TouchCancel, timeStampSeconds, this); | 223 WebInputEvent::TouchCancel, timeStampSeconds, this); |
219 } | 224 } |
220 | 225 |
221 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 226 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
222 timeStampSeconds = timestamp.InSecondsF(); | 227 timeStampSeconds = timestamp.InSecondsF(); |
223 } | 228 } |
224 | 229 |
225 } // namespace content | 230 } // namespace content |
OLD | NEW |