Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/core/events/KeyboardEvent.cpp

Issue 1350933003: Implement MouseEvent.getModifierState (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add LayoutTests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 initUIEvent(type, canBubble, cancelable, view, 0); 147 initUIEvent(type, canBubble, cancelable, view, 0);
148 148
149 m_keyIdentifier = keyIdentifier; 149 m_keyIdentifier = keyIdentifier;
150 m_location = location; 150 m_location = location;
151 m_ctrlKey = ctrlKey; 151 m_ctrlKey = ctrlKey;
152 m_shiftKey = shiftKey; 152 m_shiftKey = shiftKey;
153 m_altKey = altKey; 153 m_altKey = altKey;
154 m_metaKey = metaKey; 154 m_metaKey = metaKey;
155 } 155 }
156 156
157 bool KeyboardEvent::getModifierState(const String& keyIdentifier) const
158 {
159 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654 58):
160 // "AltGraph", "CapsLock", "Fn", "NumLock", "ScrollLock", "SymbolLock", "OS" .
161 if (keyIdentifier == "Control")
162 return ctrlKey();
163 if (keyIdentifier == "Shift")
164 return shiftKey();
165 if (keyIdentifier == "Alt")
166 return altKey();
167 if (keyIdentifier == "Meta")
168 return metaKey();
169 return false;
170 }
171
172 int KeyboardEvent::keyCode() const 157 int KeyboardEvent::keyCode() const
173 { 158 {
174 // IE: virtual key code for keyup/keydown, character code for keypress 159 // IE: virtual key code for keyup/keydown, character code for keypress
175 // Firefox: virtual key code for keyup/keydown, zero for keypress 160 // Firefox: virtual key code for keyup/keydown, zero for keypress
176 // We match IE. 161 // We match IE.
177 if (!m_keyEvent) 162 if (!m_keyEvent)
178 return 0; 163 return 0;
179 164
180 #if OS(ANDROID) 165 #if OS(ANDROID)
181 // FIXME: Check to see if this applies to other OS. 166 // FIXME: Check to see if this applies to other OS.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 { 224 {
240 } 225 }
241 226
242 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) c onst 227 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) c onst
243 { 228 {
244 // 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.
245 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled(); 230 return EventDispatchMediator::dispatchEvent(dispatcher) && !event().defaultH andled();
246 } 231 }
247 232
248 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698