| Index: Source/devtools/front_end/ui/ShortcutRegistry.js
|
| diff --git a/Source/devtools/front_end/ui/ShortcutRegistry.js b/Source/devtools/front_end/ui/ShortcutRegistry.js
|
| index 229d834ca7d5414f68d2f202a3d808b2bfd277fc..9f5a1e7e35fd1d1e6bc431103ca91b72e6671c5d 100644
|
| --- a/Source/devtools/front_end/ui/ShortcutRegistry.js
|
| +++ b/Source/devtools/front_end/ui/ShortcutRegistry.js
|
| @@ -11,6 +11,8 @@ WebInspector.ShortcutRegistry = function(actionRegistry)
|
| this._actionRegistry = actionRegistry;
|
| /** @type {!StringMultimap.<string>} */
|
| this._defaultKeyToActions = new StringMultimap();
|
| + /** @type {!StringMultimap.<!WebInspector.KeyboardShortcut.Descriptor>} */
|
| + this._defaultActionToShortcut = new StringMultimap();
|
| this._registerBindings();
|
| }
|
|
|
| @@ -49,22 +51,26 @@ WebInspector.ShortcutRegistry.prototype = {
|
| },
|
|
|
| /**
|
| + * @param {string} actionId
|
| + * @return {!Array.<!WebInspector.KeyboardShortcut.Descriptor>}
|
| + */
|
| + shortcutDescriptorsForAction: function(actionId)
|
| + {
|
| + return this._defaultActionToShortcut.get(actionId).values();
|
| + },
|
| +
|
| + /**
|
| * @param {!Array.<string>} actionIds
|
| * @return {!Array.<number>}
|
| */
|
| keysForActions: function(actionIds)
|
| {
|
| - var actionIdSet = actionIds.keySet();
|
| var result = [];
|
| - this._defaultKeyToActions.keys().forEach(function(key) {
|
| - var actionIdsForKey = this._defaultKeyToActions.get(key);
|
| - actionIdsForKey.values().some(function(actionId) {
|
| - if (actionIdSet.hasOwnProperty(actionId)) {
|
| - result.push(key);
|
| - return true;
|
| - }
|
| - });
|
| - }, this);
|
| + for (var i = 0; i < actionIds.length; ++i) {
|
| + var descriptors = this.shortcutDescriptorsForAction(actionIds[i]);
|
| + for (var j = 0; j < descriptors.length; ++j)
|
| + result.push(descriptors[j]);
|
| + }
|
| return result;
|
| },
|
|
|
| @@ -149,10 +155,11 @@ WebInspector.ShortcutRegistry.prototype = {
|
| */
|
| registerShortcut: function(actionId, shortcut)
|
| {
|
| - var key = WebInspector.KeyboardShortcut.makeKeyFromBindingShortcut(shortcut);
|
| - if (!key)
|
| + var descriptor = WebInspector.KeyboardShortcut.makeDescriptorFromBindingShortcut(shortcut);
|
| + if (!descriptor)
|
| return;
|
| - this._defaultKeyToActions.put(String(key), actionId);
|
| + this._defaultActionToShortcut.put(actionId, descriptor);
|
| + this._defaultKeyToActions.put(String(descriptor.key), actionId);
|
| },
|
|
|
| /**
|
|
|