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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // WebInputEvent -------------------------------------------------------------- | 48 // WebInputEvent -------------------------------------------------------------- |
49 | 49 |
50 class WebInputEvent { | 50 class WebInputEvent { |
51 public: | 51 public: |
52 WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent)) | 52 WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent)) |
53 : size(sizeParam) | 53 : size(sizeParam) |
54 , type(Undefined) | 54 , type(Undefined) |
55 , modifiers(0) | 55 , modifiers(0) |
56 , timeStampSeconds(0.0) { } | 56 , timeStampSeconds(0.0) { } |
57 | 57 |
58 // There are two schemes used for keyboard input. On Windows (and, | 58 // When we use an input method (or an input method editor), we receive |
59 // interestingly enough, on Mac Carbon) there are two events for a | 59 // two events for a keypress. The former event is a keydown, which |
60 // keypress. One is a raw keydown, which provides the keycode only. | 60 // provides a keycode, and the latter is a textinput, which provides |
61 // If the app doesn't handle that, then the system runs key translation | 61 // a character processed by an input method. (The mapping from a |
62 // to create an event containing the generated character and pumps that | 62 // keycode to a character code is not trivial for non-English |
63 // event. In such a scheme, those two events are translated to | 63 // keyboards.) |
64 // RAW_KEY_DOWN and CHAR events respectively. In Cocoa and Gtk, key | 64 // To support input methods, Safari sends keydown events to WebKit for |
65 // events contain both the keycode and any translation into actual | 65 // filtering. WebKit sends filtered keydown events back to Safari, |
66 // text. In such a case, WebCore will eventually need to split the | 66 // which sends them to input methods. |
67 // events (see disambiguateKeyDownEvent and its callers) but we don't | 67 // Unfortunately, it is hard to apply this design to Chrome because of |
68 // worry about that here. We just use a different type (KEY_DOWN) to | 68 // our multiprocess architecture. An input method is running in a |
69 // indicate this. | 69 // browser process. On the other hand, WebKit is running in a renderer |
| 70 // process. So, this design results in increasing IPC messages. |
| 71 // To support input methods without increasing IPC messages, Chrome |
| 72 // handles keyboard events in a browser process and send asynchronous |
| 73 // input events (to be translated to DOM events) to a renderer |
| 74 // process. |
| 75 // This design is mostly the same as the one of Windows and Mac Carbon. |
| 76 // So, for what it's worth, our Linux and Mac front-ends emulate our |
| 77 // Windows front-end. To emulate our Windows front-end, we can share |
| 78 // our back-end code among Windows, Linux, and Mac. |
| 79 // TODO(hbono): Issue 18064: remove the KeyDown type since it isn't |
| 80 // used in Chrome any longer. |
70 | 81 |
71 enum Type { | 82 enum Type { |
72 Undefined = -1, | 83 Undefined = -1, |
73 | 84 |
74 // WebMouseEvent | 85 // WebMouseEvent |
75 MouseDown, | 86 MouseDown, |
76 MouseUp, | 87 MouseUp, |
77 MouseMove, | 88 MouseMove, |
78 MouseEnter, | 89 MouseEnter, |
79 MouseLeave, | 90 MouseLeave, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 , wheelTicksX(0.0f) | 242 , wheelTicksX(0.0f) |
232 , wheelTicksY(0.0f) | 243 , wheelTicksY(0.0f) |
233 , scrollByPage(false) | 244 , scrollByPage(false) |
234 { | 245 { |
235 } | 246 } |
236 }; | 247 }; |
237 | 248 |
238 } // namespace WebKit | 249 } // namespace WebKit |
239 | 250 |
240 #endif | 251 #endif |
OLD | NEW |