OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 25 matching lines...) Expand all Loading... |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class PlatformGestureEvent : public PlatformEvent { | 38 class PlatformGestureEvent : public PlatformEvent { |
39 public: | 39 public: |
40 PlatformGestureEvent() | 40 PlatformGestureEvent() |
41 : PlatformEvent(PlatformEvent::GestureScrollBegin) | 41 : PlatformEvent(PlatformEvent::GestureScrollBegin) |
42 { | 42 { |
43 memset(&m_data, 0, sizeof(m_data)); | 43 memset(&m_data, 0, sizeof(m_data)); |
44 } | 44 } |
45 | 45 |
46 PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& gl
obalPosition, const IntSize& area, double timestamp, bool shiftKey, bool ctrlKey
, bool altKey, bool metaKey, float deltaX, float deltaY, float velocityX, float
velocityY) | 46 PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& gl
obalPosition, const IntSize& area, double timestamp, bool shiftKey, bool ctrlKey
, bool altKey, bool metaKey, float deltaX, float deltaY, float velocityX, float
velocityY, bool preventPropagation) |
47 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) | 47 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) |
48 , m_position(position) | 48 , m_position(position) |
49 , m_globalPosition(globalPosition) | 49 , m_globalPosition(globalPosition) |
50 , m_area(area) | 50 , m_area(area) |
51 { | 51 { |
52 memset(&m_data, 0, sizeof(m_data)); | 52 memset(&m_data, 0, sizeof(m_data)); |
53 if (type == PlatformEvent::GestureScrollBegin | 53 if (type == PlatformEvent::GestureScrollBegin |
54 || type == PlatformEvent::GestureScrollEnd | 54 || type == PlatformEvent::GestureScrollEnd |
55 || type == PlatformEvent::GestureScrollUpdate | 55 || type == PlatformEvent::GestureScrollUpdate |
56 || type == PlatformEvent::GestureScrollUpdateWithoutPropagation) { | 56 || type == PlatformEvent::GestureScrollUpdateWithoutPropagation) { |
57 m_data.m_scrollUpdate.m_deltaX = deltaX; | 57 m_data.m_scrollUpdate.m_deltaX = deltaX; |
58 m_data.m_scrollUpdate.m_deltaY = deltaY; | 58 m_data.m_scrollUpdate.m_deltaY = deltaY; |
59 m_data.m_scrollUpdate.m_velocityX = velocityX; | 59 m_data.m_scrollUpdate.m_velocityX = velocityX; |
60 m_data.m_scrollUpdate.m_velocityY = velocityY; | 60 m_data.m_scrollUpdate.m_velocityY = velocityY; |
| 61 m_data.m_scrollUpdate.m_preventPropagation = preventPropagation; |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 const IntPoint& position() const { return m_position; } // PlatformWindow co
ordinates. | 65 const IntPoint& position() const { return m_position; } // PlatformWindow co
ordinates. |
65 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree
n coordinates. | 66 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree
n coordinates. |
66 | 67 |
67 const IntSize& area() const { return m_area; } | 68 const IntSize& area() const { return m_area; } |
68 | 69 |
69 float deltaX() const | 70 float deltaX() const |
70 { | 71 { |
(...skipping 22 matching lines...) Expand all Loading... |
93 return m_data.m_scrollUpdate.m_velocityX; | 94 return m_data.m_scrollUpdate.m_velocityX; |
94 } | 95 } |
95 | 96 |
96 float velocityY() const | 97 float velocityY() const |
97 { | 98 { |
98 ASSERT(m_type == PlatformEvent::GestureScrollUpdate | 99 ASSERT(m_type == PlatformEvent::GestureScrollUpdate |
99 || m_type == PlatformEvent::GestureScrollUpdateWithoutPropagation); | 100 || m_type == PlatformEvent::GestureScrollUpdateWithoutPropagation); |
100 return m_data.m_scrollUpdate.m_velocityY; | 101 return m_data.m_scrollUpdate.m_velocityY; |
101 } | 102 } |
102 | 103 |
| 104 bool preventPropagation() const |
| 105 { |
| 106 ASSERT(m_type == PlatformEvent::GestureScrollUpdate |
| 107 || m_type == PlatformEvent::GestureScrollUpdateWithoutPropagation); |
| 108 return m_data.m_scrollUpdate.m_preventPropagation; |
| 109 } |
| 110 |
103 float scale() const | 111 float scale() const |
104 { | 112 { |
105 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); | 113 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); |
106 return m_data.m_pinchUpdate.m_scale; | 114 return m_data.m_pinchUpdate.m_scale; |
107 } | 115 } |
108 | 116 |
109 void applyTouchAdjustment(const IntPoint& adjustedPosition) | 117 void applyTouchAdjustment(const IntPoint& adjustedPosition) |
110 { | 118 { |
111 // Update the window-relative position of the event so that the node tha
t was | 119 // Update the window-relative position of the event so that the node tha
t was |
112 // ultimately hit is under this point (i.e. elementFromPoint for the cli
ent | 120 // ultimately hit is under this point (i.e. elementFromPoint for the cli
ent |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 union { | 159 union { |
152 struct { | 160 struct { |
153 int m_tapCount; | 161 int m_tapCount; |
154 } m_tap; | 162 } m_tap; |
155 | 163 |
156 struct { | 164 struct { |
157 float m_deltaX; | 165 float m_deltaX; |
158 float m_deltaY; | 166 float m_deltaY; |
159 float m_velocityX; | 167 float m_velocityX; |
160 float m_velocityY; | 168 float m_velocityY; |
| 169 int m_preventPropagation; |
161 } m_scrollUpdate; | 170 } m_scrollUpdate; |
162 | 171 |
163 struct { | 172 struct { |
164 float m_scale; | 173 float m_scale; |
165 } m_pinchUpdate; | 174 } m_pinchUpdate; |
166 } m_data; | 175 } m_data; |
167 }; | 176 }; |
168 | 177 |
169 } // namespace blink | 178 } // namespace blink |
170 | 179 |
171 #endif // PlatformGestureEvent_h | 180 #endif // PlatformGestureEvent_h |
OLD | NEW |