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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 offset = rootView->inputEventsOffsetForEmulation(); | 84 offset = rootView->inputEventsOffsetForEmulation(); |
85 visualViewport = flooredIntPoint(rootView->page()->frameHost().visua
lViewport().visibleRect().location()); | 85 visualViewport = flooredIntPoint(rootView->page()->frameHost().visua
lViewport().visibleRect().location()); |
86 overscrollOffset = rootView->page()->frameHost().chromeClient().elas
ticOverscroll(); | 86 overscrollOffset = rootView->page()->frameHost().chromeClient().elas
ticOverscroll(); |
87 } | 87 } |
88 } | 88 } |
89 return FloatPoint( | 89 return FloatPoint( |
90 (pointInRendererViewport.x() - offset.width()) / scale + visualViewport.
x() + overscrollOffset.width(), | 90 (pointInRendererViewport.x() - offset.width()) / scale + visualViewport.
x() + overscrollOffset.width(), |
91 (pointInRendererViewport.y() - offset.height()) / scale + visualViewport
.y() + overscrollOffset.height()); | 91 (pointInRendererViewport.y() - offset.height()) / scale + visualViewport
.y() + overscrollOffset.height()); |
92 } | 92 } |
93 | 93 |
| 94 PlatformEvent::DispatchType toPlatformDispatchType(WebInputEvent::DispatchType t
ype) |
| 95 { |
| 96 static_assert(PlatformEvent::DispatchType::Blocking == static_cast<PlatformE
vent::DispatchType>(WebInputEvent::DispatchType::Blocking), |
| 97 "Dispatch Types not equal"); |
| 98 static_assert(PlatformEvent::DispatchType::EventNonBlocking == static_cast<P
latformEvent::DispatchType>(WebInputEvent::DispatchType::EventNonBlocking), |
| 99 "Dispatch Types not equal"); |
| 100 static_assert(PlatformEvent::DispatchType::ListenersNonBlockingPassive == st
atic_cast<PlatformEvent::DispatchType>(WebInputEvent::DispatchType::ListenersNon
BlockingPassive), |
| 101 "Dispatch Types not equal"); |
| 102 static_assert(PlatformEvent::DispatchType::ListenersForcedNonBlockingPassive
== static_cast<PlatformEvent::DispatchType>(WebInputEvent::DispatchType::Listen
ersForcedNonBlockingPassive), |
| 103 "Dispatch Types not equal"); |
| 104 |
| 105 return static_cast<PlatformEvent::DispatchType>(type); |
| 106 } |
| 107 |
94 unsigned toPlatformModifierFrom(WebMouseEvent::Button button) | 108 unsigned toPlatformModifierFrom(WebMouseEvent::Button button) |
95 { | 109 { |
96 if (button == WebMouseEvent::ButtonNone) | 110 if (button == WebMouseEvent::ButtonNone) |
97 return 0; | 111 return 0; |
98 | 112 |
99 unsigned webMouseButtonToPlatformModifier[] = { | 113 unsigned webMouseButtonToPlatformModifier[] = { |
100 PlatformEvent::LeftButtonDown, | 114 PlatformEvent::LeftButtonDown, |
101 PlatformEvent::MiddleButtonDown, | 115 PlatformEvent::MiddleButtonDown, |
102 PlatformEvent::RightButtonDown | 116 PlatformEvent::RightButtonDown |
103 }; | 117 }; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo
uchEvent& event) | 464 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo
uchEvent& event) |
451 { | 465 { |
452 m_type = toPlatformTouchEventType(event.type); | 466 m_type = toPlatformTouchEventType(event.type); |
453 m_modifiers = event.modifiers; | 467 m_modifiers = event.modifiers; |
454 m_timestamp = event.timeStampSeconds; | 468 m_timestamp = event.timeStampSeconds; |
455 m_causesScrollingIfUncanceled = event.movedBeyondSlopRegion; | 469 m_causesScrollingIfUncanceled = event.movedBeyondSlopRegion; |
456 | 470 |
457 for (unsigned i = 0; i < event.touchesLength; ++i) | 471 for (unsigned i = 0; i < event.touchesLength; ++i) |
458 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i])
); | 472 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i])
); |
459 | 473 |
460 m_cancelable = event.cancelable; | 474 m_dispatchType = toPlatformDispatchType(event.dispatchType); |
461 } | 475 } |
462 | 476 |
463 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat(const LayoutPoint&
location, const LayoutObject& layoutObject) | 477 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat(const LayoutPoint&
location, const LayoutObject& layoutObject) |
464 { | 478 { |
465 return layoutObject.absoluteToLocal(FloatPoint(location), UseTransforms); | 479 return layoutObject.absoluteToLocal(FloatPoint(location), UseTransforms); |
466 } | 480 } |
467 | 481 |
468 static IntPoint convertAbsoluteLocationForLayoutObject(const LayoutPoint& locati
on, const LayoutObject& layoutObject) | 482 static IntPoint convertAbsoluteLocationForLayoutObject(const LayoutPoint& locati
on, const LayoutObject& layoutObject) |
469 { | 483 { |
470 return roundedIntPoint(convertAbsoluteLocationForLayoutObjectFloat(location,
layoutObject)); | 484 return roundedIntPoint(convertAbsoluteLocationForLayoutObjectFloat(location,
layoutObject)); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 else if (event.type() == EventTypeNames::touchcancel) | 724 else if (event.type() == EventTypeNames::touchcancel) |
711 type = TouchCancel; | 725 type = TouchCancel; |
712 else { | 726 else { |
713 NOTREACHED(); | 727 NOTREACHED(); |
714 type = Undefined; | 728 type = Undefined; |
715 return; | 729 return; |
716 } | 730 } |
717 | 731 |
718 timeStampSeconds = event.platformTimeStamp(); | 732 timeStampSeconds = event.platformTimeStamp(); |
719 modifiers = event.modifiers(); | 733 modifiers = event.modifiers(); |
720 cancelable = event.cancelable(); | 734 dispatchType = event.cancelable() ? WebInputEvent::Blocking : WebInputEvent:
:EventNonBlocking; |
721 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); | 735 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); |
722 | 736 |
723 // Currently touches[] is empty, add stationary points as-is. | 737 // Currently touches[] is empty, add stationary points as-is. |
724 for (unsigned i = 0; i < event.touches()->length() && i < static_cast<unsign
ed>(WebTouchEvent::touchesLengthCap); ++i) { | 738 for (unsigned i = 0; i < event.touches()->length() && i < static_cast<unsign
ed>(WebTouchEvent::touchesLengthCap); ++i) { |
725 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutObject, Web
TouchPoint::StateStationary); | 739 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutObject, Web
TouchPoint::StateStationary); |
726 ++touchesLength; | 740 ++touchesLength; |
727 } | 741 } |
728 // If any existing points are also in the change list, we should update | 742 // If any existing points are also in the change list, we should update |
729 // their state, otherwise just add the new points. | 743 // their state, otherwise just add the new points. |
730 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve
nt.changedTouches(), touches, &touchesLength, layoutObject); | 744 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve
nt.changedTouches(), touches, &touchesLength, layoutObject); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 break; | 797 break; |
784 case GestureSourceTouchscreen: | 798 case GestureSourceTouchscreen: |
785 sourceDevice = WebGestureDeviceTouchscreen; | 799 sourceDevice = WebGestureDeviceTouchscreen; |
786 break; | 800 break; |
787 case GestureSourceUninitialized: | 801 case GestureSourceUninitialized: |
788 NOTREACHED(); | 802 NOTREACHED(); |
789 } | 803 } |
790 } | 804 } |
791 | 805 |
792 } // namespace blink | 806 } // namespace blink |
OLD | NEW |