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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 : m_location(DOM_KEY_LOCATION_STANDARD) | 99 : m_location(DOM_KEY_LOCATION_STANDARD) |
100 , m_isAutoRepeat(false) | 100 , m_isAutoRepeat(false) |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 104 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
105 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), | 105 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), |
106 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) | 106 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) |
107 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) | 107 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) |
108 , m_keyIdentifier(key.keyIdentifier()) | 108 , m_keyIdentifier(key.keyIdentifier()) |
| 109 , m_code(key.code()) |
109 , m_location(keyLocationCode(key)) | 110 , m_location(keyLocationCode(key)) |
110 , m_isAutoRepeat(key.isAutoRepeat()) | 111 , m_isAutoRepeat(key.isAutoRepeat()) |
111 { | 112 { |
112 } | 113 } |
113 | 114 |
114 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 115 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
115 : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable
, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey,
initializer.shiftKey, initializer.metaKey) | 116 : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable
, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey,
initializer.shiftKey, initializer.metaKey) |
116 , m_keyIdentifier(initializer.keyIdentifier) | 117 , m_keyIdentifier(initializer.keyIdentifier) |
| 118 , m_code(initializer.code) |
117 , m_location(initializer.location) | 119 , m_location(initializer.location) |
118 , m_isAutoRepeat(initializer.repeat) | 120 , m_isAutoRepeat(initializer.repeat) |
119 { | 121 { |
120 } | 122 } |
121 | 123 |
122 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, | 124 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, |
123 const String &keyIdentifier, unsigned location, | 125 const String &keyIdentifier, const String &code, unsigned location, bool ctr
lKey, bool altKey, bool shiftKey, bool metaKey) |
124 bool ctrlKey, bool altKey, bool shiftKey, bool meta
Key) | |
125 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) | 126 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) |
126 , m_keyIdentifier(keyIdentifier) | 127 , m_keyIdentifier(keyIdentifier) |
| 128 , m_code(code) |
127 , m_location(location) | 129 , m_location(location) |
128 , m_isAutoRepeat(false) | 130 , m_isAutoRepeat(false) |
129 { | 131 { |
130 } | 132 } |
131 | 133 |
132 KeyboardEvent::~KeyboardEvent() | 134 KeyboardEvent::~KeyboardEvent() |
133 { | 135 { |
134 } | 136 } |
135 | 137 |
136 void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
bool cancelable, AbstractView* view, | 138 void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
bool cancelable, AbstractView* view, |
137 const String &keyIdentifier, unsigned loca
tion, | 139 const String &keyIdentifier, const String &code, unsigned location, bool ctr
lKey, bool altKey, bool shiftKey, bool metaKey) |
138 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey) | |
139 { | 140 { |
140 if (dispatched()) | 141 if (dispatched()) |
141 return; | 142 return; |
142 | 143 |
143 initUIEvent(type, canBubble, cancelable, view, 0); | 144 initUIEvent(type, canBubble, cancelable, view, 0); |
144 | 145 |
145 m_keyIdentifier = keyIdentifier; | 146 m_keyIdentifier = keyIdentifier; |
| 147 m_code = code; |
146 m_location = location; | 148 m_location = location; |
147 m_ctrlKey = ctrlKey; | 149 m_ctrlKey = ctrlKey; |
148 m_shiftKey = shiftKey; | 150 m_shiftKey = shiftKey; |
149 m_altKey = altKey; | 151 m_altKey = altKey; |
150 m_metaKey = metaKey; | 152 m_metaKey = metaKey; |
151 } | 153 } |
152 | 154 |
153 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const | 155 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const |
154 { | 156 { |
155 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654
58): | 157 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654
58): |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 { | 224 { |
223 } | 225 } |
224 | 226 |
225 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c
onst | 227 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c
onst |
226 { | 228 { |
227 // Make sure not to return true if we already took default action while hand
ling the event. | 229 // Make sure not to return true if we already took default action while hand
ling the event. |
228 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); | 230 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); |
229 } | 231 } |
230 | 232 |
231 } // namespace blink | 233 } // namespace blink |
OLD | NEW |