Title: [192764] trunk/Source/WebInspectorUI
Revision
192764
Author
[email protected]
Date
2015-11-24 10:22:03 -0800 (Tue, 24 Nov 2015)

Log Message

Web Inspector: Cmd-1 to Cmd-9 shortcuts should select tabs by ordinal
https://bugs.webkit.org/show_bug.cgi?id=151577

Reviewed by Timothy Hatcher.

The shortcuts only work if a tab at the specified ordinal exists.

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (192763 => 192764)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-11-24 12:40:57 UTC (rev 192763)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-11-24 18:22:03 UTC (rev 192764)
@@ -1,3 +1,15 @@
+2015-11-24  Brian Burg  <[email protected]>
+
+        Web Inspector: Cmd-1 to Cmd-9 shortcuts should select tabs by ordinal
+        https://bugs.webkit.org/show_bug.cgi?id=151577
+
+        Reviewed by Timothy Hatcher.
+
+        The shortcuts only work if a tab at the specified ordinal exists.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.contentLoaded):
+
 2015-11-23  Brian Burg  <[email protected]>
 
         Web Inspector: Add a keyboard shortcut to restore the default zoom level

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (192763 => 192764)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-11-24 12:40:57 UTC (rev 192763)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-11-24 18:22:03 UTC (rev 192764)
@@ -251,6 +251,8 @@
     this._decreaseZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, WebInspector.KeyboardShortcut.Key.Minus, this._decreaseZoom.bind(this));
     this._resetZoomKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "0", this._resetZoom.bind(this));
 
+    this._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, `${i}`, this._showTabAtIndex.bind(this, i)));
+
     this.tabBrowser = new WebInspector.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
     this.tabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
 
@@ -1851,6 +1853,13 @@
     event.preventDefault();
 };
 
+WebInspector._showTabAtIndex = function(i, event) {
+    if (i <= WebInspector.tabBar.tabBarItems.length)
+        WebInspector.tabBar.selectedTabBarItem = i - 1;
+
+    event.preventDefault();
+}
+
 WebInspector.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor, eventTarget)
 {
     if (WebInspector._elementDraggingEventListener || WebInspector._elementEndDraggingEventListener)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to