OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/pepper/event_conversion.h" | 5 #include "content/renderer/pepper/event_conversion.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/i18n/char_iterator.h" | 8 #include "base/i18n/char_iterator.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 223 matching lines...) Loading... |
234 touch_point.state == WebTouchPoint::StateStationary)) { | 234 touch_point.state == WebTouchPoint::StateStationary)) { |
235 continue; | 235 continue; |
236 } | 236 } |
237 PP_TouchPoint pp_pt; | 237 PP_TouchPoint pp_pt; |
238 pp_pt.id = touch_point.id; | 238 pp_pt.id = touch_point.id; |
239 pp_pt.position.x = touch_point.position.x; | 239 pp_pt.position.x = touch_point.position.x; |
240 pp_pt.position.y = touch_point.position.y; | 240 pp_pt.position.y = touch_point.position.y; |
241 pp_pt.radius.x = touch_point.radiusX; | 241 pp_pt.radius.x = touch_point.radiusX; |
242 pp_pt.radius.y = touch_point.radiusY; | 242 pp_pt.radius.y = touch_point.radiusY; |
243 pp_pt.rotation_angle = touch_point.rotationAngle; | 243 pp_pt.rotation_angle = touch_point.rotationAngle; |
| 244 pp_pt.tilt = touch_point.tilt; |
| 245 pp_pt.tiltDirection = touch_point.tiltDirection; |
244 pp_pt.pressure = touch_point.force; | 246 pp_pt.pressure = touch_point.force; |
245 result->push_back(pp_pt); | 247 result->push_back(pp_pt); |
246 } | 248 } |
247 } | 249 } |
248 | 250 |
249 void AppendTouchEvent(const WebInputEvent& event, | 251 void AppendTouchEvent(const WebInputEvent& event, |
250 std::vector<InputEventData>* result_events) { | 252 std::vector<InputEventData>* result_events) { |
251 const WebTouchEvent& touch_event = | 253 const WebTouchEvent& touch_event = |
252 reinterpret_cast<const WebTouchEvent&>(event); | 254 reinterpret_cast<const WebTouchEvent&>(event); |
253 | 255 |
(...skipping 18 matching lines...) Loading... |
272 pt.id = pp_pt.id; | 274 pt.id = pp_pt.id; |
273 pt.position.x = pp_pt.position.x; | 275 pt.position.x = pp_pt.position.x; |
274 pt.position.y = pp_pt.position.y; | 276 pt.position.y = pp_pt.position.y; |
275 // TODO bug:http://code.google.com/p/chromium/issues/detail?id=93902 | 277 // TODO bug:http://code.google.com/p/chromium/issues/detail?id=93902 |
276 pt.screenPosition.x = 0; | 278 pt.screenPosition.x = 0; |
277 pt.screenPosition.y = 0; | 279 pt.screenPosition.y = 0; |
278 pt.force = pp_pt.pressure; | 280 pt.force = pp_pt.pressure; |
279 pt.radiusX = pp_pt.radius.x; | 281 pt.radiusX = pp_pt.radius.x; |
280 pt.radiusY = pp_pt.radius.y; | 282 pt.radiusY = pp_pt.radius.y; |
281 pt.rotationAngle = pp_pt.rotation_angle; | 283 pt.rotationAngle = pp_pt.rotation_angle; |
| 284 pt.tilt = pp_pt.tilt; |
| 285 pt.tiltDirection = pp_pt.tiltDirection; |
282 pt.state = state; | 286 pt.state = state; |
283 return pt; | 287 return pt; |
284 } | 288 } |
285 | 289 |
286 bool HasTouchPointWithId(const WebTouchPoint* web_touches, | 290 bool HasTouchPointWithId(const WebTouchPoint* web_touches, |
287 uint32_t web_touches_length, | 291 uint32_t web_touches_length, |
288 uint32_t id) { | 292 uint32_t id) { |
289 // Note: A brute force search to find the (potentially) existing touch point | 293 // Note: A brute force search to find the (potentially) existing touch point |
290 // is cheap given the small bound on |WebTouchEvent::touchesLengthCap|. | 294 // is cheap given the small bound on |WebTouchEvent::touchesLengthCap|. |
291 for (uint32_t i = 0; i < web_touches_length; ++i) { | 295 for (uint32_t i = 0; i < web_touches_length; ++i) { |
(...skipping 450 matching lines...) Loading... |
742 case WebInputEvent::TouchStart: | 746 case WebInputEvent::TouchStart: |
743 return PP_INPUTEVENT_CLASS_TOUCH; | 747 return PP_INPUTEVENT_CLASS_TOUCH; |
744 case WebInputEvent::Undefined: | 748 case WebInputEvent::Undefined: |
745 default: | 749 default: |
746 CHECK(WebInputEvent::isGestureEventType(type)); | 750 CHECK(WebInputEvent::isGestureEventType(type)); |
747 return PP_InputEvent_Class(0); | 751 return PP_InputEvent_Class(0); |
748 } | 752 } |
749 } | 753 } |
750 | 754 |
751 } // namespace content | 755 } // namespace content |
OLD | NEW |