Chromium Code Reviews| Index: Source/platform/PlatformGestureEvent.h |
| diff --git a/Source/platform/PlatformGestureEvent.h b/Source/platform/PlatformGestureEvent.h |
| index 254224640898f9ccbc5dfc7b613207f82a226dcc..f407d9b93c88328f87eb6ccc881966ea72ac8c5f 100644 |
| --- a/Source/platform/PlatformGestureEvent.h |
| +++ b/Source/platform/PlatformGestureEvent.h |
| @@ -49,15 +49,16 @@ public: |
| , m_globalPosition(globalPosition) |
| , m_area(area) |
| { |
| - ASSERT(type == PlatformEvent::GestureScrollBegin |
| + memset(&m_data, 0, sizeof(m_data)); |
| + if (type == PlatformEvent::GestureScrollBegin |
| || type == PlatformEvent::GestureScrollEnd |
| || type == PlatformEvent::GestureScrollUpdate |
| - || type == PlatformEvent::GestureScrollUpdateWithoutPropagation); |
| - memset(&m_data, 0, sizeof(m_data)); |
| - m_data.m_scrollUpdate.m_deltaX = deltaX; |
| - m_data.m_scrollUpdate.m_deltaY = deltaY; |
| - m_data.m_scrollUpdate.m_velocityX = velocityX; |
| - m_data.m_scrollUpdate.m_velocityY = velocityY; |
| + || type == PlatformEvent::GestureScrollUpdateWithoutPropagation) { |
| + m_data.m_scrollUpdate.m_deltaX = deltaX; |
| + m_data.m_scrollUpdate.m_deltaY = deltaY; |
| + m_data.m_scrollUpdate.m_velocityX = velocityX; |
| + m_data.m_scrollUpdate.m_velocityY = velocityY; |
| + } |
| } |
| const IntPoint& position() const { return m_position; } // PlatformWindow coordinates. |
| @@ -105,6 +106,43 @@ public: |
| return m_data.m_pinchUpdate.m_scale; |
| } |
| + void applyTouchAdjustment(const IntPoint& adjustedPosition) |
| + { |
| + // Update the window-relative position of the event so that the node that was |
| + // ultimately hit is under this point (i.e. elementFromPoint for the client |
| + // co-ordinates in a 'click' event should yield the target). The global |
| + // position is intentionally left unmodified because it's intended to reflect |
| + // raw co-ordinates unrelated to any content. |
| + m_position = adjustedPosition; |
| + } |
| + |
| + bool isScrollEvent() const |
| + { |
| + switch (m_type) { |
| + case GestureScrollBegin: |
| + case GestureScrollEnd: |
| + case GestureScrollUpdate: |
| + case GestureScrollUpdateWithoutPropagation: |
| + case GestureFlingStart: |
| + case GesturePinchBegin: |
| + case GesturePinchEnd: |
| + case GesturePinchUpdate: |
|
Rick Byers
2014/06/27 15:38:24
Note that pinch events are really logical extensio
|
| + return true; |
| + case GestureTap: |
| + case GestureTapUnconfirmed: |
| + case GestureTapDown: |
| + case GestureShowPress: |
| + case GestureTapDownCancel: |
| + case GestureTwoFingerTap: |
| + case GestureLongPress: |
| + case GestureLongTap: |
| + return false; |
| + default: |
| + ASSERT_NOT_REACHED(); |
| + return false; |
| + } |
| + } |
| + |
| protected: |
| IntPoint m_position; |
| IntPoint m_globalPosition; |