OLD | NEW |
---|---|
1 /** | 1 /** |
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
5 * Copyright (C) 2003, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 10 matching lines...) Expand all Loading... | |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/events/KeyboardEvent.h" | 24 #include "core/events/KeyboardEvent.h" |
25 | 25 |
26 #include "platform/PlatformKeyboardEvent.h" | 26 #include "platform/PlatformKeyboardEvent.h" |
27 #include "platform/WindowsKeyboardCodes.h" | 27 #include "platform/WindowsKeyboardCodes.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 namespace { | |
32 | |
33 #if OS(ANDROID) | |
34 int kInputMethodEditorCompositionKeyCode = 229; | |
bcwhite
2015/01/12 21:02:44
Is this constant available anywhere else already o
huangs
2015/01/12 23:25:57
Searched for 229 and 0xE5. Something close is
ht
| |
35 #endif | |
36 | |
37 } // namespace | |
38 | |
31 static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::T ype type) | 39 static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::T ype type) |
32 { | 40 { |
33 switch (type) { | 41 switch (type) { |
34 case PlatformEvent::KeyUp: | 42 case PlatformEvent::KeyUp: |
35 return EventTypeNames::keyup; | 43 return EventTypeNames::keyup; |
36 case PlatformEvent::RawKeyDown: | 44 case PlatformEvent::RawKeyDown: |
37 return EventTypeNames::keydown; | 45 return EventTypeNames::keydown; |
38 case PlatformEvent::Char: | 46 case PlatformEvent::Char: |
39 return EventTypeNames::keypress; | 47 return EventTypeNames::keypress; |
40 case PlatformEvent::KeyDown: | 48 case PlatformEvent::KeyDown: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 return false; | 164 return false; |
157 } | 165 } |
158 | 166 |
159 int KeyboardEvent::keyCode() const | 167 int KeyboardEvent::keyCode() const |
160 { | 168 { |
161 // IE: virtual key code for keyup/keydown, character code for keypress | 169 // IE: virtual key code for keyup/keydown, character code for keypress |
162 // Firefox: virtual key code for keyup/keydown, zero for keypress | 170 // Firefox: virtual key code for keyup/keydown, zero for keypress |
163 // We match IE. | 171 // We match IE. |
164 if (!m_keyEvent) | 172 if (!m_keyEvent) |
165 return 0; | 173 return 0; |
174 | |
175 #if OS(ANDROID) | |
bcwhite
2015/01/12 21:02:44
// TODO: Check if this applies to other OS
huangs
2015/01/12 23:25:57
Done (using FIXME instead).
| |
176 // If the key event belongs to IME composition then propagate to JS. | |
177 if (m_keyEvent->nativeVirtualKeyCode() == kInputMethodEditorCompositionKeyCo de) | |
178 return kInputMethodEditorCompositionKeyCode; | |
179 #endif | |
180 | |
166 if (type() == EventTypeNames::keydown || type() == EventTypeNames::keyup) | 181 if (type() == EventTypeNames::keydown || type() == EventTypeNames::keyup) |
167 return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKe yCode()); | 182 return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKe yCode()); |
168 | 183 |
169 return charCode(); | 184 return charCode(); |
170 } | 185 } |
171 | 186 |
172 int KeyboardEvent::charCode() const | 187 int KeyboardEvent::charCode() const |
173 { | 188 { |
174 // IE: not supported | 189 // IE: not supported |
175 // Firefox: 0 for keydown/keyup events, character code for keypress | 190 // Firefox: 0 for keydown/keyup events, character code for keypress |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 { | 228 { |
214 } | 229 } |
215 | 230 |
216 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) c onst | 231 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) c onst |
217 { | 232 { |
218 // Make sure not to return true if we already took default action while hand ling the event. | 233 // Make sure not to return true if we already took default action while hand ling the event. |
219 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled(); | 234 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled(); |
220 } | 235 } |
221 | 236 |
222 } // namespace blink | 237 } // namespace blink |
OLD | NEW |