Title: [201671] trunk/Source/WebInspectorUI
Revision
201671
Author
[email protected]
Date
2016-06-03 17:04:52 -0700 (Fri, 03 Jun 2016)

Log Message

Web Inspector: add a keyboard shortcut to close the current tab bar item
https://bugs.webkit.org/show_bug.cgi?id=158363
<rdar://problem/22677254>

Reviewed by Timothy Hatcher.

Make Cmd-w close the current tab. This matches Safari's keyboard shortcut.

* UserInterface/Views/TabBrowser.js:
(WebInspector.TabBrowser):
Don't do anything if the New Tab tab is the only tab bar item besides the
pinned "new tab" button.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (201670 => 201671)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-06-03 23:51:25 UTC (rev 201670)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-06-04 00:04:52 UTC (rev 201671)
@@ -1,5 +1,20 @@
 2016-06-03  Brian Burg  <[email protected]>
 
+        Web Inspector: add a keyboard shortcut to close the current tab bar item
+        https://bugs.webkit.org/show_bug.cgi?id=158363
+        <rdar://problem/22677254>
+
+        Reviewed by Timothy Hatcher.
+
+        Make Cmd-w close the current tab. This matches Safari's keyboard shortcut.
+
+        * UserInterface/Views/TabBrowser.js:
+        (WebInspector.TabBrowser):
+        Don't do anything if the New Tab tab is the only tab bar item besides the
+        pinned "new tab" button.
+
+2016-06-03  Brian Burg  <[email protected]>
+
         Web Inspector: setter for debugging flag InspectorBackend.dumpInspectorTimeStats does not work
         https://bugs.webkit.org/show_bug.cgi?id=158366
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js (201670 => 201671)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js	2016-06-03 23:51:25 UTC (rev 201670)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js	2016-06-04 00:04:52 UTC (rev 201671)
@@ -48,9 +48,16 @@
         this._contentViewContainer = new WebInspector.ContentViewContainer;
         this.addSubview(this._contentViewContainer);
 
-        var showNextTab = this._showNextTab.bind(this);
-        var showPreviousTab = this._showPreviousTab.bind(this);
+        let showNextTab = () => { this._showNextTab(); }
+        let showPreviousTab = () => { this._showPreviousTab(); }
+        let closeCurrentTab = () => {
+            let selectedTabBarItem = this._tabBar.selectedTabBarItem;
+            if (this._tabBar.tabBarItems.length > 2 || !selectedTabBarItem.isDefaultTab)
+                this._tabBar.removeTabBarItem(selectedTabBarItem);
+        }
 
+        this._closeCurrentTabKeyboardShortuct = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "W", closeCurrentTab);
+
         this._showNextTabKeyboardShortcut1 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, WebInspector.KeyboardShortcut.Key.RightCurlyBrace, showNextTab);
         this._showPreviousTabKeyboardShortcut1 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, WebInspector.KeyboardShortcut.Key.LeftCurlyBrace, showPreviousTab);
         this._showNextTabKeyboardShortcut2 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, WebInspector.KeyboardShortcut.Key.Tab, showNextTab);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to