| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (!keyEvent) | 185 if (!keyEvent) |
| 186 return ""; | 186 return ""; |
| 187 | 187 |
| 188 static HashMap<int, const char*>* keyDownCommandsMap = nullptr; | 188 static HashMap<int, const char*>* keyDownCommandsMap = nullptr; |
| 189 static HashMap<int, const char*>* keyPressCommandsMap = nullptr; | 189 static HashMap<int, const char*>* keyPressCommandsMap = nullptr; |
| 190 | 190 |
| 191 if (!keyDownCommandsMap) { | 191 if (!keyDownCommandsMap) { |
| 192 keyDownCommandsMap = new HashMap<int, const char*>; | 192 keyDownCommandsMap = new HashMap<int, const char*>; |
| 193 keyPressCommandsMap = new HashMap<int, const char*>; | 193 keyPressCommandsMap = new HashMap<int, const char*>; |
| 194 | 194 |
| 195 for (unsigned i = 0; i < arraysize(keyDownEntries); i++) { | 195 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(keyDownEntries); i++) { |
| 196 keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownE
ntries[i].virtualKey, keyDownEntries[i].name); | 196 keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownE
ntries[i].virtualKey, keyDownEntries[i].name); |
| 197 } | 197 } |
| 198 | 198 |
| 199 for (unsigned i = 0; i < arraysize(keyPressEntries); i++) { | 199 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(keyPressEntries); i++) { |
| 200 keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPre
ssEntries[i].charCode, keyPressEntries[i].name); | 200 keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPre
ssEntries[i].charCode, keyPressEntries[i].name); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 unsigned modifiers = 0; | 204 unsigned modifiers = 0; |
| 205 if (keyEvent->shiftKey()) | 205 if (keyEvent->shiftKey()) |
| 206 modifiers |= ShiftKey; | 206 modifiers |= ShiftKey; |
| 207 if (keyEvent->altKey()) | 207 if (keyEvent->altKey()) |
| 208 modifiers |= AltKey; | 208 modifiers |= AltKey; |
| 209 if (keyEvent->ctrlKey()) | 209 if (keyEvent->ctrlKey()) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 if (event.keyEvent()->metaKey()) | 257 if (event.keyEvent()->metaKey()) |
| 258 return false; | 258 return false; |
| 259 #endif | 259 #endif |
| 260 } | 260 } |
| 261 #endif | 261 #endif |
| 262 | 262 |
| 263 return true; | 263 return true; |
| 264 } | 264 } |
| 265 } // namespace blink | 265 } // namespace blink |
| 266 | 266 |
| OLD | NEW |