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 23 matching lines...) Expand all Loading... |
34 static inline const AtomicString& eventTypeForKeyboardEventType( | 34 static inline const AtomicString& eventTypeForKeyboardEventType( |
35 WebInputEvent::Type type) { | 35 WebInputEvent::Type type) { |
36 switch (type) { | 36 switch (type) { |
37 case WebInputEvent::KeyUp: | 37 case WebInputEvent::KeyUp: |
38 return EventTypeNames::keyup; | 38 return EventTypeNames::keyup; |
39 case WebInputEvent::RawKeyDown: | 39 case WebInputEvent::RawKeyDown: |
40 return EventTypeNames::keydown; | 40 return EventTypeNames::keydown; |
41 case WebInputEvent::Char: | 41 case WebInputEvent::Char: |
42 return EventTypeNames::keypress; | 42 return EventTypeNames::keypress; |
43 case WebInputEvent::KeyDown: | 43 case WebInputEvent::KeyDown: |
44 // The caller should disambiguate the combined event into RawKeyDown or Ch
ar events. | 44 // The caller should disambiguate the combined event into RawKeyDown or |
| 45 // Char events. |
45 break; | 46 break; |
46 default: | 47 default: |
47 break; | 48 break; |
48 } | 49 } |
49 NOTREACHED(); | 50 NOTREACHED(); |
50 return EventTypeNames::keydown; | 51 return EventTypeNames::keydown; |
51 } | 52 } |
52 | 53 |
53 static inline KeyboardEvent::KeyLocationCode keyLocationCode( | 54 static inline KeyboardEvent::KeyLocationCode keyLocationCode( |
54 const WebInputEvent& key) { | 55 const WebInputEvent& key) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 186 |
186 const AtomicString& KeyboardEvent::interfaceName() const { | 187 const AtomicString& KeyboardEvent::interfaceName() const { |
187 return EventNames::KeyboardEvent; | 188 return EventNames::KeyboardEvent; |
188 } | 189 } |
189 | 190 |
190 bool KeyboardEvent::isKeyboardEvent() const { | 191 bool KeyboardEvent::isKeyboardEvent() const { |
191 return true; | 192 return true; |
192 } | 193 } |
193 | 194 |
194 int KeyboardEvent::which() const { | 195 int KeyboardEvent::which() const { |
195 // Netscape's "which" returns a virtual key code for keydown and keyup, and a
character code for keypress. | 196 // Netscape's "which" returns a virtual key code for keydown and keyup, and a |
196 // That's exactly what IE's "keyCode" returns. So they are the same for keyboa
rd events. | 197 // character code for keypress. That's exactly what IE's "keyCode" returns. |
| 198 // So they are the same for keyboard events. |
197 return keyCode(); | 199 return keyCode(); |
198 } | 200 } |
199 | 201 |
200 void KeyboardEvent::initLocationModifiers(unsigned location) { | 202 void KeyboardEvent::initLocationModifiers(unsigned location) { |
201 switch (location) { | 203 switch (location) { |
202 case KeyboardEvent::kDomKeyLocationNumpad: | 204 case KeyboardEvent::kDomKeyLocationNumpad: |
203 m_modifiers |= PlatformEvent::IsKeyPad; | 205 m_modifiers |= PlatformEvent::IsKeyPad; |
204 break; | 206 break; |
205 case KeyboardEvent::kDomKeyLocationLeft: | 207 case KeyboardEvent::kDomKeyLocationLeft: |
206 m_modifiers |= PlatformEvent::IsLeft; | 208 m_modifiers |= PlatformEvent::IsLeft; |
207 break; | 209 break; |
208 case KeyboardEvent::kDomKeyLocationRight: | 210 case KeyboardEvent::kDomKeyLocationRight: |
209 m_modifiers |= PlatformEvent::IsRight; | 211 m_modifiers |= PlatformEvent::IsRight; |
210 break; | 212 break; |
211 } | 213 } |
212 } | 214 } |
213 | 215 |
214 DEFINE_TRACE(KeyboardEvent) { | 216 DEFINE_TRACE(KeyboardEvent) { |
215 UIEventWithKeyState::trace(visitor); | 217 UIEventWithKeyState::trace(visitor); |
216 } | 218 } |
217 | 219 |
218 } // namespace blink | 220 } // namespace blink |
OLD | NEW |