| 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/browser/renderer_host/ui_events_helper.h" | 5 #include "content/browser/renderer_host/ui_events_helper.h" |
| 6 | 6 |
| 7 #include "content/common/input/web_touch_event_traits.h" | 7 #include "content/common/input/web_touch_event_traits.h" |
| 8 #include "third_party/WebKit/public/web/WebInputEvent.h" | 8 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 if (point->state == blink::WebTouchPoint::StateMoved) { | 307 if (point->state == blink::WebTouchPoint::StateMoved) { |
| 308 // It is possible for badly written touch drivers to emit Move events even | 308 // It is possible for badly written touch drivers to emit Move events even |
| 309 // when the touch location hasn't changed. In such cases, consume the event | 309 // when the touch location hasn't changed. In such cases, consume the event |
| 310 // and pretend nothing happened. | 310 // and pretend nothing happened. |
| 311 if (point->position.x == event.x() && point->position.y == event.y()) | 311 if (point->position.x == event.x() && point->position.y == event.y()) |
| 312 return NULL; | 312 return NULL; |
| 313 } | 313 } |
| 314 point->position.x = event.x(); | 314 point->position.x = event.x(); |
| 315 point->position.y = event.y(); | 315 point->position.y = event.y(); |
| 316 | 316 |
| 317 const gfx::Point root_point = event.root_location(); | 317 const gfx::PointF& root_point = event.root_location_f(); |
| 318 point->screenPosition.x = root_point.x(); | 318 point->screenPosition.x = root_point.x(); |
| 319 point->screenPosition.y = root_point.y(); | 319 point->screenPosition.y = root_point.y(); |
| 320 | 320 |
| 321 // Mark the rest of the points as stationary. | 321 // Mark the rest of the points as stationary. |
| 322 for (unsigned i = 0; i < web_event->touchesLength; ++i) { | 322 for (unsigned i = 0; i < web_event->touchesLength; ++i) { |
| 323 blink::WebTouchPoint* iter = web_event->touches + i; | 323 blink::WebTouchPoint* iter = web_event->touches + i; |
| 324 if (iter != point) | 324 if (iter != point) |
| 325 iter->state = blink::WebTouchPoint::StateStationary; | 325 iter->state = blink::WebTouchPoint::StateStationary; |
| 326 } | 326 } |
| 327 | 327 |
| 328 // Update the type of the touch event. | 328 // Update the type of the touch event. |
| 329 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event), | 329 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event), |
| 330 event.time_stamp().InSecondsF(), | 330 event.time_stamp().InSecondsF(), |
| 331 web_event); | 331 web_event); |
| 332 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); | 332 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); |
| 333 | 333 |
| 334 return point; | 334 return point; |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // namespace content | 337 } // namespace content |
| OLD | NEW |