| OLD | NEW |
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // WebPointerEvent | 88 // WebPointerEvent |
| 89 PointerDown, | 89 PointerDown, |
| 90 PointerTypeFirst = PointerDown, | 90 PointerTypeFirst = PointerDown, |
| 91 PointerUp, | 91 PointerUp, |
| 92 PointerMove, | 92 PointerMove, |
| 93 PointerCancel, | 93 PointerCancel, |
| 94 PointerTypeLast = PointerCancel, | 94 PointerTypeLast = PointerCancel, |
| 95 | 95 |
| 96 // WebKeyboardEvent | 96 // WebKeyboardEvent |
| 97 RawKeyDown, | |
| 98 KeyboardTypeFirst = RawKeyDown, | |
| 99 KeyDown, | 97 KeyDown, |
| 98 KeyboardTypeFirst = KeyDown, |
| 100 KeyUp, | 99 KeyUp, |
| 101 Char, | 100 Char, |
| 102 KeyboardTypeLast = Char, | 101 KeyboardTypeLast = Char, |
| 103 | 102 |
| 104 // WebGestureEvent | 103 // WebGestureEvent |
| 105 GestureScrollBegin, | 104 GestureScrollBegin, |
| 106 GestureTypeFirst = GestureScrollBegin, | 105 GestureTypeFirst = GestureScrollBegin, |
| 107 GestureScrollEnd, | 106 GestureScrollEnd, |
| 108 GestureScrollUpdate, | 107 GestureScrollUpdate, |
| 109 GestureScrollUpdateWithoutPropagation, | 108 GestureScrollUpdateWithoutPropagation, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 float orientation = 0; | 223 float orientation = 0; |
| 225 float tilt = 0; | 224 float tilt = 0; |
| 226 | 225 |
| 227 WebPointerEvent() : WebInputEvent(sizeof(WebPointerEvent)) {} | 226 WebPointerEvent() : WebInputEvent(sizeof(WebPointerEvent)) {} |
| 228 }; | 227 }; |
| 229 | 228 |
| 230 // WebKeyboardEvent ----------------------------------------------------------- | 229 // WebKeyboardEvent ----------------------------------------------------------- |
| 231 | 230 |
| 232 class WebKeyboardEvent : public WebInputEvent { | 231 class WebKeyboardEvent : public WebInputEvent { |
| 233 public: | 232 public: |
| 234 // Caps on string lengths so we can make them static arrays and keep | 233 // |key| is the Windows key code associated with this key |
| 235 // them PODs. | |
| 236 static const size_t textLengthCap = 4; | |
| 237 | |
| 238 // http://www.w3.org/TR/DOM-Level-3-Events/keyset.html lists the | |
| 239 // identifiers. The longest is 18 characters, so we round up to the | |
| 240 // next multiple of 4. | |
| 241 static const size_t keyIdentifierLengthCap = 20; | |
| 242 | |
| 243 // |windowsKeyCode| is the Windows key code associated with this key | |
| 244 // event. Sometimes it's direct from the event (i.e. on Windows), | 234 // event. Sometimes it's direct from the event (i.e. on Windows), |
| 245 // sometimes it's via a mapping function. If you want a list, see | 235 // sometimes it's via a mapping function. If you want a list, see |
| 246 // WebCore/platform/chromium/KeyboardCodes* . Note that this should | 236 // WebCore/platform/chromium/KeyboardCodes* . Note that this should |
| 247 // ALWAYS store the non-locational version of a keycode as this is | 237 // ALWAYS store the non-locational version of a keycode as this is |
| 248 // what is returned by the Windows API. For example, it should | 238 // what is returned by the Windows API. For example, it should |
| 249 // store VK_SHIFT instead of VK_RSHIFT. The location information | 239 // store VK_SHIFT instead of VK_RSHIFT. The location information |
| 250 // should be stored in |modifiers|. | 240 // should be stored in |modifiers|. |
| 251 int windowsKeyCode; | 241 int key; |
| 252 | 242 |
| 253 // The actual key code genenerated by the platform. The DOM spec runs | 243 // |charCode| is the text generated by this keystroke. |unmodifiedCharCode| |
| 254 // on Windows-equivalent codes (thus |windowsKeyCode| above) but it | 244 // is |charCode|, but unmodified by an concurrently-held modifiers (except |
| 255 // doesn't hurt to have this one around. | 245 // shift). This is useful for working out shortcut keys. |
| 256 int nativeKeyCode; | 246 WebUChar charCode; |
| 257 | 247 WebUChar unmodifiedCharCode; |
| 258 // This identifies whether this event was tagged by the system as being | |
| 259 // a "system key" event (see | |
| 260 // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for | |
| 261 // details). Other platforms don't have this concept, but it's just | |
| 262 // easier to leave it always false than ifdef. | |
| 263 // See comment at the top of the file for why an int is used here. | |
| 264 bool isSystemKey; | |
| 265 | |
| 266 // |text| is the text generated by this keystroke. |unmodifiedText| is | |
| 267 // |text|, but unmodified by an concurrently-held modifiers (except | |
| 268 // shift). This is useful for working out shortcut keys. Linux and | |
| 269 // Windows guarantee one character per event. The Mac does not, but in | |
| 270 // reality that's all it ever gives. We're generous, and cap it a bit | |
| 271 // longer. | |
| 272 WebUChar text[textLengthCap]; | |
| 273 WebUChar unmodifiedText[textLengthCap]; | |
| 274 | |
| 275 // This is a string identifying the key pressed. | |
| 276 char keyIdentifier[keyIdentifierLengthCap]; | |
| 277 | 248 |
| 278 WebKeyboardEvent() | 249 WebKeyboardEvent() |
| 279 : WebInputEvent(sizeof(WebKeyboardEvent)) | 250 : WebInputEvent(sizeof(WebKeyboardEvent)) |
| 280 , windowsKeyCode(0) | 251 , key(0) |
| 281 , nativeKeyCode(0) | 252 , charCode(0) |
| 282 , isSystemKey(false) | 253 , unmodifiedCharCode(0) |
| 283 { | 254 { |
| 284 memset(&text, 0, sizeof(text)); | |
| 285 memset(&unmodifiedText, 0, sizeof(unmodifiedText)); | |
| 286 memset(&keyIdentifier, 0, sizeof(keyIdentifier)); | |
| 287 } | 255 } |
| 288 | |
| 289 // Sets keyIdentifier based on the value of windowsKeyCode. This is | |
| 290 // handy for generating synthetic keyboard events. | |
| 291 BLINK_EXPORT void setKeyIdentifierFromWindowsKeyCode(); | |
| 292 | |
| 293 static int windowsKeyCodeWithoutLocation(int keycode); | |
| 294 static int locationModifiersFromWindowsKeyCode(int keycode); | |
| 295 }; | 256 }; |
| 296 | 257 |
| 297 // WebGestureEvent -------------------------------------------------------------
- | 258 // WebGestureEvent -------------------------------------------------------------
- |
| 298 | 259 |
| 299 class WebGestureEvent : public WebInputEvent { | 260 class WebGestureEvent : public WebInputEvent { |
| 300 public: | 261 public: |
| 301 int x; | 262 int x; |
| 302 int y; | 263 int y; |
| 303 int globalX; | 264 int globalX; |
| 304 int globalY; | 265 int globalY; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 { | 327 { |
| 367 memset(&data, 0, sizeof(data)); | 328 memset(&data, 0, sizeof(data)); |
| 368 } | 329 } |
| 369 }; | 330 }; |
| 370 | 331 |
| 371 #pragma pack(pop) | 332 #pragma pack(pop) |
| 372 | 333 |
| 373 } // namespace blink | 334 } // namespace blink |
| 374 | 335 |
| 375 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBINPUTEVENT_H_ | 336 #endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBINPUTEVENT_H_ |
| OLD | NEW |