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

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

Issue 20986003: Define DOM_KEY_LOCATION_* constants on KeyboardEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 7 years, 4 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 | Annotate | Revision Log
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 case VK_RMENU: 61 case VK_RMENU:
62 return VK_MENU; 62 return VK_MENU;
63 default: 63 default:
64 return keycode; 64 return keycode;
65 } 65 }
66 } 66 }
67 67
68 static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo ardEvent& key) 68 static inline KeyboardEvent::KeyLocationCode keyLocationCode(const PlatformKeybo ardEvent& key)
69 { 69 {
70 if (key.isKeypad()) 70 if (key.isKeypad())
71 return KeyboardEvent::DOMKeyLocationNumpad; 71 return KeyboardEvent::DOM_KEY_LOCATION_NUMPAD;
72 72
73 // FIXME: Support DOM_KEY_LOCATION_MOBILE & DOM_KEY_LOCATION_JOYSTICK (crbug .com/265446).
73 switch (key.windowsVirtualKeyCode()) { 74 switch (key.windowsVirtualKeyCode()) {
74 case VK_LCONTROL: 75 case VK_LCONTROL:
75 case VK_LSHIFT: 76 case VK_LSHIFT:
76 case VK_LMENU: 77 case VK_LMENU:
77 case VK_LWIN: 78 case VK_LWIN:
78 return KeyboardEvent::DOMKeyLocationLeft; 79 return KeyboardEvent::DOM_KEY_LOCATION_LEFT;
79 case VK_RCONTROL: 80 case VK_RCONTROL:
80 case VK_RSHIFT: 81 case VK_RSHIFT:
81 case VK_RMENU: 82 case VK_RMENU:
82 case VK_RWIN: 83 case VK_RWIN:
83 return KeyboardEvent::DOMKeyLocationRight; 84 return KeyboardEvent::DOM_KEY_LOCATION_RIGHT;
84 default: 85 default:
85 return KeyboardEvent::DOMKeyLocationStandard; 86 return KeyboardEvent::DOM_KEY_LOCATION_STANDARD;
86 } 87 }
87 } 88 }
88 89
89 KeyboardEventInit::KeyboardEventInit() 90 KeyboardEventInit::KeyboardEventInit()
90 : keyLocation(0) 91 : keyLocation(0)
91 , ctrlKey(false) 92 , ctrlKey(false)
92 , altKey(false) 93 , altKey(false)
93 , shiftKey(false) 94 , shiftKey(false)
94 , metaKey(false) 95 , metaKey(false)
95 { 96 {
96 } 97 }
97 98
98 KeyboardEvent::KeyboardEvent() 99 KeyboardEvent::KeyboardEvent()
99 : m_keyLocation(DOMKeyLocationStandard) 100 : m_keyLocation(DOM_KEY_LOCATION_STANDARD)
100 , m_altGraphKey(false) 101 , m_altGraphKey(false)
101 { 102 {
102 ScriptWrappable::init(this); 103 ScriptWrappable::init(this);
103 } 104 }
104 105
105 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie w) 106 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, AbstractView* vie w)
106 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), 107 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()),
107 true, true, view, 0, key.ctrlKey(), key.altKey(), key. shiftKey(), key.metaKey()) 108 true, true, view, 0, key.ctrlKey(), key.altKey(), key. shiftKey(), key.metaKey())
108 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key))) 109 , m_keyEvent(adoptPtr(new PlatformKeyboardEvent(key)))
109 , m_keyIdentifier(key.keyIdentifier()) 110 , m_keyIdentifier(key.keyIdentifier())
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 { 230 {
230 } 231 }
231 232
232 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c onst 233 bool KeyboardEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) c onst
233 { 234 {
234 // Make sure not to return true if we already took default action while hand ling the event. 235 // Make sure not to return true if we already took default action while hand ling the event.
235 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default Handled(); 236 return EventDispatchMediator::dispatchEvent(dispatcher) && !event()->default Handled();
236 } 237 }
237 238
238 } // namespace WebCore 239 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698