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, int resendingPluginId, bool preventPropagation) |
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 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureScrollBegin || m_type == PlatformEvent::GestureScrollEnd); | |
127 if (isScrollEvent()) | |
tdresser
2015/09/15 15:28:29
isScrollEvent includes pinch events. We might as w
wjmaclean
2015/09/15 18:53:51
Done.
| |
128 return m_data.m_scroll.m_resendingPluginId; | |
129 | |
130 return -1; | |
131 } | |
132 | |
123 bool preventPropagation() const | 133 bool preventPropagation() const |
124 { | 134 { |
125 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 135 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
126 return m_data.m_scroll.m_preventPropagation; | 136 return m_data.m_scroll.m_preventPropagation; |
127 } | 137 } |
128 | 138 |
129 float scale() const | 139 float scale() const |
130 { | 140 { |
131 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); | 141 ASSERT(m_type == PlatformEvent::GesturePinchUpdate); |
132 return m_data.m_pinchUpdate.m_scale; | 142 return m_data.m_pinchUpdate.m_scale; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 int m_tapCount; | 188 int m_tapCount; |
179 } m_tap; | 189 } m_tap; |
180 | 190 |
181 struct { | 191 struct { |
182 float m_deltaX; | 192 float m_deltaX; |
183 float m_deltaY; | 193 float m_deltaY; |
184 float m_velocityX; | 194 float m_velocityX; |
185 float m_velocityY; | 195 float m_velocityY; |
186 int m_preventPropagation; | 196 int m_preventPropagation; |
187 bool m_inertial; | 197 bool m_inertial; |
198 int m_resendingPluginId; | |
188 } m_scroll; | 199 } m_scroll; |
189 | 200 |
190 struct { | 201 struct { |
191 float m_scale; | 202 float m_scale; |
192 } m_pinchUpdate; | 203 } m_pinchUpdate; |
193 } m_data; | 204 } m_data; |
194 }; | 205 }; |
195 | 206 |
196 } // namespace blink | 207 } // namespace blink |
197 | 208 |
198 #endif // PlatformGestureEvent_h | 209 #endif // PlatformGestureEvent_h |
OLD | NEW |