| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 // WebKeyboardEvent ----------------------------------------------------------- | 260 // WebKeyboardEvent ----------------------------------------------------------- |
| 261 | 261 |
| 262 class WebKeyboardEvent : public WebInputEvent { | 262 class WebKeyboardEvent : public WebInputEvent { |
| 263 public: | 263 public: |
| 264 // Caps on string lengths so we can make them static arrays and keep | 264 // Caps on string lengths so we can make them static arrays and keep |
| 265 // them PODs. | 265 // them PODs. |
| 266 static const size_t textLengthCap = 4; | 266 static const size_t textLengthCap = 4; |
| 267 | 267 |
| 268 // http://www.w3.org/TR/DOM-Level-3-Events/keyset.html lists the | |
| 269 // identifiers. The longest is 18 characters, so we round up to the | |
| 270 // next multiple of 4. | |
| 271 static const size_t keyIdentifierLengthCap = 20; | |
| 272 | |
| 273 // |windowsKeyCode| is the Windows key code associated with this key | 268 // |windowsKeyCode| is the Windows key code associated with this key |
| 274 // event. Sometimes it's direct from the event (i.e. on Windows), | 269 // event. Sometimes it's direct from the event (i.e. on Windows), |
| 275 // sometimes it's via a mapping function. If you want a list, see | 270 // sometimes it's via a mapping function. If you want a list, see |
| 276 // WebCore/platform/chromium/KeyboardCodes* . Note that this should | 271 // WebCore/platform/chromium/KeyboardCodes* . Note that this should |
| 277 // ALWAYS store the non-locational version of a keycode as this is | 272 // ALWAYS store the non-locational version of a keycode as this is |
| 278 // what is returned by the Windows API. For example, it should | 273 // what is returned by the Windows API. For example, it should |
| 279 // store VK_SHIFT instead of VK_RSHIFT. The location information | 274 // store VK_SHIFT instead of VK_RSHIFT. The location information |
| 280 // should be stored in |modifiers|. | 275 // should be stored in |modifiers|. |
| 281 int windowsKeyCode; | 276 int windowsKeyCode; |
| 282 | 277 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 307 | 302 |
| 308 // |text| is the text generated by this keystroke. |unmodifiedText| is | 303 // |text| is the text generated by this keystroke. |unmodifiedText| is |
| 309 // |text|, but unmodified by an concurrently-held modifiers (except | 304 // |text|, but unmodified by an concurrently-held modifiers (except |
| 310 // shift). This is useful for working out shortcut keys. Linux and | 305 // shift). This is useful for working out shortcut keys. Linux and |
| 311 // Windows guarantee one character per event. The Mac does not, but in | 306 // Windows guarantee one character per event. The Mac does not, but in |
| 312 // reality that's all it ever gives. We're generous, and cap it a bit | 307 // reality that's all it ever gives. We're generous, and cap it a bit |
| 313 // longer. | 308 // longer. |
| 314 WebUChar text[textLengthCap]; | 309 WebUChar text[textLengthCap]; |
| 315 WebUChar unmodifiedText[textLengthCap]; | 310 WebUChar unmodifiedText[textLengthCap]; |
| 316 | 311 |
| 317 // This is a string identifying the key pressed. | |
| 318 char keyIdentifier[keyIdentifierLengthCap]; | |
| 319 | |
| 320 WebKeyboardEvent() | 312 WebKeyboardEvent() |
| 321 : WebInputEvent(sizeof(WebKeyboardEvent)) | 313 : WebInputEvent(sizeof(WebKeyboardEvent)) |
| 322 , windowsKeyCode(0) | 314 , windowsKeyCode(0) |
| 323 , nativeKeyCode(0) | 315 , nativeKeyCode(0) |
| 324 , isSystemKey(false) | 316 , isSystemKey(false) |
| 325 , isBrowserShortcut(false) | 317 , isBrowserShortcut(false) |
| 326 { | 318 { |
| 327 memset(&text, 0, sizeof(text)); | 319 memset(&text, 0, sizeof(text)); |
| 328 memset(&unmodifiedText, 0, sizeof(unmodifiedText)); | 320 memset(&unmodifiedText, 0, sizeof(unmodifiedText)); |
| 329 memset(&keyIdentifier, 0, sizeof(keyIdentifier)); | |
| 330 } | 321 } |
| 331 | |
| 332 // Sets keyIdentifier based on the value of windowsKeyCode. This is | |
| 333 // handy for generating synthetic keyboard events. | |
| 334 BLINK_COMMON_EXPORT void setKeyIdentifierFromWindowsKeyCode(); | |
| 335 }; | 322 }; |
| 336 | 323 |
| 337 // WebMouseEvent -------------------------------------------------------------- | 324 // WebMouseEvent -------------------------------------------------------------- |
| 338 | 325 |
| 339 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { | 326 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { |
| 340 public: | 327 public: |
| 341 // Renderer coordinates. Similar to viewport coordinates but without | 328 // Renderer coordinates. Similar to viewport coordinates but without |
| 342 // DevTools emulation transform or overscroll applied. i.e. the coordinates | 329 // DevTools emulation transform or overscroll applied. i.e. the coordinates |
| 343 // in Chromium's RenderView bounds. | 330 // in Chromium's RenderView bounds. |
| 344 int x; | 331 int x; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 , uniqueTouchEventId(0) | 643 , uniqueTouchEventId(0) |
| 657 { | 644 { |
| 658 } | 645 } |
| 659 }; | 646 }; |
| 660 | 647 |
| 661 #pragma pack(pop) | 648 #pragma pack(pop) |
| 662 | 649 |
| 663 } // namespace blink | 650 } // namespace blink |
| 664 | 651 |
| 665 #endif | 652 #endif |
| OLD | NEW |