OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 return WebTouchPoint::StateCancelled; | 410 return WebTouchPoint::StateCancelled; |
411 if (type == EventTypeNames::touchstart) | 411 if (type == EventTypeNames::touchstart) |
412 return WebTouchPoint::StatePressed; | 412 return WebTouchPoint::StatePressed; |
413 if (type == EventTypeNames::touchmove) | 413 if (type == EventTypeNames::touchmove) |
414 return WebTouchPoint::StateMoved; | 414 return WebTouchPoint::StateMoved; |
415 return WebTouchPoint::StateUndefined; | 415 return WebTouchPoint::StateUndefined; |
416 } | 416 } |
417 | 417 |
418 PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
uchPoint& point) | 418 PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
uchPoint& point) |
419 { | 419 { |
420 m_id = point.id; | 420 m_id = point.pointerId; |
421 m_state = toPlatformTouchPointState(point.state); | 421 m_state = toPlatformTouchPointState(point.state); |
422 | 422 |
423 // This assumes convertFromContainingWindow does only translations, not scal
es. | 423 // This assumes convertFromContainingWindow does only translations, not scal
es. |
424 FloatPoint floatPos = convertHitPointToWindow(widget, point.position); | 424 FloatPoint floatPos = convertHitPointToWindow(widget, point.position); |
425 IntPoint flooredPoint = flooredIntPoint(floatPos); | 425 IntPoint flooredPoint = flooredIntPoint(floatPos); |
426 m_pos = widget->convertFromContainingWindow(flooredPoint) + (floatPos - floo
redPoint); | 426 m_pos = widget->convertFromContainingWindow(flooredPoint) + (floatPos - floo
redPoint); |
427 | 427 |
428 m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y); | 428 m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y); |
429 m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY)
); | 429 m_radius = scaleSizeToWindow(widget, FloatSize(point.width, point.height)); |
430 m_rotationAngle = point.rotationAngle; | 430 m_rotationAngle = point.rotationAngle; |
431 m_force = point.force; | 431 m_force = point.pressure; |
432 } | 432 } |
433 | 433 |
434 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo
uchEvent& event) | 434 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo
uchEvent& event) |
435 { | 435 { |
436 m_type = toPlatformTouchEventType(event.type); | 436 m_type = toPlatformTouchEventType(event.type); |
437 m_modifiers = toPlatformEventModifiers(event.modifiers); | 437 m_modifiers = toPlatformEventModifiers(event.modifiers); |
438 m_timestamp = event.timeStampSeconds; | 438 m_timestamp = event.timeStampSeconds; |
439 m_causesScrollingIfUncanceled = event.causesScrollingIfUncanceled; | 439 m_causesScrollingIfUncanceled = event.causesScrollingIfUncanceled; |
440 | 440 |
441 for (unsigned i = 0; i < event.touchesLength; ++i) | 441 for (unsigned i = 0; i < event.touchesLength; ++i) |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 case PlatformEvent::Char: | 650 case PlatformEvent::Char: |
651 return WebInputEvent::Char; | 651 return WebInputEvent::Char; |
652 default: | 652 default: |
653 return WebInputEvent::Undefined; | 653 return WebInputEvent::Undefined; |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) | 657 static WebTouchPoint toWebTouchPoint(const Touch* touch, const LayoutObject* lay
outObject, WebTouchPoint::State state) |
658 { | 658 { |
659 WebTouchPoint point; | 659 WebTouchPoint point; |
660 point.id = touch->identifier(); | 660 point.pointerId = touch->identifier(); |
661 point.screenPosition = touch->screenLocation(); | 661 point.screenPosition = touch->screenLocation(); |
662 point.position = convertAbsoluteLocationForLayoutObjectFloat(touch->absolute
Location(), *layoutObject); | 662 point.position = convertAbsoluteLocationForLayoutObjectFloat(touch->absolute
Location(), *layoutObject); |
663 point.radiusX = touch->radiusX(); | 663 point.width = touch->radiusX(); |
664 point.radiusY = touch->radiusY(); | 664 point.height = touch->radiusY(); |
665 point.rotationAngle = touch->rotationAngle(); | 665 point.rotationAngle = touch->rotationAngle(); |
666 point.force = touch->force(); | 666 point.pressure = touch->force(); |
667 point.state = state; | 667 point.state = state; |
668 return point; | 668 return point; |
669 } | 669 } |
670 | 670 |
671 static unsigned indexOfTouchPointWithId(const WebTouchPoint* touchPoints, unsign
ed touchPointsLength, unsigned id) | 671 static unsigned indexOfTouchPointWithId(const WebTouchPoint* touchPoints, unsign
ed touchPointsLength, unsigned id) |
672 { | 672 { |
673 for (unsigned i = 0; i < touchPointsLength; ++i) { | 673 for (unsigned i = 0; i < touchPointsLength; ++i) { |
674 if (touchPoints[i].id == static_cast<int>(id)) | 674 if (touchPoints[i].pointerId == static_cast<int>(id)) |
675 return i; | 675 return i; |
676 } | 676 } |
677 return std::numeric_limits<unsigned>::max(); | 677 return std::numeric_limits<unsigned>::max(); |
678 } | 678 } |
679 | 679 |
680 static void addTouchPointsUpdateStateIfNecessary(WebTouchPoint::State state, Tou
chList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, const
LayoutObject* layoutObject) | 680 static void addTouchPointsUpdateStateIfNecessary(WebTouchPoint::State state, Tou
chList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, const
LayoutObject* layoutObject) |
681 { | 681 { |
682 unsigned initialTouchPointsLength = *touchPointsLength; | 682 unsigned initialTouchPointsLength = *touchPointsLength; |
683 for (unsigned i = 0; i < touches->length(); ++i) { | 683 for (unsigned i = 0; i < touches->length(); ++i) { |
684 const unsigned pointIndex = *touchPointsLength; | 684 const unsigned pointIndex = *touchPointsLength; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 modifiers = getWebInputModifiers(event); | 752 modifiers = getWebInputModifiers(event); |
753 | 753 |
754 globalX = event.screenX(); | 754 globalX = event.screenX(); |
755 globalY = event.screenY(); | 755 globalY = event.screenY(); |
756 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); | 756 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
757 x = localPoint.x(); | 757 x = localPoint.x(); |
758 y = localPoint.y(); | 758 y = localPoint.y(); |
759 } | 759 } |
760 | 760 |
761 } // namespace blink | 761 } // namespace blink |
OLD | NEW |