Modified: trunk/Source/WebInspectorUI/ChangeLog (201691 => 201692)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-06-05 00:36:55 UTC (rev 201691)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-06-05 00:59:40 UTC (rev 201692)
@@ -1,3 +1,26 @@
+2016-06-04 Brian Burg <[email protected]>
+
+ Web Inspector: add a keyboard shortcut to open the new tab tab
+ https://bugs.webkit.org/show_bug.cgi?id=158365
+ <rdar://problem/26631897>
+
+ Reviewed by Timothy Hatcher.
+
+ Make Cmd-t show the new tab tab if it's not already open and
+ there is at least one tab type that's not currently in the tab bar.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector.contentLoaded):
+ (WebInspector._updateNewTabButtonState):
+ (WebInspector.showNewTabTab):
+ (WebInspector.isNewTabWithTypeAllowed):
+ Clean up the code that decides whether we can show the new tab tab.
+ It is now a special case inside WebInspector.isNewTabWithTypeAllowed.
+
+ * UserInterface/Views/NewTabContentView.js:
+ (WebInspector.NewTabContentView.prototype._updateShownTabs):
+ Use Array.from.
+
2016-06-04 Matt Baker <[email protected]>
Web Inspector: discontinuous recordings should have discontinuities in the timeline memory graph
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (201691 => 201692)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2016-06-05 00:36:55 UTC (rev 201691)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2016-06-05 00:59:40 UTC (rev 201692)
@@ -268,6 +268,7 @@
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._openNewTabKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "T", this.showNewTabTab.bind(this));
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);
@@ -520,10 +521,7 @@
WebInspector._updateNewTabButtonState = function(event)
{
- let allTabs = [...this._knownTabClassesByType.values()];
- let addableTabs = allTabs.filter((tabClass) => !tabClass.isEphemeral());
- let canMakeNewTab = addableTabs.some((tabClass) => this.isNewTabWithTypeAllowed(tabClass.Type));
- this.tabBar.newTabItem.disabled = !canMakeNewTab;
+ this.tabBar.newTabItem.disabled = this.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type);
};
WebInspector._newTabItemClicked = function(event)
@@ -562,6 +560,9 @@
WebInspector.showNewTabTab = function(shouldAnimate)
{
+ if (!this.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type))
+ return;
+
let tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.NewTabContentView);
if (!tabContentView)
tabContentView = new WebInspector.NewTabContentView;
@@ -583,6 +584,13 @@
return false;
}
+ if (tabClass === WebInspector.NewTabContentView) {
+ let allTabs = Array.from(this.knownTabClasses());
+ let addableTabs = allTabs.filter((tabClass) => !tabClass.isEphemeral());
+ let canMakeNewTab = addableTabs.some((tabClass) => WebInspector.isNewTabWithTypeAllowed(tabClass.Type));
+ return canMakeNewTab;
+ }
+
return true;
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js (201691 => 201692)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js 2016-06-05 00:36:55 UTC (rev 201691)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js 2016-06-05 00:59:40 UTC (rev 201692)
@@ -130,7 +130,7 @@
_updateShownTabs()
{
- let allTabClasses = [...WebInspector.knownTabClasses()];
+ let allTabClasses = Array.from(WebInspector.knownTabClasses());
let allowedTabClasses = allTabClasses.filter((tabClass) => tabClass.isTabAllowed() && !tabClass.isEphemeral());
allowedTabClasses.sort((a, b) => a.tabInfo().title.localeCompare(b.tabInfo().title));