| 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 // Portions based heavily on: | 5 // Portions based heavily on: |
| 6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp | 6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp |
| 7 // | 7 // |
| 8 /* | 8 /* |
| 9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. | 9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 break; | 403 break; |
| 404 } | 404 } |
| 405 default: | 405 default: |
| 406 DLOG(WARNING) << "Unknown touch event " << event->type(); | 406 DLOG(WARNING) << "Unknown touch event " << event->type(); |
| 407 break; | 407 break; |
| 408 } | 408 } |
| 409 | 409 |
| 410 if (!point) | 410 if (!point) |
| 411 return NULL; | 411 return NULL; |
| 412 | 412 |
| 413 point->radiusX = event->radius_x(); | 413 // The spec requires the radii values to be positive (and 1 when unknown). |
| 414 point->radiusY = event->radius_y(); | 414 point->radiusX = std::max(1.f, event->radius_x()); |
| 415 point->radiusY = std::max(1.f, event->radius_y()); |
| 415 point->rotationAngle = event->rotation_angle(); | 416 point->rotationAngle = event->rotation_angle(); |
| 416 point->force = event->force(); | 417 point->force = event->force(); |
| 417 | 418 |
| 418 // Update the location and state of the point. | 419 // Update the location and state of the point. |
| 419 point->state = TouchPointStateFromEvent(event); | 420 point->state = TouchPointStateFromEvent(event); |
| 420 if (point->state == WebKit::WebTouchPoint::StateMoved) { | 421 if (point->state == WebKit::WebTouchPoint::StateMoved) { |
| 421 // It is possible for badly written touch drivers to emit Move events even | 422 // It is possible for badly written touch drivers to emit Move events even |
| 422 // when the touch location hasn't changed. In such cases, consume the event | 423 // when the touch location hasn't changed. In such cases, consume the event |
| 423 // and pretend nothing happened. | 424 // and pretend nothing happened. |
| 424 if (point->position.x == event->x() && point->position.y == event->y()) | 425 if (point->position.x == event->x() && point->position.y == event->y()) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 440 | 441 |
| 441 // Update the type of the touch event. | 442 // Update the type of the touch event. |
| 442 web_event->type = TouchEventTypeFromEvent(event); | 443 web_event->type = TouchEventTypeFromEvent(event); |
| 443 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); | 444 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); |
| 444 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); | 445 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); |
| 445 | 446 |
| 446 return point; | 447 return point; |
| 447 } | 448 } |
| 448 | 449 |
| 449 } // namespace content | 450 } // namespace content |
| OLD | NEW |