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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 WebInspector.KeyboardShortcut._modifiersToString = function(modifiers) | 285 WebInspector.KeyboardShortcut._modifiersToString = function(modifiers) |
286 { | 286 { |
287 var isMac = WebInspector.isMac(); | 287 var isMac = WebInspector.isMac(); |
288 var m = WebInspector.KeyboardShortcut.Modifiers; | 288 var m = WebInspector.KeyboardShortcut.Modifiers; |
289 var modifierNames = new Map([ | 289 var modifierNames = new Map([ |
290 [m.Ctrl, isMac ? "\u2303" : "Ctrl\u200A+\u200A"], | 290 [m.Ctrl, isMac ? "\u2303" : "Ctrl\u200A+\u200A"], |
291 [m.Alt, isMac ? "\u2325" : "Alt\u200A+\u200A"], | 291 [m.Alt, isMac ? "\u2325" : "Alt\u200A+\u200A"], |
292 [m.Shift, isMac ? "\u21e7" : "Shift\u200A+\u200A"], | 292 [m.Shift, isMac ? "\u21e7" : "Shift\u200A+\u200A"], |
293 [m.Meta, isMac ? "\u2318" : "Win\u200A+\u200A"] | 293 [m.Meta, isMac ? "\u2318" : "Win\u200A+\u200A"] |
294 ]); | 294 ]); |
295 return [m.Ctrl, m.Alt, m.Shift, m.Meta].map(m => modifiers & m ? modifierNam
es.get(m) : "").join(""); | 295 return [m.Ctrl, m.Alt, m.Shift, m.Meta].map(mapModifiers).join(""); |
| 296 |
| 297 /** |
| 298 * @param {number} m |
| 299 * @return {string} |
| 300 */ |
| 301 function mapModifiers(m) |
| 302 { |
| 303 return modifiers & m ? /** @type {string} */ (modifierNames.get(m)) : ""
; |
| 304 } |
296 }; | 305 }; |
297 | 306 |
298 WebInspector.KeyboardShortcut.SelectAll = WebInspector.KeyboardShortcut.makeKey(
"a", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta); | 307 WebInspector.KeyboardShortcut.SelectAll = WebInspector.KeyboardShortcut.makeKey(
"a", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta); |
OLD | NEW |