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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 return WebTouchPoint::StateUndefined; | 400 return WebTouchPoint::StateUndefined; |
401 } | 401 } |
402 | 402 |
403 PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
uchPoint& point) | 403 PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTo
uchPoint& point) |
404 { | 404 { |
405 float scale = widgetInputEventsScaleFactor(widget); | 405 float scale = widgetInputEventsScaleFactor(widget); |
406 IntSize offset = widgetInputEventsOffset(widget); | 406 IntSize offset = widgetInputEventsOffset(widget); |
407 m_id = point.id; | 407 m_id = point.id; |
408 m_state = toPlatformTouchPointState(point.state); | 408 m_state = toPlatformTouchPointState(point.state); |
409 m_pos = widget->convertFromContainingWindow(IntPoint((point.position.x - off
set.width()) / scale, (point.position.y - offset.height()) / scale)); | 409 m_pos = widget->convertFromContainingWindow(IntPoint((point.position.x - off
set.width()) / scale, (point.position.y - offset.height()) / scale)); |
410 m_screenPos = point.screenPosition; | 410 m_screenPos = IntPoint(point.screenPosition.x, point.screenPosition.y); |
411 m_radiusY = point.radiusY / scale; | 411 m_radiusY = point.radiusY / scale; |
412 m_radiusX = point.radiusX / scale; | 412 m_radiusX = point.radiusX / scale; |
413 m_rotationAngle = point.rotationAngle; | 413 m_rotationAngle = point.rotationAngle; |
414 m_force = point.force; | 414 m_force = point.force; |
415 } | 415 } |
416 | 416 |
417 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo
uchEvent& event) | 417 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo
uchEvent& event) |
418 { | 418 { |
419 m_type = toPlatformTouchEventType(event.type); | 419 m_type = toPlatformTouchEventType(event.type); |
420 | 420 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 697 } |
698 | 698 |
699 static void addTouchPoints(const Widget* widget, const AtomicString& touchType,
TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, con
st WebCore::RenderObject* renderObject) | 699 static void addTouchPoints(const Widget* widget, const AtomicString& touchType,
TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, con
st WebCore::RenderObject* renderObject) |
700 { | 700 { |
701 unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>
(WebTouchEvent::touchesLengthCap)); | 701 unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>
(WebTouchEvent::touchesLengthCap)); |
702 for (unsigned i = 0; i < numberOfTouches; ++i) { | 702 for (unsigned i = 0; i < numberOfTouches; ++i) { |
703 const Touch* touch = touches->item(i); | 703 const Touch* touch = touches->item(i); |
704 | 704 |
705 WebTouchPoint point; | 705 WebTouchPoint point; |
706 point.id = touch->identifier(); | 706 point.id = touch->identifier(); |
707 point.screenPosition = WebPoint(touch->screenX(), touch->screenY()); | 707 point.screenPosition = WebFloatPoint(touch->screenX(), touch->screenY())
; |
708 point.position = convertAbsoluteLocationForRenderObject(touch->absoluteL
ocation(), *renderObject); | 708 point.position = convertAbsoluteLocationForRenderObject(touch->absoluteL
ocation(), *renderObject); |
709 point.radiusX = touch->webkitRadiusX(); | 709 point.radiusX = touch->webkitRadiusX(); |
710 point.radiusY = touch->webkitRadiusY(); | 710 point.radiusY = touch->webkitRadiusY(); |
711 point.rotationAngle = touch->webkitRotationAngle(); | 711 point.rotationAngle = touch->webkitRotationAngle(); |
712 point.force = touch->webkitForce(); | 712 point.force = touch->webkitForce(); |
713 point.state = toWebTouchPointState(touchType); | 713 point.state = toWebTouchPointState(touchType); |
714 | 714 |
715 touchPoints[i] = point; | 715 touchPoints[i] = point; |
716 } | 716 } |
717 *touchPointsLength = numberOfTouches; | 717 *touchPointsLength = numberOfTouches; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 modifiers = getWebInputModifiers(event); | 764 modifiers = getWebInputModifiers(event); |
765 | 765 |
766 globalX = event.screenX(); | 766 globalX = event.screenX(); |
767 globalY = event.screenY(); | 767 globalY = event.screenY(); |
768 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 768 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); |
769 x = localPoint.x(); | 769 x = localPoint.x(); |
770 y = localPoint.y(); | 770 y = localPoint.y(); |
771 } | 771 } |
772 | 772 |
773 } // namespace blink | 773 } // namespace blink |
OLD | NEW |