Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: sky/engine/public/platform/WebInputEvent.h

Issue 876853005: Add wheel support to sky-scrollable (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/frame/NewEventHandler.cpp ('k') | sky/engine/web/WebViewImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 GestureTapDown, 114 GestureTapDown,
115 GestureTapCancel, 115 GestureTapCancel,
116 GestureDoubleTap, 116 GestureDoubleTap,
117 GestureTwoFingerTap, 117 GestureTwoFingerTap,
118 GestureLongPress, 118 GestureLongPress,
119 GestureLongTap, 119 GestureLongTap,
120 GesturePinchBegin, 120 GesturePinchBegin,
121 GesturePinchEnd, 121 GesturePinchEnd,
122 GesturePinchUpdate, 122 GesturePinchUpdate,
123 GestureTypeLast = GesturePinchUpdate, 123 GestureTypeLast = GesturePinchUpdate,
124
125 WheelEvent,
124 }; 126 };
125 127
126 enum Modifiers { 128 enum Modifiers {
127 // modifiers for all events: 129 // modifiers for all events:
128 ShiftKey = 1 << 0, 130 ShiftKey = 1 << 0,
129 ControlKey = 1 << 1, 131 ControlKey = 1 << 1,
130 AltKey = 1 << 2, 132 AltKey = 1 << 2,
131 MetaKey = 1 << 3, 133 MetaKey = 1 << 3,
132 134
133 // modifiers for keyboard events: 135 // modifiers for keyboard events:
(...skipping 29 matching lines...) Expand all
163 double timeStampMS; // Milliseconds since epoch. 165 double timeStampMS; // Milliseconds since epoch.
164 unsigned size; // The size of this structure, for serialization. 166 unsigned size; // The size of this structure, for serialization.
165 Type type; 167 Type type;
166 int modifiers; 168 int modifiers;
167 169
168 static bool isPointerEventType(int type) 170 static bool isPointerEventType(int type)
169 { 171 {
170 return PointerTypeFirst <= type && type <= PointerTypeLast; 172 return PointerTypeFirst <= type && type <= PointerTypeLast;
171 } 173 }
172 174
173 // Returns true if the WebInputEvent |type| is a keyboard event.
174 static bool isKeyboardEventType(int type) 175 static bool isKeyboardEventType(int type)
175 { 176 {
176 return KeyboardTypeFirst <= type && type <= KeyboardTypeLast; 177 return KeyboardTypeFirst <= type && type <= KeyboardTypeLast;
177 } 178 }
178 179
179 // Returns true if the WebInputEvent is a gesture event.
180 static bool isGestureEventType(int type) 180 static bool isGestureEventType(int type)
181 { 181 {
182 return GestureTypeFirst <= type && type <= GestureTypeLast; 182 return GestureTypeFirst <= type && type <= GestureTypeLast;
183 } 183 }
184 184
185 static bool isWheelEventType(int type)
186 {
187 return type == WheelEvent;
188 }
189
185 protected: 190 protected:
186 explicit WebInputEvent(unsigned sizeParam) 191 explicit WebInputEvent(unsigned sizeParam)
187 { 192 {
188 memset(this, 0, sizeParam); 193 memset(this, 0, sizeParam);
189 timeStampMS = 0.0; 194 timeStampMS = 0.0;
190 size = sizeParam; 195 size = sizeParam;
191 type = Undefined; 196 type = Undefined;
192 modifiers = 0; 197 modifiers = 0;
193 } 198 }
194 }; 199 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 class WebKeyboardEvent : public WebInputEvent { 236 class WebKeyboardEvent : public WebInputEvent {
232 public: 237 public:
233 // |key| is the Windows key code associated with this key 238 // |key| is the Windows key code associated with this key
234 // event. Sometimes it's direct from the event (i.e. on Windows), 239 // event. Sometimes it's direct from the event (i.e. on Windows),
235 // sometimes it's via a mapping function. If you want a list, see 240 // sometimes it's via a mapping function. If you want a list, see
236 // WebCore/platform/chromium/KeyboardCodes* . Note that this should 241 // WebCore/platform/chromium/KeyboardCodes* . Note that this should
237 // ALWAYS store the non-locational version of a keycode as this is 242 // ALWAYS store the non-locational version of a keycode as this is
238 // what is returned by the Windows API. For example, it should 243 // what is returned by the Windows API. For example, it should
239 // store VK_SHIFT instead of VK_RSHIFT. The location information 244 // store VK_SHIFT instead of VK_RSHIFT. The location information
240 // should be stored in |modifiers|. 245 // should be stored in |modifiers|.
241 int key; 246 int key = 0;
242 247
243 // |charCode| is the text generated by this keystroke. |unmodifiedCharCode| 248 // |charCode| is the text generated by this keystroke. |unmodifiedCharCode|
244 // is |charCode|, but unmodified by an concurrently-held modifiers (except 249 // is |charCode|, but unmodified by an concurrently-held modifiers (except
245 // shift). This is useful for working out shortcut keys. 250 // shift). This is useful for working out shortcut keys.
246 WebUChar charCode; 251 WebUChar charCode = 0;
247 WebUChar unmodifiedCharCode; 252 WebUChar unmodifiedCharCode = 0;
248 253
249 WebKeyboardEvent() 254 WebKeyboardEvent() : WebInputEvent(sizeof(WebKeyboardEvent)) {}
250 : WebInputEvent(sizeof(WebKeyboardEvent))
251 , key(0)
252 , charCode(0)
253 , unmodifiedCharCode(0)
254 {
255 }
256 }; 255 };
257 256
258 // WebGestureEvent ------------------------------------------------------------- - 257 // WebWheelEvent --------------------------------------------------------------
258
259 class WebWheelEvent : public WebInputEvent {
260 public:
261 float x = 0;
262 float y = 0;
263 float offsetX = 0;
264 float offsetY = 0;
265
266 WebWheelEvent() : WebInputEvent(sizeof(WebWheelEvent)) {}
267 };
268
269 // WebGestureEvent ------------------------------------------------------------
259 270
260 class WebGestureEvent : public WebInputEvent { 271 class WebGestureEvent : public WebInputEvent {
261 public: 272 public:
262 int x; 273 float x = 0;
263 int y; 274 float y = 0;
264 int globalX;
265 int globalY;
266 WebGestureDevice sourceDevice;
267 275
268 union { 276 union {
269 // Tap information must be set for GestureTap, GestureTapUnconfirmed, 277 // Tap information must be set for GestureTap, GestureTapUnconfirmed,
270 // and GestureDoubleTap events. 278 // and GestureDoubleTap events.
271 struct { 279 struct {
272 int tapCount; 280 int tapCount;
273 float width; 281 float width;
274 float height; 282 float height;
275 } tap; 283 } tap;
276 284
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 float velocityY; 321 float velocityY;
314 } flingStart; 322 } flingStart;
315 323
316 struct { 324 struct {
317 float scale; 325 float scale;
318 } pinchUpdate; 326 } pinchUpdate;
319 } data; 327 } data;
320 328
321 WebGestureEvent() 329 WebGestureEvent()
322 : WebInputEvent(sizeof(WebGestureEvent)) 330 : WebInputEvent(sizeof(WebGestureEvent))
323 , x(0)
324 , y(0)
325 , globalX(0)
326 , globalY(0)
327 { 331 {
328 memset(&data, 0, sizeof(data)); 332 memset(&data, 0, sizeof(data));
329 } 333 }
330 }; 334 };
331 335
332 #pragma pack(pop) 336 #pragma pack(pop)
333 337
334 } // namespace blink 338 } // namespace blink
335 339
336 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBINPUTEVENT_H_ 340 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBINPUTEVENT_H_
OLDNEW
« no previous file with comments | « sky/engine/core/frame/NewEventHandler.cpp ('k') | sky/engine/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698