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...) Expand 10 before | Expand all | Expand 10 after 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; |
244 pp_pt.pressure = touch_point.force; | 245 pp_pt.pressure = touch_point.force; |
245 result->push_back(pp_pt); | 246 result->push_back(pp_pt); |
246 } | 247 } |
247 } | 248 } |
248 | 249 |
249 void AppendTouchEvent(const WebInputEvent& event, | 250 void AppendTouchEvent(const WebInputEvent& event, |
250 std::vector<InputEventData>* result_events) { | 251 std::vector<InputEventData>* result_events) { |
251 const WebTouchEvent& touch_event = | 252 const WebTouchEvent& touch_event = |
252 reinterpret_cast<const WebTouchEvent&>(event); | 253 reinterpret_cast<const WebTouchEvent&>(event); |
253 | 254 |
(...skipping 18 matching lines...) Expand all Loading... |
272 pt.id = pp_pt.id; | 273 pt.id = pp_pt.id; |
273 pt.position.x = pp_pt.position.x; | 274 pt.position.x = pp_pt.position.x; |
274 pt.position.y = pp_pt.position.y; | 275 pt.position.y = pp_pt.position.y; |
275 // TODO bug:http://code.google.com/p/chromium/issues/detail?id=93902 | 276 // TODO bug:http://code.google.com/p/chromium/issues/detail?id=93902 |
276 pt.screenPosition.x = 0; | 277 pt.screenPosition.x = 0; |
277 pt.screenPosition.y = 0; | 278 pt.screenPosition.y = 0; |
278 pt.force = pp_pt.pressure; | 279 pt.force = pp_pt.pressure; |
279 pt.radiusX = pp_pt.radius.x; | 280 pt.radiusX = pp_pt.radius.x; |
280 pt.radiusY = pp_pt.radius.y; | 281 pt.radiusY = pp_pt.radius.y; |
281 pt.rotationAngle = pp_pt.rotation_angle; | 282 pt.rotationAngle = pp_pt.rotation_angle; |
| 283 pt.tilt = pp_pt.tilt; |
282 pt.state = state; | 284 pt.state = state; |
283 return pt; | 285 return pt; |
284 } | 286 } |
285 | 287 |
286 bool HasTouchPointWithId(const WebTouchPoint* web_touches, | 288 bool HasTouchPointWithId(const WebTouchPoint* web_touches, |
287 uint32_t web_touches_length, | 289 uint32_t web_touches_length, |
288 uint32_t id) { | 290 uint32_t id) { |
289 // Note: A brute force search to find the (potentially) existing touch point | 291 // Note: A brute force search to find the (potentially) existing touch point |
290 // is cheap given the small bound on |WebTouchEvent::touchesLengthCap|. | 292 // is cheap given the small bound on |WebTouchEvent::touchesLengthCap|. |
291 for (uint32_t i = 0; i < web_touches_length; ++i) { | 293 for (uint32_t i = 0; i < web_touches_length; ++i) { |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 case WebInputEvent::TouchStart: | 744 case WebInputEvent::TouchStart: |
743 return PP_INPUTEVENT_CLASS_TOUCH; | 745 return PP_INPUTEVENT_CLASS_TOUCH; |
744 case WebInputEvent::Undefined: | 746 case WebInputEvent::Undefined: |
745 default: | 747 default: |
746 CHECK(WebInputEvent::isGestureEventType(type)); | 748 CHECK(WebInputEvent::isGestureEventType(type)); |
747 return PP_InputEvent_Class(0); | 749 return PP_InputEvent_Class(0); |
748 } | 750 } |
749 } | 751 } |
750 | 752 |
751 } // namespace content | 753 } // namespace content |
OLD | NEW |