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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 bool shiftKey, bool ctrlKey, bool altKey, bool metaKey) | 48 bool shiftKey, bool ctrlKey, bool altKey, bool metaKey) |
49 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) | 49 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) |
50 , m_position(position) | 50 , m_position(position) |
51 , m_globalPosition(globalPosition) | 51 , m_globalPosition(globalPosition) |
52 , m_area(area) | 52 , m_area(area) |
53 { | 53 { |
54 memset(&m_data, 0, sizeof(m_data)); | 54 memset(&m_data, 0, sizeof(m_data)); |
55 } | 55 } |
56 | 56 |
57 void setScrollGestureData(float deltaX, float deltaY, float velocityX, float
velocityY, | 57 void setScrollGestureData(float deltaX, float deltaY, float velocityX, float
velocityY, |
58 bool inertial, bool preventPropagation) | 58 bool inertial, bool preventPropagation, int resendingPluginId) |
59 { | 59 { |
60 ASSERT(type() == PlatformEvent::GestureScrollBegin | 60 ASSERT(type() == PlatformEvent::GestureScrollBegin |
61 || type() == PlatformEvent::GestureScrollUpdate | 61 || type() == PlatformEvent::GestureScrollUpdate |
62 || type() == PlatformEvent::GestureScrollEnd); | 62 || type() == PlatformEvent::GestureScrollEnd); |
63 if (type() != GestureScrollUpdate) { | 63 if (type() != GestureScrollUpdate) { |
64 ASSERT(deltaX == 0); | 64 ASSERT(deltaX == 0); |
65 ASSERT(deltaY == 0); | 65 ASSERT(deltaY == 0); |
66 ASSERT(velocityX == 0); | 66 ASSERT(velocityX == 0); |
67 ASSERT(velocityY == 0); | 67 ASSERT(velocityY == 0); |
68 ASSERT(!preventPropagation); | 68 ASSERT(!preventPropagation); |
69 } | 69 } |
70 | 70 |
71 if (type() == PlatformEvent::GestureScrollBegin) | 71 if (type() == PlatformEvent::GestureScrollBegin) |
72 ASSERT(!inertial); | 72 ASSERT(!inertial); |
73 | 73 |
74 m_data.m_scroll.m_deltaX = deltaX; | 74 m_data.m_scroll.m_deltaX = deltaX; |
75 m_data.m_scroll.m_deltaY = deltaY; | 75 m_data.m_scroll.m_deltaY = deltaY; |
76 m_data.m_scroll.m_velocityX = velocityX; | 76 m_data.m_scroll.m_velocityX = velocityX; |
77 m_data.m_scroll.m_velocityY = velocityY; | 77 m_data.m_scroll.m_velocityY = velocityY; |
78 m_data.m_scroll.m_inertial = inertial; | 78 m_data.m_scroll.m_inertial = inertial; |
| 79 m_data.m_scroll.m_resendingPluginId = resendingPluginId; |
79 m_data.m_scroll.m_preventPropagation = preventPropagation; | 80 m_data.m_scroll.m_preventPropagation = preventPropagation; |
80 } | 81 } |
81 | 82 |
82 const IntPoint& position() const { return m_position; } // PlatformWindow co
ordinates. | 83 const IntPoint& position() const { return m_position; } // PlatformWindow co
ordinates. |
83 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree
n coordinates. | 84 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree
n coordinates. |
84 | 85 |
85 const IntSize& area() const { return m_area; } | 86 const IntSize& area() const { return m_area; } |
86 | 87 |
87 float deltaX() const | 88 float deltaX() const |
88 { | 89 { |
89 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 90 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
90 return m_data.m_scroll.m_deltaX; | 91 return m_data.m_scroll.m_deltaX; |
91 } | 92 } |
92 | 93 |
93 float deltaY() const | 94 float deltaY() const |
94 { | 95 { |
95 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 96 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
96 return m_data.m_scroll.m_deltaY; | 97 return m_data.m_scroll.m_deltaY; |
97 } | 98 } |
98 | 99 |
99 int tapCount() const | 100 int tapCount() const |
100 { | 101 { |
101 ASSERT(m_type == PlatformEvent::GestureTap); | 102 ASSERT(m_type == PlatformEvent::GestureTap); |
102 return m_data.m_tap.m_tapCount; | 103 return m_data.m_tap.m_tapCount; |
103 } | 104 } |
104 | 105 |
105 float velocityX() const | 106 float velocityX() const |
106 { | 107 { |
107 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 108 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor
mEvent::GestureFlingStart); |
108 return m_data.m_scroll.m_velocityX; | 109 return m_data.m_scroll.m_velocityX; |
109 } | 110 } |
110 | 111 |
111 float velocityY() const | 112 float velocityY() const |
112 { | 113 { |
113 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 114 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor
mEvent::GestureFlingStart); |
114 return m_data.m_scroll.m_velocityY; | 115 return m_data.m_scroll.m_velocityY; |
115 } | 116 } |
116 | 117 |
117 bool inertial() const | 118 bool inertial() const |
118 { | 119 { |
119 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor
mEvent::GestureScrollEnd); | 120 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor
mEvent::GestureScrollEnd); |
120 return m_data.m_scroll.m_inertial; | 121 return m_data.m_scroll.m_inertial; |
121 } | 122 } |
122 | 123 |
| 124 int resendingPluginId() const |
| 125 { |
| 126 if (m_type == PlatformEvent::GestureScrollUpdate |
| 127 || m_type == PlatformEvent::GestureScrollBegin |
| 128 || m_type == PlatformEvent::GestureScrollEnd) |
| 129 return m_data.m_scroll.m_resendingPluginId; |
| 130 |
| 131 // This function is called by *all* gesture event types in |
| 132 // GestureEvent::Create(), so we return -1 for all other types. |
| 133 return -1; |
| 134 } |
| 135 |
123 bool preventPropagation() const | 136 bool preventPropagation() const |
124 { | 137 { |
125 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 138 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
126 return m_data.m_scroll.m_preventPropagation; | 139 return m_data.m_scroll.m_preventPropagation; |
127 } | 140 } |
128 | 141 |
129 float scale() const | 142 float scale() const |
130 { | 143 { |
131 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); | 144 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); |
132 return m_data.m_pinchUpdate.m_scale; | 145 return m_data.m_pinchUpdate.m_scale; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 int m_tapCount; | 191 int m_tapCount; |
179 } m_tap; | 192 } m_tap; |
180 | 193 |
181 struct { | 194 struct { |
182 float m_deltaX; | 195 float m_deltaX; |
183 float m_deltaY; | 196 float m_deltaY; |
184 float m_velocityX; | 197 float m_velocityX; |
185 float m_velocityY; | 198 float m_velocityY; |
186 int m_preventPropagation; | 199 int m_preventPropagation; |
187 bool m_inertial; | 200 bool m_inertial; |
| 201 int m_resendingPluginId; |
188 } m_scroll; | 202 } m_scroll; |
189 | 203 |
190 struct { | 204 struct { |
191 float m_scale; | 205 float m_scale; |
192 } m_pinchUpdate; | 206 } m_pinchUpdate; |
193 } m_data; | 207 } m_data; |
194 }; | 208 }; |
195 | 209 |
196 } // namespace blink | 210 } // namespace blink |
197 | 211 |
198 #endif // PlatformGestureEvent_h | 212 #endif // PlatformGestureEvent_h |
OLD | NEW |