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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 , ctrlKey(false) | 90 , ctrlKey(false) |
91 , altKey(false) | 91 , altKey(false) |
92 , shiftKey(false) | 92 , shiftKey(false) |
93 , metaKey(false) | 93 , metaKey(false) |
94 , repeat(false) | 94 , repeat(false) |
95 { | 95 { |
96 } | 96 } |
97 | 97 |
98 KeyboardEvent::KeyboardEvent() | 98 KeyboardEvent::KeyboardEvent() |
99 : m_location(DOM_KEY_LOCATION_STANDARD) | 99 : m_location(DOM_KEY_LOCATION_STANDARD) |
100 , m_altGraphKey(false) | |
101 , m_isAutoRepeat(false) | 100 , m_isAutoRepeat(false) |
102 { | 101 { |
103 ScriptWrappable::init(this); | 102 ScriptWrappable::init(this); |
104 } | 103 } |
105 | 104 |
106 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) | 105 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie
w) |
107 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), | 106 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), |
108 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) | 107 true, true, view, 0, key.ctrlKey(), key.altKey(), key.
shiftKey(), key.metaKey()) |
109 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) | 108 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) |
110 , m_keyIdentifier(key.keyIdentifier()) | 109 , m_keyIdentifier(key.keyIdentifier()) |
111 , m_location(keyLocationCode(key)) | 110 , m_location(keyLocationCode(key)) |
112 , m_altGraphKey(false) | |
113 , m_isAutoRepeat(key.isAutoRepeat()) | 111 , m_isAutoRepeat(key.isAutoRepeat()) |
114 { | 112 { |
115 ScriptWrappable::init(this); | 113 ScriptWrappable::init(this); |
116 } | 114 } |
117 | 115 |
118 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) | 116 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventI
nit& initializer) |
119 : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable
, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey,
initializer.shiftKey, initializer.metaKey) | 117 : UIEventWithKeyState(eventType, initializer.bubbles, initializer.cancelable
, initializer.view, initializer.detail, initializer.ctrlKey, initializer.altKey,
initializer.shiftKey, initializer.metaKey) |
120 , m_keyIdentifier(initializer.keyIdentifier) | 118 , m_keyIdentifier(initializer.keyIdentifier) |
121 , m_location(initializer.location) | 119 , m_location(initializer.location) |
122 , m_altGraphKey(false) | |
123 , m_isAutoRepeat(initializer.repeat) | 120 , m_isAutoRepeat(initializer.repeat) |
124 { | 121 { |
125 ScriptWrappable::init(this); | 122 ScriptWrappable::init(this); |
126 } | 123 } |
127 | 124 |
128 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, | 125 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool
cancelable, AbstractView *view, |
129 const String &keyIdentifier, unsigned location, | 126 const String &keyIdentifier, unsigned location, |
130 bool ctrlKey, bool altKey, bool shiftKey, bool meta
Key, bool altGraphKey) | 127 bool ctrlKey, bool altKey, bool shiftKey, bool meta
Key) |
131 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) | 128 : UIEventWithKeyState(eventType, canBubble, cancelable, view, 0, ctrlKey, al
tKey, shiftKey, metaKey) |
132 , m_keyIdentifier(keyIdentifier) | 129 , m_keyIdentifier(keyIdentifier) |
133 , m_location(location) | 130 , m_location(location) |
134 , m_altGraphKey(altGraphKey) | |
135 , m_isAutoRepeat(false) | 131 , m_isAutoRepeat(false) |
136 { | 132 { |
137 ScriptWrappable::init(this); | 133 ScriptWrappable::init(this); |
138 } | 134 } |
139 | 135 |
140 KeyboardEvent::~KeyboardEvent() | 136 KeyboardEvent::~KeyboardEvent() |
141 { | 137 { |
142 } | 138 } |
143 | 139 |
144 void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
bool cancelable, AbstractView* view, | 140 void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble,
bool cancelable, AbstractView* view, |
145 const String &keyIdentifier, unsigned loca
tion, | 141 const String &keyIdentifier, unsigned loca
tion, |
146 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey, bool altGraphKey) | 142 bool ctrlKey, bool altKey, bool shiftKey,
bool metaKey) |
147 { | 143 { |
148 if (dispatched()) | 144 if (dispatched()) |
149 return; | 145 return; |
150 | 146 |
151 initUIEvent(type, canBubble, cancelable, view, 0); | 147 initUIEvent(type, canBubble, cancelable, view, 0); |
152 | 148 |
153 m_keyIdentifier = keyIdentifier; | 149 m_keyIdentifier = keyIdentifier; |
154 m_location = location; | 150 m_location = location; |
155 m_ctrlKey = ctrlKey; | 151 m_ctrlKey = ctrlKey; |
156 m_shiftKey = shiftKey; | 152 m_shiftKey = shiftKey; |
157 m_altKey = altKey; | 153 m_altKey = altKey; |
158 m_metaKey = metaKey; | 154 m_metaKey = metaKey; |
159 m_altGraphKey = altGraphKey; | |
160 } | 155 } |
161 | 156 |
162 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const | 157 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const |
163 { | 158 { |
164 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654
58): | 159 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654
58): |
165 // "AltGraph", "CapsLock", "Fn", "NumLock", "ScrollLock", "SymbolLock", "OS"
. | 160 // "AltGraph", "CapsLock", "Fn", "NumLock", "ScrollLock", "SymbolLock", "OS"
. |
166 if (keyIdentifier == "Control") | 161 if (keyIdentifier == "Control") |
167 return ctrlKey(); | 162 return ctrlKey(); |
168 if (keyIdentifier == "Shift") | 163 if (keyIdentifier == "Shift") |
169 return shiftKey(); | 164 return shiftKey(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 { | 226 { |
232 } | 227 } |
233 | 228 |
234 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c
onst | 229 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c
onst |
235 { | 230 { |
236 // Make sure not to return true if we already took default action while hand
ling the event. | 231 // Make sure not to return true if we already took default action while hand
ling the event. |
237 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); | 232 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default
Handled(); |
238 } | 233 } |
239 | 234 |
240 } // namespace blink | 235 } // namespace blink |
OLD | NEW |