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, RailsMode railsMode) |
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 ASSERT(railsMode == PlatformEvent::RailsModeFree); |
69 } | 70 } |
70 | 71 |
71 if (type() == PlatformEvent::GestureScrollBegin) | 72 if (type() == PlatformEvent::GestureScrollBegin) |
72 ASSERT(!inertial); | 73 ASSERT(!inertial); |
73 | 74 |
74 m_data.m_scroll.m_deltaX = deltaX; | 75 m_data.m_scroll.m_deltaX = deltaX; |
75 m_data.m_scroll.m_deltaY = deltaY; | 76 m_data.m_scroll.m_deltaY = deltaY; |
76 m_data.m_scroll.m_velocityX = velocityX; | 77 m_data.m_scroll.m_velocityX = velocityX; |
77 m_data.m_scroll.m_velocityY = velocityY; | 78 m_data.m_scroll.m_velocityY = velocityY; |
78 m_data.m_scroll.m_inertial = inertial; | 79 m_data.m_scroll.m_inertial = inertial; |
79 m_data.m_scroll.m_preventPropagation = preventPropagation; | 80 m_data.m_scroll.m_preventPropagation = preventPropagation; |
| 81 m_data.m_scroll.m_railsMode = railsMode; |
80 } | 82 } |
81 | 83 |
82 const IntPoint& position() const { return m_position; } // PlatformWindow co
ordinates. | 84 const IntPoint& position() const { return m_position; } // PlatformWindow co
ordinates. |
83 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree
n coordinates. | 85 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree
n coordinates. |
84 | 86 |
85 const IntSize& area() const { return m_area; } | 87 const IntSize& area() const { return m_area; } |
86 | 88 |
87 float deltaX() const | 89 float deltaX() const |
88 { | 90 { |
89 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 91 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
(...skipping 17 matching lines...) Expand all Loading... |
107 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 109 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
108 return m_data.m_scroll.m_velocityX; | 110 return m_data.m_scroll.m_velocityX; |
109 } | 111 } |
110 | 112 |
111 float velocityY() const | 113 float velocityY() const |
112 { | 114 { |
113 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 115 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
114 return m_data.m_scroll.m_velocityY; | 116 return m_data.m_scroll.m_velocityY; |
115 } | 117 } |
116 | 118 |
| 119 RailsMode railsMode() const |
| 120 { |
| 121 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
| 122 return m_data.m_scroll.m_railsMode; |
| 123 } |
| 124 |
117 bool inertial() const | 125 bool inertial() const |
118 { | 126 { |
119 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor
mEvent::GestureScrollEnd); | 127 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor
mEvent::GestureScrollEnd); |
120 return m_data.m_scroll.m_inertial; | 128 return m_data.m_scroll.m_inertial; |
121 } | 129 } |
122 | 130 |
123 bool preventPropagation() const | 131 bool preventPropagation() const |
124 { | 132 { |
125 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); | 133 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); |
126 return m_data.m_scroll.m_preventPropagation; | 134 return m_data.m_scroll.m_preventPropagation; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 int m_tapCount; | 186 int m_tapCount; |
179 } m_tap; | 187 } m_tap; |
180 | 188 |
181 struct { | 189 struct { |
182 float m_deltaX; | 190 float m_deltaX; |
183 float m_deltaY; | 191 float m_deltaY; |
184 float m_velocityX; | 192 float m_velocityX; |
185 float m_velocityY; | 193 float m_velocityY; |
186 int m_preventPropagation; | 194 int m_preventPropagation; |
187 bool m_inertial; | 195 bool m_inertial; |
| 196 RailsMode m_railsMode; |
188 } m_scroll; | 197 } m_scroll; |
189 | 198 |
190 struct { | 199 struct { |
191 float m_scale; | 200 float m_scale; |
192 } m_pinchUpdate; | 201 } m_pinchUpdate; |
193 } m_data; | 202 } m_data; |
194 }; | 203 }; |
195 | 204 |
196 } // namespace blink | 205 } // namespace blink |
197 | 206 |
198 #endif // PlatformGestureEvent_h | 207 #endif // PlatformGestureEvent_h |
OLD | NEW |