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" |
29 | 30 |
30 namespace blink { | 31 namespace blink { |
31 | 32 |
32 static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::E
ventType type) | 33 static inline const AtomicString& eventTypeForKeyboardEventType(PlatformEvent::E
ventType type) |
33 { | 34 { |
34 switch (type) { | 35 switch (type) { |
35 case PlatformEvent::KeyUp: | 36 case PlatformEvent::KeyUp: |
36 return EventTypeNames::keyup; | 37 return EventTypeNames::keyup; |
37 case PlatformEvent::RawKeyDown: | 38 case PlatformEvent::RawKeyDown: |
38 return EventTypeNames::keydown; | 39 return EventTypeNames::keydown; |
(...skipping 27 matching lines...) Expand all Loading... |
66 return new KeyboardEvent(type, initializer); | 67 return new KeyboardEvent(type, initializer); |
67 } | 68 } |
68 | 69 |
69 KeyboardEvent::KeyboardEvent() | 70 KeyboardEvent::KeyboardEvent() |
70 : m_location(DOM_KEY_LOCATION_STANDARD) | 71 : m_location(DOM_KEY_LOCATION_STANDARD) |
71 { | 72 { |
72 } | 73 } |
73 | 74 |
74 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 75 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
75 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi
reTouchEventsSourceCapabilities()) | 76 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), true, true,
view, 0, key.getModifiers(), key.timestamp(), InputDeviceCapabilities::doesntFi
reTouchEventsSourceCapabilities()) |
76 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) | 77 , m_keyEvent(wrapUnique(new PlatformKeyboardEvent(key))) |
77 , m_keyIdentifier(key.keyIdentifier()) | 78 , m_keyIdentifier(key.keyIdentifier()) |
78 , m_code(key.code()) | 79 , m_code(key.code()) |
79 , m_key(key.key()) | 80 , m_key(key.key()) |
80 , m_location(keyLocationCode(key)) | 81 , m_location(keyLocationCode(key)) |
81 { | 82 { |
82 initLocationModifiers(m_location); | 83 initLocationModifiers(m_location); |
83 } | 84 } |
84 | 85 |
85 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 86 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
86 : UIEventWithKeyState(eventType, initializer) | 87 : UIEventWithKeyState(eventType, initializer) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 break; | 192 break; |
192 } | 193 } |
193 } | 194 } |
194 | 195 |
195 DEFINE_TRACE(KeyboardEvent) | 196 DEFINE_TRACE(KeyboardEvent) |
196 { | 197 { |
197 UIEventWithKeyState::trace(visitor); | 198 UIEventWithKeyState::trace(visitor); |
198 } | 199 } |
199 | 200 |
200 } // namespace blink | 201 } // namespace blink |
OLD | NEW |