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

Side by Side Diff: Source/web/WebInputEvent.cpp

Issue 1352283002: Remove PlatformKeyboardEvents requirement to have located virtual keycode information. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/platform/PlatformEvent.h ('k') | Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode() 191 void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode()
192 { 192 {
193 const char* id = staticKeyIdentifiers(windowsKeyCode); 193 const char* id = staticKeyIdentifiers(windowsKeyCode);
194 if (id) { 194 if (id) {
195 strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1); 195 strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1);
196 keyIdentifier[sizeof(keyIdentifier) - 1] = '\0'; 196 keyIdentifier[sizeof(keyIdentifier) - 1] = '\0';
197 } else 197 } else
198 snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windows KeyCode)); 198 snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windows KeyCode));
199 } 199 }
200 200
201 // static
202 int WebKeyboardEvent::windowsKeyCodeWithoutLocation(int keycode)
203 {
204 switch (keycode) {
205 case VK_LCONTROL:
206 case VK_RCONTROL:
207 return VK_CONTROL;
208 case VK_LSHIFT:
209 case VK_RSHIFT:
210 return VK_SHIFT;
211 case VK_LMENU:
212 case VK_RMENU:
213 return VK_MENU;
214 default:
215 return keycode;
216 }
217 }
218
219 // static
220 int WebKeyboardEvent::locationModifiersFromWindowsKeyCode(int keycode)
221 {
222 switch (keycode) {
223 case VK_LCONTROL:
224 case VK_LSHIFT:
225 case VK_LMENU:
226 case VK_LWIN:
227 return IsLeft;
228 case VK_RCONTROL:
229 case VK_RSHIFT:
230 case VK_RMENU:
231 case VK_RWIN:
232 return IsRight;
233 default:
234 return 0;
235 }
236 }
237
238 } // namespace blink 201 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/PlatformEvent.h ('k') | Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698