Web Inspector: Settings screen: some panel shortcuts are missing
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2012 13:50:58 +0000 (13:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2012 13:50:58 +0000 (13:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101026

Patch by Eugene Klyuchnikov <eustas.bug@gmail.com> on 2012-11-13
Reviewed by Pavel Feldman.

Panels, that have not been loaded by the time shortcuts view was
initialized, had no chance to register shortcuts.

Solution: move shortcut registration (for shortcuts screen) to panel
descriptors.

More changes: add JsDoc annotations to ShortcutScreen and change "key"
parameter type for raw string to key descriptor object.

* WebCore.gypi: Added TimelinePanelDescriptor.js file.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* inspector/compile-front-end.py: Ditto.
* inspector/front-end/WebKit.qrc: Ditto.
* inspector/front-end/inspector.html: Ditto.
* inspector/front-end/AdvancedSearchController.js: Add JsDoc annotation.
* inspector/front-end/GoToLineDialog.js: Ditto.
* inspector/front-end/CallStackSidebarPane.js: Removed shortcut-screen
shortcuts registration.
* inspector/front-end/ElementsPanel.js: Ditto.
* inspector/front-end/ScriptsPanel.js: Ditto.
* inspector/front-end/StylesSidebarPane.js: Ditto.
* inspector/front-end/TimelinePanel.js: Ditto.
* inspector/front-end/ConsoleView.js: Changes order of lines to increase
readability.
* inspector/front-end/ElementsPanelDescriptor.js: Add shortcut-screen
shortcuts registration and key descriptor constants.
* inspector/front-end/ScriptsPanelDescriptor.js: Ditto.
* inspector/front-end/TimelinePanelDescriptor.js: Ditto.
* inspector/front-end/Panel.js: Removed unused "uregisterShortcut"; made
"registerShortcuts" method accept array of key descriptors.
(WebInspector.PanelDescriptor.prototype.registerShortcuts): Added.
* inspector/front-end/ShortcutsScreen.js: Added JsDoc; changed parameter
type from string to key descriptor.
* inspector/front-end/inspector.js: Register shortcuts using
panel descriptors.
(WebInspector._panelDescriptors): Removed duplicate line.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134404 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/inspector/compile-front-end.py
Source/WebCore/inspector/front-end/AdvancedSearchController.js
Source/WebCore/inspector/front-end/CallStackSidebarPane.js
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/ElementsPanel.js
Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js
Source/WebCore/inspector/front-end/GoToLineDialog.js
Source/WebCore/inspector/front-end/KeyboardShortcut.js
Source/WebCore/inspector/front-end/Panel.js
Source/WebCore/inspector/front-end/ScriptsPanel.js
Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js
Source/WebCore/inspector/front-end/ShortcutsScreen.js
Source/WebCore/inspector/front-end/StylesSidebarPane.js
Source/WebCore/inspector/front-end/TimelinePanel.js
Source/WebCore/inspector/front-end/TimelinePanelDescriptor.js [new file with mode: 0644]
Source/WebCore/inspector/front-end/WebKit.qrc
Source/WebCore/inspector/front-end/inspector.html
Source/WebCore/inspector/front-end/inspector.js

index db3badb..0aaca6f 100644 (file)
@@ -1,3 +1,47 @@
+2012-11-13  Eugene Klyuchnikov  <eustas.bug@gmail.com>
+
+        Web Inspector: Settings screen: some panel shortcuts are missing
+        https://bugs.webkit.org/show_bug.cgi?id=101026
+
+        Reviewed by Pavel Feldman.
+
+        Panels, that have not been loaded by the time shortcuts view was
+        initialized, had no chance to register shortcuts.
+
+        Solution: move shortcut registration (for shortcuts screen) to panel
+        descriptors.
+
+        More changes: add JsDoc annotations to ShortcutScreen and change "key"
+        parameter type for raw string to key descriptor object.
+
+        * WebCore.gypi: Added TimelinePanelDescriptor.js file.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * inspector/compile-front-end.py: Ditto.
+        * inspector/front-end/WebKit.qrc: Ditto.
+        * inspector/front-end/inspector.html: Ditto.
+        * inspector/front-end/AdvancedSearchController.js: Add JsDoc annotation.
+        * inspector/front-end/GoToLineDialog.js: Ditto.
+        * inspector/front-end/CallStackSidebarPane.js: Removed shortcut-screen
+        shortcuts registration.
+        * inspector/front-end/ElementsPanel.js: Ditto.
+        * inspector/front-end/ScriptsPanel.js: Ditto.
+        * inspector/front-end/StylesSidebarPane.js: Ditto.
+        * inspector/front-end/TimelinePanel.js: Ditto.
+        * inspector/front-end/ConsoleView.js: Changes order of lines to increase
+        readability.
+        * inspector/front-end/ElementsPanelDescriptor.js: Add shortcut-screen
+        shortcuts registration and key descriptor constants.
+        * inspector/front-end/ScriptsPanelDescriptor.js: Ditto.
+        * inspector/front-end/TimelinePanelDescriptor.js: Ditto.
+        * inspector/front-end/Panel.js: Removed unused "uregisterShortcut"; made
+        "registerShortcuts" method accept array of key descriptors.
+        (WebInspector.PanelDescriptor.prototype.registerShortcuts): Added.
+        * inspector/front-end/ShortcutsScreen.js: Added JsDoc; changed parameter
+        type from string to key descriptor.
+        * inspector/front-end/inspector.js: Register shortcuts using
+        panel descriptors.
+        (WebInspector._panelDescriptors): Removed duplicate line.
+
 2012-11-13  Gabor Rapcsanyi  <rgabor@webkit.org>
 
         Optimize RGB565 and RGBA5551 packing/unpacking functions with NEON intrinsics
index 7332458..cf889a4 100644 (file)
@@ -221,8 +221,10 @@ localizedStrings["Hide console."] = "Hide console.";
 localizedStrings["Hide the records that are shorter than %s"] = "Hide the Precords that are shorter than %s";
 localizedStrings["Image"] = "Image";
 localizedStrings["Images"] = "Images";
-localizedStrings["Increment/decrement by %f"] = "Increment/decrement by %f";
-localizedStrings["Increment/decrement value"] = "Increment/decrement value";
+localizedStrings["Increment by %f"] = "Increment by %f";
+localizedStrings["Decrement by %f"] = "Decrement by %f";
+localizedStrings["Increment value"] = "Increment value";
+localizedStrings["Decrement value"] = "Decrement value";
 localizedStrings["Inherited from"] = "Inherited from";
 localizedStrings["Initiator"] = "Initiator";
 localizedStrings["Inspected worker terminated"] = "Inspected worker terminated";
index efab254..694dfd0 100644 (file)
             'inspector/front-end/TextPrompt.js',
             'inspector/front-end/TimelineGrid.js',
             'inspector/front-end/TimelineManager.js',
+            'inspector/front-end/TimelinePanelDescriptor.js',
             'inspector/front-end/Toolbar.js',
             'inspector/front-end/treeoutline.js',
             'inspector/front-end/UISourceCode.js',
index 0789f5f..77c85e5 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\inspector\front-end\TimelinePanelDescriptor.js"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\inspector\front-end\TimelinePresentationModel.js"
                                        >
                                </File>
index c682859..9090aa7 100755 (executable)
@@ -271,6 +271,7 @@ modules = [
             "TimelineModel.js",
             "TimelineOverviewPane.js",
             "TimelinePanel.js",
+            "TimelinePanelDescriptor.js",
             "TimelinePresentationModel.js",
             "TimelineFrameController.js"
         ]
index 9dfa78c..7a2c26d 100644 (file)
@@ -39,6 +39,9 @@ WebInspector.AdvancedSearchController = function()
     WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
 }
 
+/**
+ * @return {!WebInspector.KeyboardShortcut.Descriptor}
+ */
 WebInspector.AdvancedSearchController.createShortcut = function()
 {
     if (WebInspector.isMac())
index c065c90..27ad223 100644 (file)
@@ -115,17 +115,13 @@ WebInspector.CallStackSidebarPane.prototype = {
         InspectorFrontendHost.copyText(text);
     },
 
-    registerShortcuts: function(section, registerShortcutDelegate)
+    /**
+     * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, function(KeyboardEvent))} registerShortcutDelegate
+     */
+    registerShortcuts: function(registerShortcutDelegate)
     {
-        var nextCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period,
-            WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-        registerShortcutDelegate(nextCallFrame.key, this._selectNextCallFrameOnStack.bind(this));
-
-        var prevCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma,
-            WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-        registerShortcutDelegate(prevCallFrame.key, this._selectPreviousCallFrameOnStack.bind(this));
-
-        section.addRelatedKeys([ nextCallFrame.name, prevCallFrame.name ], WebInspector.UIString("Next/previous call frame"));
+        registerShortcutDelegate(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.NextCallFrame, this._selectNextCallFrameOnStack.bind(this));
+        registerShortcutDelegate(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCallFrame, this._selectPreviousCallFrameOnStack.bind(this));
     },
 
     setStatus: function(status)
index 9ea5bca..997c23e 100644 (file)
@@ -476,37 +476,41 @@ WebInspector.ConsoleView.prototype = {
         this._shortcuts = {};
 
         var shortcut = WebInspector.KeyboardShortcut;
+        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
 
+        var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
+        this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this);
+        var keys = [shortcutL];
         if (WebInspector.isMac()) {
             var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardShortcut.Modifiers.Meta);
             this._shortcuts[shortcutK.key] = this._requestClearMessages.bind(this);
+            keys.unshift(shortcutK);
         }
-
-        var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-        this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this);
-
-        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
-        var keys = WebInspector.isMac() ? [ shortcutK.name, shortcutL.name ] : [ shortcutL.name ];
         section.addAlternateKeys(keys, WebInspector.UIString("Clear console"));
 
         keys = [
-            shortcut.shortcutToString(shortcut.Keys.Tab),
-            shortcut.shortcutToString(shortcut.Keys.Tab, shortcut.Modifiers.Shift)
+            shortcut.makeDescriptor(shortcut.Keys.Tab),
+            shortcut.makeDescriptor(shortcut.Keys.Tab, shortcut.Modifiers.Shift)
         ];
         section.addRelatedKeys(keys, WebInspector.UIString("Next/previous suggestion"));
-        section.addKey(shortcut.shortcutToString(shortcut.Keys.Right), WebInspector.UIString("Accept suggestion"));
+
+        section.addKey(shortcut.makeDescriptor(shortcut.Keys.Right), WebInspector.UIString("Accept suggestion"));
+
         keys = [
-            shortcut.shortcutToString(shortcut.Keys.Down),
-            shortcut.shortcutToString(shortcut.Keys.Up)
+            shortcut.makeDescriptor(shortcut.Keys.Down),
+            shortcut.makeDescriptor(shortcut.Keys.Up)
         ];
         section.addRelatedKeys(keys, WebInspector.UIString("Next/previous line"));
-        keys = [
-            shortcut.shortcutToString("N", shortcut.Modifiers.Alt),
-            shortcut.shortcutToString("P", shortcut.Modifiers.Alt)
-        ];
-        if (WebInspector.isMac())
+
+        if (WebInspector.isMac()) {
+            keys = [
+                shortcut.makeDescriptor("N", shortcut.Modifiers.Alt),
+                shortcut.makeDescriptor("P", shortcut.Modifiers.Alt)
+            ];
             section.addRelatedKeys(keys, WebInspector.UIString("Next/previous command"));
-        section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Execute command"));
+        }
+
+        section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter), WebInspector.UIString("Execute command"));
     },
 
     _requestClearMessages: function()
index 1b86510..8033299 100644 (file)
@@ -98,8 +98,6 @@ WebInspector.ElementsPanel = function()
             this.sidebarPanes[pane].onattach();
     }
 
-    this._registerShortcuts();
-
     this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this));
     this._popoverHelper.setTimeout(0);
 
@@ -1005,27 +1003,6 @@ WebInspector.ElementsPanel.prototype = {
         eventListenersSidebarPane.needsUpdate = false;
     },
 
-    _registerShortcuts: function()
-    {
-        var shortcut = WebInspector.KeyboardShortcut;
-        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));
-        var keys = [
-            shortcut.shortcutToString(shortcut.Keys.Up),
-            shortcut.shortcutToString(shortcut.Keys.Down)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Navigate elements"));
-
-        keys = [
-            shortcut.shortcutToString(shortcut.Keys.Right),
-            shortcut.shortcutToString(shortcut.Keys.Left)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Expand/collapse"));
-        section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Edit attribute"));
-        section.addKey(shortcut.shortcutToString(shortcut.Keys.F2), WebInspector.UIString("Toggle edit as HTML"));
-
-        this.sidebarPanes.styles.registerShortcuts();
-    },
-
     handleShortcut: function(event)
     {
         if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && event.keyIdentifier === "U+005A") { // Z key
index 8f71aae..0267f45 100644 (file)
@@ -52,5 +52,104 @@ WebInspector.ElementsPanelDescriptor.prototype = {
         this.panel().appendApplicableItems(event, contextMenu, target);
     },
 
+    registerShortcuts: function()
+    {
+        var elementsSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));
+
+        var navigate = WebInspector.ElementsPanelDescriptor.ShortcutKeys.NavigateUp.concat(WebInspector.ElementsPanelDescriptor.ShortcutKeys.NavigateDown);
+        elementsSection.addRelatedKeys(navigate, WebInspector.UIString("Navigate elements"));
+
+        var expandCollapse = WebInspector.ElementsPanelDescriptor.ShortcutKeys.Expand.concat(WebInspector.ElementsPanelDescriptor.ShortcutKeys.Collapse);
+        elementsSection.addRelatedKeys(expandCollapse, WebInspector.UIString("Expand/collapse"));
+
+        elementsSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.EditAttribute, WebInspector.UIString("Edit attribute"));
+        elementsSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.ToggleEditAsHTML, WebInspector.UIString("Toggle edit as HTML"));
+
+        var stylesPaneSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Styles Pane"));
+
+        var nextPreviousProperty = WebInspector.ElementsPanelDescriptor.ShortcutKeys.NextProperty.concat(WebInspector.ElementsPanelDescriptor.ShortcutKeys.PreviousProperty);
+        stylesPaneSection.addRelatedKeys(nextPreviousProperty, WebInspector.UIString("Next/previous property"));
+
+        stylesPaneSection.addRelatedKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementValue, WebInspector.UIString("Increment value"));
+        stylesPaneSection.addRelatedKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementValue, WebInspector.UIString("Decrement value"));
+
+        stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementBy10, WebInspector.UIString("Increment by %f", 10));
+        stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementBy10, WebInspector.UIString("Decrement by %f", 10));
+
+        stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementBy100, WebInspector.UIString("Increment by %f", 100));
+        stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementBy100, WebInspector.UIString("Decrement by %f", 100));
+
+        stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.IncrementBy01, WebInspector.UIString("Increment by %f", 0.1));
+        stylesPaneSection.addAlternateKeys(WebInspector.ElementsPanelDescriptor.ShortcutKeys.DecrementBy01, WebInspector.UIString("Decrement by %f", 0.1));
+    },
+
     __proto__: WebInspector.PanelDescriptor.prototype
 }
+
+WebInspector.ElementsPanelDescriptor.ShortcutKeys = {
+    NavigateUp: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up)
+    ],
+
+    NavigateDown: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down)
+    ],
+
+    Expand: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Right)
+    ],
+
+    Collapse: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Left)
+    ],
+
+    EditAttribute: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter)
+    ],
+
+    ToggleEditAsHTML: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F2)
+    ],
+
+    NextProperty: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab)
+    ],
+
+    PreviousProperty: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab, WebInspector.KeyboardShortcut.Modifiers.Shift)
+    ],
+
+    IncrementValue: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up)
+    ],
+
+    DecrementValue: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down)
+    ],
+
+    IncrementBy10: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp),
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up, WebInspector.KeyboardShortcut.Modifiers.Shift)
+    ],
+
+    DecrementBy10: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown),
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down, WebInspector.KeyboardShortcut.Modifiers.Shift)
+    ],
+
+    IncrementBy100: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp, WebInspector.KeyboardShortcut.Modifiers.Shift)
+    ],
+
+    DecrementBy100: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown, WebInspector.KeyboardShortcut.Modifiers.Shift)
+    ],
+
+    IncrementBy01: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp, WebInspector.KeyboardShortcut.Modifiers.Alt)
+    ],
+
+    DecrementBy01: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown, WebInspector.KeyboardShortcut.Modifiers.Alt)
+    ]
+};
index ac41b7a..576394e 100644 (file)
@@ -65,7 +65,7 @@ WebInspector.GoToLineDialog.install = function(panel, viewGetter)
     }
 
     var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
-    panel.registerShortcut(goToLineShortcut.key, showGoToLineDialog);
+    panel.registerShortcuts([goToLineShortcut], showGoToLineDialog);
 }
 
 WebInspector.GoToLineDialog._show = function(sourceView)
@@ -75,6 +75,9 @@ WebInspector.GoToLineDialog._show = function(sourceView)
     WebInspector.Dialog.show(sourceView.element, new WebInspector.GoToLineDialog(sourceView));
 }
 
+/**
+ * @return {!WebInspector.KeyboardShortcut.Descriptor}
+ */
 WebInspector.GoToLineDialog.createShortcut = function()
 {
     var isMac = WebInspector.isMac();
index 4c42d92..9a1f520 100644 (file)
@@ -122,6 +122,9 @@ WebInspector.KeyboardShortcut.eventHasCtrlOrMeta = function(event)
     return WebInspector.isMac() ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey;
 }
 
+/** @typedef {{key: number, name: string}} */
+ WebInspector.KeyboardShortcut.Descriptor;
+
 /**
  * @param {number=} modifiers
  */
index d537c4e..3b13140 100644 (file)
@@ -239,14 +239,14 @@ WebInspector.Panel.prototype = {
         }
     },
 
-    registerShortcut: function(key, handler)
-    {
-        this._shortcuts[key] = handler;
-    },
-
-    unregisterShortcut: function(key)
+    /**
+     * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys
+     * @param {function(KeyboardEvent)} handler
+     */
+    registerShortcuts: function(keys, handler)
     {
-        delete this._shortcuts[key];
+        for (var i = 0; i < keys.length; ++i)
+            this._shortcuts[keys[i].key] = handler;
     },
 
     __proto__: WebInspector.View.prototype
@@ -313,5 +313,7 @@ WebInspector.PanelDescriptor.prototype = {
             importScript(this._scriptName);
         this._panel = new WebInspector[this._className];
         return this._panel;
-    }
+    },
+
+    registerShortcuts: function() {}
 }
index 3719388..83b7d94 100644 (file)
@@ -65,7 +65,7 @@ WebInspector.ScriptsPanel = function(workspaceForTest)
     WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
 
     var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));
-    this.debugToolbar = this._createDebugToolbar(helpSection);
+    this.debugToolbar = this._createDebugToolbar();
 
     const initialDebugSidebarWidth = 225;
     const minimumDebugSidebarWidthPercent = 50;
@@ -134,18 +134,10 @@ WebInspector.ScriptsPanel = function(workspaceForTest)
     this.sidebarPanes.scopechain.expanded = true;
     this.sidebarPanes.jsBreakpoints.expanded = true;
 
-    this.sidebarPanes.callstack.registerShortcuts(helpSection, this.registerShortcut.bind(this));
-    var evaluateInConsoleShortcut = WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-    helpSection.addKey(evaluateInConsoleShortcut.name, WebInspector.UIString("Evaluate selection in console"));
-    this.registerShortcut(evaluateInConsoleShortcut.key, this._evaluateSelectionInConsole.bind(this));
-
-    var outlineShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift);
-    helpSection.addKey(outlineShortcut.name, WebInspector.UIString("Go to member"));
-    this.registerShortcut(outlineShortcut.key, this._showOutlineDialog.bind(this));
-
-    var createBreakpointShortcut = WebInspector.KeyboardShortcut.makeDescriptor("b", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);
-    helpSection.addKey(createBreakpointShortcut.name, WebInspector.UIString("Toggle breakpoint"));
-    this.registerShortcut(createBreakpointShortcut.key, this._toggleBreakpoint.bind(this));
+    this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(this));
+    this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.EvaluateSelectionInConsole, this._evaluateSelectionInConsole.bind(this));
+    this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoToMember, this._showOutlineDialog.bind(this));
+    this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.ToggleBreakpoint, this._toggleBreakpoint.bind(this));
 
     var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
     var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
@@ -751,48 +743,36 @@ WebInspector.ScriptsPanel.prototype = {
             WebInspector.evaluateInConsole(selection.toString());
     },
 
-    _createDebugToolbar: function(section)
+    _createDebugToolbar: function()
     {
         var debugToolbar = document.createElement("div");
         debugToolbar.className = "status-bar";
         debugToolbar.id = "scripts-debug-toolbar";
 
-        var title, handler, shortcuts;
+        var title, handler;
         var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
 
         // Continue.
         handler = this._togglePause.bind(this);
-        shortcuts = [];
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8));
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier));
-        this.pauseButton = this._createButtonAndRegisterShortcuts(section, "scripts-pause", "", handler, shortcuts, WebInspector.UIString("Pause/Continue"));
+        this.pauseButton = this._createButtonAndRegisterShortcuts("scripts-pause", "", handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue);
         debugToolbar.appendChild(this.pauseButton);
 
         // Step over.
         title = WebInspector.UIString("Step over next function call (%s).");
         handler = this._stepOverClicked.bind(this);
-        shortcuts = [];
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10));
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, platformSpecificModifier));
-        this.stepOverButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-over", title, handler, shortcuts, WebInspector.UIString("Step over"));
+        this.stepOverButton = this._createButtonAndRegisterShortcuts("scripts-step-over", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver);
         debugToolbar.appendChild(this.stepOverButton);
 
         // Step into.
         title = WebInspector.UIString("Step into next function call (%s).");
         handler = this._stepIntoClicked.bind(this);
-        shortcuts = [];
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11));
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, platformSpecificModifier));
-        this.stepIntoButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-into", title, handler, shortcuts, WebInspector.UIString("Step into"));
+        this.stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-step-into", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto);
         debugToolbar.appendChild(this.stepIntoButton);
 
         // Step out.
         title = WebInspector.UIString("Step out of current function (%s).");
         handler = this._stepOutClicked.bind(this);
-        shortcuts = [];
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift));
-        shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | platformSpecificModifier));
-        this.stepOutButton = this._createButtonAndRegisterShortcuts(section, "scripts-step-out", title, handler, shortcuts, WebInspector.UIString("Step out"));
+        this.stepOutButton = this._createButtonAndRegisterShortcuts("scripts-step-out", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut);
         debugToolbar.appendChild(this.stepOutButton);
 
         this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate breakpoints."), "toggle-breakpoints");
@@ -817,7 +797,13 @@ WebInspector.ScriptsPanel.prototype = {
             button.title = buttonTitle;
     },
 
-    _createButtonAndRegisterShortcuts: function(section, buttonId, buttonTitle, handler, shortcuts, shortcutDescription)
+    /**
+     * @param {string} buttonId
+     * @param {string} buttonTitle
+     * @param {function(Event)} handler
+     * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts
+     */
+    _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler, shortcuts)
     {
         var button = document.createElement("button");
         button.className = "status-bar-item";
@@ -828,12 +814,7 @@ WebInspector.ScriptsPanel.prototype = {
         button.appendChild(document.createElement("img"));
         button.addEventListener("click", handler, false);
 
-        var shortcutNames = [];
-        for (var i = 0; i < shortcuts.length; ++i) {
-            this.registerShortcut(shortcuts[i].key, handler);
-            shortcutNames.push(shortcuts[i].name);
-        }
-        section.addAlternateKeys(shortcutNames, shortcutDescription);
+        this.registerShortcuts(shortcuts, handler);
 
         return button;
     },
index 8f387f6..5e6542d 100644 (file)
@@ -55,5 +55,64 @@ WebInspector.ScriptsPanelDescriptor.prototype = {
         this.panel().appendApplicableItems(event, contextMenu, target);
     },
 
+    registerShortcuts: function()
+    {
+        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));
+
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue, WebInspector.UIString("Pause/Continue"));
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver, WebInspector.UIString("Step over"));
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto, WebInspector.UIString("Step into"));
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut, WebInspector.UIString("Step out"));
+
+        var nextAndPrevFrameKeys = WebInspector.ScriptsPanelDescriptor.ShortcutKeys.NextCallFrame.concat(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCallFrame);
+        section.addRelatedKeys(nextAndPrevFrameKeys, WebInspector.UIString("Next/previous call frame"));
+
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.EvaluateSelectionInConsole, WebInspector.UIString("Evaluate selection in console"));
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoToMember, WebInspector.UIString("Go to member"));
+        section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.ToggleBreakpoint, WebInspector.UIString("Toggle breakpoint"));
+    },
+
     __proto__: WebInspector.PanelDescriptor.prototype
 }
+
+WebInspector.ScriptsPanelDescriptor.ShortcutKeys = {
+    PauseContinue: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8),
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    StepOver: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10),
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    StepInto: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11),
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    StepOut: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift),
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    EvaluateSelectionInConsole: [
+        WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.Ctrl)
+    ],
+
+    GoToMember: [
+        WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift)
+    ],
+
+    ToggleBreakpoint: [
+        WebInspector.KeyboardShortcut.makeDescriptor("b", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    NextCallFrame: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period, WebInspector.KeyboardShortcut.Modifiers.Ctrl)
+    ],
+
+    PrevCallFrame: [
+        WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma, WebInspector.KeyboardShortcut.Modifiers.Ctrl)
+    ]
+};
index 84d852e..ddf92ad 100644 (file)
  */
 WebInspector.ShortcutsScreen = function()
 {
-    this._sections = {};
+    this._sections = /** @type {Object.<string, !WebInspector.ShortcutsSection>} */ ({});
 }
 
 WebInspector.ShortcutsScreen.prototype = {
+    /**
+     * @param {string} name
+     * @return {!WebInspector.ShortcutsSection}
+     */
     section: function(name)
     {
         var section = this._sections[name];
@@ -45,6 +49,9 @@ WebInspector.ShortcutsScreen.prototype = {
         return section;
     },
 
+    /**
+     * @return {!WebInspector.View}
+     */
     createShortcutsTabView: function()
     {
         var orderedSections = [];
@@ -75,32 +82,49 @@ WebInspector.shortcutsScreen = null;
 
 /**
  * @constructor
+ * @param {string} name
  */
 WebInspector.ShortcutsSection = function(name)
 {
     this.name = name;
-    this._lines = [];
+    this._lines = /** @type {!Array.<{key: !Node, text: string}>} */ ([]);
     this.order = ++WebInspector.ShortcutsSection._sequenceNumber;
 };
 
 WebInspector.ShortcutsSection._sequenceNumber = 0;
 
 WebInspector.ShortcutsSection.prototype = {
+    /**
+     * @param {!WebInspector.KeyboardShortcut.Descriptor} key
+     * @param {string} description
+     */
     addKey: function(key, description)
     {
         this._addLine(this._renderKey(key), description);
     },
 
+    /**
+     * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys
+     * @param {string} description
+     */
     addRelatedKeys: function(keys, description)
     {
         this._addLine(this._renderSequence(keys, "/"), description);
     },
 
+    /**
+     * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys
+     * @param {string} description
+     */
     addAlternateKeys: function(keys, description)
     {
         this._addLine(this._renderSequence(keys, WebInspector.UIString("or")), description);
     },
 
+    /**
+     * @param {!Node} keyElement
+     * @param {string} description
+     */
     _addLine: function(keyElement, description)
     {
         this._lines.push({ key: keyElement, text: description })
@@ -126,18 +150,33 @@ WebInspector.ShortcutsSection.prototype = {
         }
     },
 
+    /**
+     * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} sequence
+     * @param {string} delimiter
+     * @return {!Node}
+     */
     _renderSequence: function(sequence, delimiter)
     {
         var delimiterSpan = this._createSpan("help-key-delimiter", delimiter);
         return this._joinNodes(sequence.map(this._renderKey.bind(this)), delimiterSpan);
     },
 
+    /**
+     * @param {!WebInspector.KeyboardShortcut.Descriptor} key
+     * @return {!Node}
+     */
     _renderKey: function(key)
     {
+        var keyName = key.name;
         var plus = this._createSpan("help-combine-keys", "+");
-        return this._joinNodes(key.split(" + ").map(this._createSpan.bind(this, "help-key monospace")), plus);
+        return this._joinNodes(keyName.split(" + ").map(this._createSpan.bind(this, "help-key monospace")), plus);
     },
 
+    /**
+     * @param {string} className
+     * @param {string} textContent
+     * @return {!Element}
+     */
     _createSpan: function(className, textContent)
     {
         var node = document.createElement("span");
@@ -146,6 +185,11 @@ WebInspector.ShortcutsSection.prototype = {
         return node;
     },
 
+    /**
+     * @param {!Array.<!Element>} nodes
+     * @param {!Element} delimiter
+     * @return {!Node}
+     */
     _joinNodes: function(nodes, delimiter)
     {
         var result = document.createDocumentFragment();
index 29b0e92..f7196a1 100644 (file)
@@ -693,42 +693,6 @@ WebInspector.StylesSidebarPane.prototype = {
         }
     },
 
-    registerShortcuts: function()
-    {
-        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Styles Pane"));
-        var shortcut = WebInspector.KeyboardShortcut;
-        var keys = [
-            shortcut.shortcutToString(shortcut.Keys.Tab),
-            shortcut.shortcutToString(shortcut.Keys.Tab, shortcut.Modifiers.Shift)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Next/previous property"));
-        keys = [
-            shortcut.shortcutToString(shortcut.Keys.Up),
-            shortcut.shortcutToString(shortcut.Keys.Down)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement value"));
-        keys = [
-            shortcut.shortcutToString(shortcut.Keys.Up, shortcut.Modifiers.Shift),
-            shortcut.shortcutToString(shortcut.Keys.Down, shortcut.Modifiers.Shift)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 10));
-        keys = [
-            shortcut.shortcutToString(shortcut.Keys.PageUp),
-            shortcut.shortcutToString(shortcut.Keys.PageDown)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 10));
-        keys = [
-            shortcut.shortcutToString(shortcut.Keys.PageUp, shortcut.Modifiers.Shift),
-            shortcut.shortcutToString(shortcut.Keys.PageDown, shortcut.Modifiers.Shift)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 100));
-        keys = [
-            shortcut.shortcutToString(shortcut.Keys.PageUp, shortcut.Modifiers.Alt),
-            shortcut.shortcutToString(shortcut.Keys.PageDown, shortcut.Modifiers.Alt)
-        ];
-        section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 0.1));
-    },
-
     _toggleElementStatePane: function(event)
     {
         event.consume();
index 0bf4a30..dd7fb68 100644 (file)
@@ -311,20 +311,10 @@ WebInspector.TimelinePanel.prototype = {
 
     _registerShortcuts: function()
     {
-        var shortcut = WebInspector.KeyboardShortcut;
-        var modifiers = shortcut.Modifiers;
-        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel"));
-
-        this._shortcuts[shortcut.makeKey("e", modifiers.CtrlOrMeta)] = this._toggleTimelineButtonClicked.bind(this);
-        section.addKey(shortcut.shortcutToString("e", modifiers.CtrlOrMeta), WebInspector.UIString("Start/stop recording"));
-
-        if (InspectorFrontendHost.canSave()) {
-            this._shortcuts[shortcut.makeKey("s", modifiers.CtrlOrMeta)] = this._saveToFile.bind(this);
-            section.addKey(shortcut.shortcutToString("s", modifiers.CtrlOrMeta), WebInspector.UIString("Save timeline data"));
-        }
-
-        this._shortcuts[shortcut.makeKey("o", modifiers.CtrlOrMeta)] = this._fileSelectorElement.click.bind(this._fileSelectorElement);
-        section.addKey(shortcut.shortcutToString("o", modifiers.CtrlOrMeta), WebInspector.UIString("Load timeline data"));
+        this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording, this._toggleTimelineButtonClicked.bind(this));
+        if (InspectorFrontendHost.canSave())
+            this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile, this._saveToFile.bind(this));
+        this.registerShortcuts(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, this._fileSelectorElement.click.bind(this._fileSelectorElement));
     },
 
     _createFileSelector: function()
diff --git a/Source/WebCore/inspector/front-end/TimelinePanelDescriptor.js b/Source/WebCore/inspector/front-end/TimelinePanelDescriptor.js
new file mode 100644 (file)
index 0000000..5834f0d
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends {WebInspector.PanelDescriptor}
+ */
+WebInspector.TimelinePanelDescriptor = function()
+{
+    WebInspector.PanelDescriptor.call(this, "timeline", WebInspector.UIString("Timeline"), "TimelinePanel", "TimelinePanel.js");
+}
+
+WebInspector.TimelinePanelDescriptor.prototype = {
+    registerShortcuts: function()
+    {
+        var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel"));
+        section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.StartStopRecording, WebInspector.UIString("Start/stop recording"));
+        if (InspectorFrontendHost.canSave())
+            section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.SaveToFile, WebInspector.UIString("Save timeline data"));
+        section.addAlternateKeys(WebInspector.TimelinePanelDescriptor.ShortcutKeys.LoadFromFile, WebInspector.UIString("Load timeline data"));
+    },
+
+    __proto__: WebInspector.PanelDescriptor.prototype
+}
+
+WebInspector.TimelinePanelDescriptor.ShortcutKeys = {
+    StartStopRecording: [
+        WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    SaveToFile: [
+        WebInspector.KeyboardShortcut.makeDescriptor("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ],
+
+    LoadFromFile: [
+        WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)
+    ]
+}
index 9ae6cc7..313442c 100644 (file)
     <file>TimelineGrid.js</file>
     <file>TimelineOverviewPane.js</file>
     <file>TimelinePanel.js</file>
+    <file>TimelinePanelDescriptor.js</file>
     <file>Toolbar.js</file>
     <file>TopDownProfileDataGridTree.js</file>
     <file>treeoutline.js</file>
index 979a7b4..d2bc65a 100644 (file)
@@ -168,6 +168,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="ElementsPanelDescriptor.js"></script>
     <script type="text/javascript" src="NetworkPanelDescriptor.js"></script>
     <script type="text/javascript" src="ScriptsPanelDescriptor.js"></script>
+    <script type="text/javascript" src="TimelinePanelDescriptor.js"></script>
     <script type="text/javascript" src="DockController.js"></script>
 </head>
 <body class="undocked" id="-webkit-web-inspector">
index 6fbf7bd..7e0934b 100644 (file)
@@ -41,7 +41,7 @@ var WebInspector = {
         var resources = new WebInspector.PanelDescriptor("resources", WebInspector.UIString("Resources"), "ResourcesPanel", "ResourcesPanel.js");
         var network = new WebInspector.NetworkPanelDescriptor();
         var scripts = new WebInspector.ScriptsPanelDescriptor();
-        var timeline = new WebInspector.PanelDescriptor("timeline", WebInspector.UIString("Timeline"), "TimelinePanel", "TimelinePanel.js");
+        var timeline = new WebInspector.TimelinePanelDescriptor();
         var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
         var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js");
         var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel");
@@ -55,7 +55,6 @@ var WebInspector = {
             panelDescriptors.push(console);
             return panelDescriptors;
         }
-        var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console];
         var hiddenPanels = InspectorFrontendHost.hiddenPanels();
         for (var i = 0; i < allDescriptors.length; ++i) {
             if (hiddenPanels.indexOf(allDescriptors[i].name()) === -1)
@@ -386,6 +385,10 @@ WebInspector._doLoadedDoneWithCapabilities = function()
     WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));
     WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));
 
+    var panelDescriptors = this._panelDescriptors();
+    for (var i = 0; i < panelDescriptors.length; ++i)
+        panelDescriptors[i].registerShortcuts();
+
     this.console = new WebInspector.ConsoleModel();
     this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._updateErrorAndWarningCounts, this);
     this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this);
@@ -447,7 +450,6 @@ WebInspector._doLoadedDoneWithCapabilities = function()
 
     this.toolbar = new WebInspector.Toolbar();
     WebInspector.startBatchUpdate();
-    var panelDescriptors = this._panelDescriptors();
     for (var i = 0; i < panelDescriptors.length; ++i)
         WebInspector.inspectorView.addPanel(panelDescriptors[i]);
     WebInspector.endBatchUpdate();
@@ -618,36 +620,36 @@ WebInspector._registerShortcuts = function()
     var shortcut = WebInspector.KeyboardShortcut;
     var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("All Panels"));
     var keys = [
-        shortcut.shortcutToString("]", shortcut.Modifiers.CtrlOrMeta),
-        shortcut.shortcutToString("[", shortcut.Modifiers.CtrlOrMeta)
+        shortcut.makeDescriptor("]", shortcut.Modifiers.CtrlOrMeta),
+        shortcut.makeDescriptor("[", shortcut.Modifiers.CtrlOrMeta)
     ];
     section.addRelatedKeys(keys, WebInspector.UIString("Go to the panel to the left/right"));
 
     var keys = [
-        shortcut.shortcutToString("[", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt),
-        shortcut.shortcutToString("]", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt)
+        shortcut.makeDescriptor("[", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt),
+        shortcut.makeDescriptor("]", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Alt)
     ];
     section.addRelatedKeys(keys, WebInspector.UIString("Go back/forward in panel history"));
 
-    section.addKey(shortcut.shortcutToString(shortcut.Keys.Esc), WebInspector.UIString("Toggle console"));
-    section.addKey(shortcut.shortcutToString("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search"));
+    section.addKey(shortcut.makeDescriptor(shortcut.Keys.Esc), WebInspector.UIString("Toggle console"));
+    section.addKey(shortcut.makeDescriptor("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search"));
 
     var advancedSearchShortcut = WebInspector.AdvancedSearchController.createShortcut();
-    section.addKey(advancedSearchShortcut.name, WebInspector.UIString("Search across all sources"));
+    section.addKey(advancedSearchShortcut, WebInspector.UIString("Search across all sources"));
 
     var openResourceShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);
-    section.addKey(openResourceShortcut.name, WebInspector.UIString("Go to source"));
+    section.addKey(openResourceShortcut, WebInspector.UIString("Go to source"));
 
     if (WebInspector.isMac()) {
         keys = [
-            shortcut.shortcutToString("g", shortcut.Modifiers.Meta),
-            shortcut.shortcutToString("g", shortcut.Modifiers.Meta | shortcut.Modifiers.Shift)
+            shortcut.makeDescriptor("g", shortcut.Modifiers.Meta),
+            shortcut.makeDescriptor("g", shortcut.Modifiers.Meta | shortcut.Modifiers.Shift)
         ];
         section.addRelatedKeys(keys, WebInspector.UIString("Find next/previous"));
     }
 
     var goToShortcut = WebInspector.GoToLineDialog.createShortcut();
-    section.addKey(goToShortcut.name, WebInspector.UIString("Go to line"));
+    section.addKey(goToShortcut, WebInspector.UIString("Go to line"));
 }
 
 WebInspector.documentKeyDown = function(event)