| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 { | 140 { |
| 141 var modifiers = WebInspector.KeyboardShortcut.Modifiers.None; | 141 var modifiers = WebInspector.KeyboardShortcut.Modifiers.None; |
| 142 if (keyboardEvent.shiftKey) | 142 if (keyboardEvent.shiftKey) |
| 143 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Shift; | 143 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Shift; |
| 144 if (keyboardEvent.ctrlKey) | 144 if (keyboardEvent.ctrlKey) |
| 145 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Ctrl; | 145 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Ctrl; |
| 146 if (keyboardEvent.altKey) | 146 if (keyboardEvent.altKey) |
| 147 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Alt; | 147 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Alt; |
| 148 if (keyboardEvent.metaKey) | 148 if (keyboardEvent.metaKey) |
| 149 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Meta; | 149 modifiers |= WebInspector.KeyboardShortcut.Modifiers.Meta; |
| 150 return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEv
ent.keyCode, modifiers); | 150 |
| 151 function keyCodeForEvent(keyboardEvent) |
| 152 { |
| 153 // Use either a real or a synthetic keyCode (for events originating from
extensions). |
| 154 return keyboardEvent.keyCode || keyboardEvent["__keyCode"]; |
| 155 } |
| 156 return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCodeFor
Event(keyboardEvent), modifiers); |
| 151 } | 157 } |
| 152 | 158 |
| 153 /** | 159 /** |
| 154 * @param {?KeyboardEvent} event | 160 * @param {?KeyboardEvent} event |
| 155 * @return {boolean} | 161 * @return {boolean} |
| 156 */ | 162 */ |
| 157 WebInspector.KeyboardShortcut.eventHasCtrlOrMeta = function(event) | 163 WebInspector.KeyboardShortcut.eventHasCtrlOrMeta = function(event) |
| 158 { | 164 { |
| 159 return WebInspector.isMac() ? event.metaKey && !event.ctrlKey : event.ctrlKe
y && !event.metaKey; | 165 return WebInspector.isMac() ? event.metaKey && !event.ctrlKey : event.ctrlKe
y && !event.metaKey; |
| 160 } | 166 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 if (!platformsString) | 361 if (!platformsString) |
| 356 return true; | 362 return true; |
| 357 var platforms = platformsString.split(","); | 363 var platforms = platformsString.split(","); |
| 358 var isMatch = false; | 364 var isMatch = false; |
| 359 var currentPlatform = WebInspector.platform(); | 365 var currentPlatform = WebInspector.platform(); |
| 360 for (var i = 0; !isMatch && i < platforms.length; ++i) | 366 for (var i = 0; !isMatch && i < platforms.length; ++i) |
| 361 isMatch = platforms[i] === currentPlatform; | 367 isMatch = platforms[i] === currentPlatform; |
| 362 return isMatch; | 368 return isMatch; |
| 363 } | 369 } |
| 364 } | 370 } |
| OLD | NEW |