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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 */ | 21 */ |
22 | 22 |
23 #include "core/events/KeyboardEvent.h" | 23 #include "core/events/KeyboardEvent.h" |
24 | 24 |
25 #include "bindings/core/v8/DOMWrapperWorld.h" | 25 #include "bindings/core/v8/DOMWrapperWorld.h" |
26 #include "bindings/core/v8/ScriptState.h" | 26 #include "bindings/core/v8/ScriptState.h" |
27 #include "platform/PlatformKeyboardEvent.h" | 27 #include "platform/PlatformKeyboardEvent.h" |
28 #include "platform/WindowsKeyboardCodes.h" | 28 #include "platform/WindowsKeyboardCodes.h" |
29 #include "wtf/PtrUtil.h" | |
30 | 29 |
31 namespace blink { | 30 namespace blink { |
32 | 31 |
33 static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::E
ventType type) | 32 static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::E
ventType type) |
34 { | 33 { |
35 switch (type) { | 34 switch (type) { |
36 case PlatformEvent::KeyUp: | 35 case PlatformEvent::KeyUp: |
37 return EventTypeNames::keyup; | 36 return EventTypeNames::keyup; |
38 case PlatformEvent::RawKeyDown: | 37 case PlatformEvent::RawKeyDown: |
39 return EventTypeNames::keydown; | 38 return EventTypeNames::keydown; |
(...skipping 27 matching lines...) Expand all Loading... |
67 return new KeyboardEvent(type, initializer); | 66 return new KeyboardEvent(type, initializer); |
68 } | 67 } |
69 | 68 |
70 KeyboardEvent::KeyboardEvent() | 69 KeyboardEvent::KeyboardEvent() |
71 : m_location(DOM_KEY_LOCATION_STANDARD) | 70 : m_location(DOM_KEY_LOCATION_STANDARD) |
72 { | 71 { |
73 } | 72 } |
74 | 73 |
75 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 74 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
76 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi
reTouchEventsSourceCapabilities()) | 75 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi
reTouchEventsSourceCapabilities()) |
77 , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) | 76 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) |
78 , m_keyIdentifier(key.keyIdentifier()) | 77 , m_keyIdentifier(key.keyIdentifier()) |
79 , m_code(key.code()) | 78 , m_code(key.code()) |
80 , m_key(key.key()) | 79 , m_key(key.key()) |
81 , m_location(keyLocationCode(key)) | 80 , m_location(keyLocationCode(key)) |
82 { | 81 { |
83 initLocationModifiers(m_location); | 82 initLocationModifiers(m_location); |
84 } | 83 } |
85 | 84 |
86 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 85 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
87 : UIEventWithKeyState(eventType, initializer) | 86 : UIEventWithKeyState(eventType, initializer) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 break; | 191 break; |
193 } | 192 } |
194 } | 193 } |
195 | 194 |
196 DEFINE_TRACE(KeyboardEvent) | 195 DEFINE_TRACE(KeyboardEvent) |
197 { | 196 { |
198 UIEventWithKeyState::trace(visitor); | 197 UIEventWithKeyState::trace(visitor); |
199 } | 198 } |
200 | 199 |
201 } // namespace blink | 200 } // namespace blink |
OLD | NEW |