<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183468] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183468">183468</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2015-04-28 06:04:38 -0700 (Tue, 28 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Add new tab button to make it easy to bring a closed tab back
https://bugs.webkit.org/show_bug.cgi?id=144297
Reviewed by Joseph Pecoraro.
* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
(WebInspector.isTabTypeAllowed):
(WebInspector._tabContentViewForType):
(WebInspector._rememberOpenTabs):
(WebInspector._updateNewTabButtonState):
(WebInspector._newTabItemClicked):
(WebInspector.isNewTabWithTypeAllowed):
(WebInspector.createNewTab):
(WebInspector.activateExtraDomains):
(WebInspector._restoreCookieForOpenTabs):
(WebInspector._saveCookieForOpenTabs):
(WebInspector._isTabTypeAllowed): Deleted.
* UserInterface/Images/NewTab.svg: Added.
* UserInterface/Images/NewTabPlus.svg:
* UserInterface/Main.html:
* UserInterface/Views/NewTabContentView.css: Added.
(.new-tab.tab.content-view):
(.new-tab.tab.content-view > .tab-item):
(.new-tab.tab.content-view > .tab-item.disabled):
(.new-tab.tab.content-view > .tab-item > .box):
(.new-tab.tab.content-view > .tab-item:not(.disabled):active > .box):
(.new-tab.tab.content-view > .tab-item > .box > img):
(.new-tab.tab.content-view > .tab-item > label):
* UserInterface/Views/NewTabContentView.js: Added.
(WebInspector.NewTabContentView):
(WebInspector.NewTabContentView.prototype.get type):
(WebInspector.NewTabContentView.prototype._createNewTab):
* UserInterface/Views/TabBar.css:
(.tab-bar > .item:not(.disabled).selected):
(.tab-bar > .item.new-tab-button:not(.disabled):hover):
(.tab-bar:not(.animating) > .item:not(.selected, .disabled):hover + .item):
(.tab-bar > .item.disabled > .icon):
(.tab-bar > .item.new-tab-button:not(.disabled):hover > .icon):
(.tab-bar > .item.selected): Deleted.
(.tab-bar > .item.new-tab-button:hover): Deleted.
(.tab-bar:not(.animating) > .item:not(.selected):hover + .item): Deleted.
(.tab-bar > .item.new-tab-button:hover > .icon): Deleted.
* UserInterface/Views/TabBar.js:
(WebInspector.TabBar.prototype.set selectedTabBarItem):
(WebInspector.TabBar.prototype._handleMouseDown):
* UserInterface/Views/TabBarItem.js:
(WebInspector.TabBarItem.prototype.get disabled):
(WebInspector.TabBarItem.prototype.set disabled):
* UserInterface/Views/TabBrowser.js:
(WebInspector.TabBrowser):
(WebInspector.TabBrowser.prototype.addTabForContentView):
(WebInspector.TabBrowser.prototype.showTabForContentView):
(WebInspector.TabBrowser.prototype.closeTabForContentView):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceImagesNewTabPlussvg">trunk/Source/WebInspectorUI/UserInterface/Images/NewTabPlus.svg</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTabBarcss">trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTabBarjs">trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTabBarItemjs">trunk/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTabBrowserjs">trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceImagesNewTabsvg">trunk/Source/WebInspectorUI/UserInterface/Images/NewTab.svg</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNewTabContentViewcss">trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNewTabContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2015-04-27 Timothy Hatcher <timothy@apple.com>
+
+ Web Inspector: Add new tab button to make it easy to bring a closed tab back
+ https://bugs.webkit.org/show_bug.cgi?id=144297
+
+ Reviewed by Joseph Pecoraro.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Base/Main.js:
+ (WebInspector.contentLoaded):
+ (WebInspector.isTabTypeAllowed):
+ (WebInspector._tabContentViewForType):
+ (WebInspector._rememberOpenTabs):
+ (WebInspector._updateNewTabButtonState):
+ (WebInspector._newTabItemClicked):
+ (WebInspector.isNewTabWithTypeAllowed):
+ (WebInspector.createNewTab):
+ (WebInspector.activateExtraDomains):
+ (WebInspector._restoreCookieForOpenTabs):
+ (WebInspector._saveCookieForOpenTabs):
+ (WebInspector._isTabTypeAllowed): Deleted.
+ * UserInterface/Images/NewTab.svg: Added.
+ * UserInterface/Images/NewTabPlus.svg:
+ * UserInterface/Main.html:
+ * UserInterface/Views/NewTabContentView.css: Added.
+ (.new-tab.tab.content-view):
+ (.new-tab.tab.content-view > .tab-item):
+ (.new-tab.tab.content-view > .tab-item.disabled):
+ (.new-tab.tab.content-view > .tab-item > .box):
+ (.new-tab.tab.content-view > .tab-item:not(.disabled):active > .box):
+ (.new-tab.tab.content-view > .tab-item > .box > img):
+ (.new-tab.tab.content-view > .tab-item > label):
+ * UserInterface/Views/NewTabContentView.js: Added.
+ (WebInspector.NewTabContentView):
+ (WebInspector.NewTabContentView.prototype.get type):
+ (WebInspector.NewTabContentView.prototype._createNewTab):
+ * UserInterface/Views/TabBar.css:
+ (.tab-bar > .item:not(.disabled).selected):
+ (.tab-bar > .item.new-tab-button:not(.disabled):hover):
+ (.tab-bar:not(.animating) > .item:not(.selected, .disabled):hover + .item):
+ (.tab-bar > .item.disabled > .icon):
+ (.tab-bar > .item.new-tab-button:not(.disabled):hover > .icon):
+ (.tab-bar > .item.selected): Deleted.
+ (.tab-bar > .item.new-tab-button:hover): Deleted.
+ (.tab-bar:not(.animating) > .item:not(.selected):hover + .item): Deleted.
+ (.tab-bar > .item.new-tab-button:hover > .icon): Deleted.
+ * UserInterface/Views/TabBar.js:
+ (WebInspector.TabBar.prototype.set selectedTabBarItem):
+ (WebInspector.TabBar.prototype._handleMouseDown):
+ * UserInterface/Views/TabBarItem.js:
+ (WebInspector.TabBarItem.prototype.get disabled):
+ (WebInspector.TabBarItem.prototype.set disabled):
+ * UserInterface/Views/TabBrowser.js:
+ (WebInspector.TabBrowser):
+ (WebInspector.TabBrowser.prototype.addTabForContentView):
+ (WebInspector.TabBrowser.prototype.showTabForContentView):
+ (WebInspector.TabBrowser.prototype.closeTabForContentView):
+
</ins><span class="cx"> 2015-04-27 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Cannot scroll Timeline Overview horizontally, scrollbar cannot be interacted with
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -314,6 +314,7 @@
</span><span class="cx"> localizedStrings["Network Issue"] = "Network Issue";
</span><span class="cx"> localizedStrings["Network Requests"] = "Network Requests";
</span><span class="cx"> localizedStrings["New Rule"] = "New Rule";
</span><ins>+localizedStrings["New Tab"] = "New Tab";
</ins><span class="cx"> localizedStrings["No"] = "No";
</span><span class="cx"> localizedStrings["No Accessibility Information"] = "No Accessibility Information";
</span><span class="cx"> localizedStrings["No Application Cache information available"] = "No Application Cache information available";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -197,6 +197,7 @@
</span><span class="cx"> this.toolbar.sizeMode = WebInspector.Toolbar.SizeMode.Small;
</span><span class="cx">
</span><span class="cx"> this.tabBar = new WebInspector.TabBar(document.getElementById("tab-bar"));
</span><ins>+ this.tabBar.addEventListener(WebInspector.TabBar.Event.NewTabItemClicked, this._newTabItemClicked, this);
</ins><span class="cx">
</span><span class="cx"> var contentElement = document.getElementById("content");
</span><span class="cx"> contentElement.setAttribute("role", "main");
</span><span class="lines">@@ -228,6 +229,9 @@
</span><span class="cx"> this.tabBrowser = new WebInspector.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
</span><span class="cx"> this.tabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
</span><span class="cx">
</span><ins>+ this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._updateNewTabButtonState, this);
+ this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved, this._updateNewTabButtonState, this);
+
</ins><span class="cx"> this._reloadPageKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "R", this._reloadPage.bind(this));
</span><span class="cx"> this._reloadPageIgnoringCacheKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "R", this._reloadPageIgnoringCache.bind(this));
</span><span class="cx">
</span><span class="lines">@@ -329,7 +333,7 @@
</span><span class="cx"> this._pendingOpenTabTypes = [];
</span><span class="cx">
</span><span class="cx"> for (var tabType of this._openTabsSetting.value) {
</span><del>- if (!this._isTabTypeAllowed(tabType)) {
</del><ins>+ if (!this.isTabTypeAllowed(tabType)) {
</ins><span class="cx"> this._pendingOpenTabTypes.push(tabType);
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="lines">@@ -369,7 +373,7 @@
</span><span class="cx"> this.runBootstrapOperations();
</span><span class="cx"> };
</span><span class="cx">
</span><del>-WebInspector._isTabTypeAllowed = function(tabType)
</del><ins>+WebInspector.isTabTypeAllowed = function(tabType)
</ins><span class="cx"> {
</span><span class="cx"> switch (tabType) {
</span><span class="cx"> case WebInspector.ElementsTabContentView.Type:
</span><span class="lines">@@ -396,6 +400,8 @@
</span><span class="cx"> return new WebInspector.ConsoleTabContentView;
</span><span class="cx"> case WebInspector.SearchTabContentView.Type:
</span><span class="cx"> return new WebInspector.SearchTabContentView;
</span><ins>+ case WebInspector.NewTabTabContentView.Type:
+ return new WebInspector.NewTabTabContentView;
</ins><span class="cx"> default:
</span><span class="cx"> console.error("Unknown tab type", tabType);
</span><span class="cx"> }
</span><span class="lines">@@ -409,8 +415,10 @@
</span><span class="cx">
</span><span class="cx"> for (var tabBarItem of this.tabBar.tabBarItems) {
</span><span class="cx"> var tabContentView = tabBarItem.representedObject;
</span><del>- if (tabContentView instanceof WebInspector.SettingsTabContentView)
</del><ins>+ if (!(tabContentView instanceof WebInspector.TabContentView))
</ins><span class="cx"> continue;
</span><ins>+ if (tabContentView instanceof WebInspector.SettingsTabContentView || tabContentView instanceof WebInspector.NewTabContentView)
+ continue;
</ins><span class="cx"> console.assert(tabContentView.type, "Tab type can't be null, undefined, or empty string", tabContentView.type, tabContentView);
</span><span class="cx"> openTabs.push(tabContentView.type);
</span><span class="cx"> }
</span><span class="lines">@@ -418,6 +426,53 @@
</span><span class="cx"> this._openTabsSetting.value = openTabs;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+WebInspector._updateNewTabButtonState = function(event)
+{
+ var newTabAllowed = this.isNewTabWithTypeAllowed(WebInspector.ConsoleTabContentView.Type) || this.isNewTabWithTypeAllowed(WebInspector.ElementsTabContentView.Type);
+ this.tabBar.newTabItem.disabled = !newTabAllowed;
+};
+
+WebInspector._newTabItemClicked = function(event)
+{
+ var tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.NewTabContentView);
+ if (!tabContentView)
+ tabContentView = new WebInspector.NewTabContentView;
+ this.tabBrowser.showTabForContentView(tabContentView);
+};
+
+WebInspector.isNewTabWithTypeAllowed = function(tabType)
+{
+ if (!this.isTabTypeAllowed(tabType))
+ return false;
+
+ // Only allow one tab per class for now.
+ for (var tabBarItem of this.tabBar.tabBarItems) {
+ var tabContentView = tabBarItem.representedObject;
+ if (!(tabContentView instanceof WebInspector.TabContentView))
+ continue;
+ if (tabContentView.type === tabType)
+ return false;
+ }
+
+ return true;
+};
+
+WebInspector.createNewTab = function(tabType, newTabContentViewToReplace)
+{
+ console.assert(this.isNewTabWithTypeAllowed(tabType));
+
+ var tabContentView = this._tabContentViewForType(tabType);
+
+ if (newTabContentViewToReplace) {
+ var insertionIndex = this.tabBar.tabBarItems.indexOf(newTabContentViewToReplace.tabBarItem);
+ this.tabBrowser.closeTabForContentView(newTabContentViewToReplace, true);
+ this.tabBrowser.showTabForContentView(tabContentView, true, insertionIndex);
+ return;
+ }
+
+ this.tabBrowser.showTabForContentView(tabContentView);
+};
+
</ins><span class="cx"> WebInspector.activateExtraDomains = function(domains)
</span><span class="cx"> {
</span><span class="cx"> this.hasExtraDomains = true;
</span><span class="lines">@@ -437,7 +492,7 @@
</span><span class="cx">
</span><span class="cx"> var stillPendingOpenTabTypes = [];
</span><span class="cx"> for (var tabType of this._pendingOpenTabTypes) {
</span><del>- if (!this._isTabTypeAllowed(tabType)) {
</del><ins>+ if (!this.isTabTypeAllowed(tabType)) {
</ins><span class="cx"> stillPendingOpenTabTypes.push(tabType);
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="lines">@@ -1061,6 +1116,8 @@
</span><span class="cx"> {
</span><span class="cx"> for (var tabBarItem of this.tabBar.tabBarItems) {
</span><span class="cx"> var tabContentView = tabBarItem.representedObject;
</span><ins>+ if (!(tabContentView instanceof WebInspector.TabContentView))
+ continue;
</ins><span class="cx"> tabContentView.restoreStateFromCookie(causedByReload);
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="lines">@@ -1069,6 +1126,8 @@
</span><span class="cx"> {
</span><span class="cx"> for (var tabBarItem of this.tabBar.tabBarItems) {
</span><span class="cx"> var tabContentView = tabBarItem.representedObject;
</span><ins>+ if (!(tabContentView instanceof WebInspector.TabContentView))
+ continue;
</ins><span class="cx"> tabContentView.saveStateToCookie();
</span><span class="cx"> }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceImagesNewTabsvg"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Images/NewTab.svg (0 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Images/NewTab.svg         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/NewTab.svg        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
+ <rect x="0.5" y="0.5" width="15" height="15" rx="2" class="stroked" fill="none" stroke="black"/>
+ <path d="M 8 3 L 8 13 M 3 8 L 13 8" class="stroked" fill="none" stroke="black"/>
+</svg>
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceImagesNewTabPlussvg"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Images/NewTabPlus.svg (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Images/NewTabPlus.svg        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/NewTabPlus.svg        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> <?xml version="1.0" encoding="utf-8"?>
</span><span class="cx"> <!-- Copyright © 2015 Apple Inc. All rights reserved. -->
</span><span class="cx"> <svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
</span><del>- <path d="M 8 2 L 8 13 M 2.5 7.5 L 13.5 7.5" class="stroked" fill="none" stroke="black"/>
</del><ins>+ <path d="M 8 2 L 8 14 M 2 8 L 14 8" class="stroked" fill="none" stroke="black"/>
</ins><span class="cx"> </svg>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx"> <link rel="stylesheet" href="Views/NavigationSidebarPanel.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/NetworkTimelineOverviewGraph.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/NetworkTimelineView.css">
</span><ins>+ <link rel="stylesheet" href="Views/NewTabContentView.css">
</ins><span class="cx"> <link rel="stylesheet" href="Views/ObjectPreviewView.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/ObjectTreeArrayIndexTreeElement.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/ObjectTreeMapEntryTreeElement.css">
</span><span class="lines">@@ -337,6 +338,7 @@
</span><span class="cx"> <script src="Views/DOMDetailsSidebarPanel.js"></script>
</span><span class="cx"> <script src="Views/FolderTreeElement.js"></script>
</span><span class="cx"> <script src="Views/FolderizedTreeElement.js"></script>
</span><ins>+ <script src="Views/NewTabContentView.js"></script>
</ins><span class="cx"> <script src="Views/ObjectTreeBaseTreeElement.js"></script>
</span><span class="cx"> <script src="Views/SourceCodeTreeElement.js"></script>
</span><span class="cx"> <script src="Views/StorageTreeElement.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNewTabContentViewcss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.css (0 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.css         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.css        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple 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 APPLE 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 APPLE 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.
+ */
+
+.new-tab.tab.content-view {
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: center;
+ align-content: center;
+
+ background-color: rgb(246, 246, 246);
+
+ padding: 10px;
+
+ overflow-y: auto;
+}
+
+.new-tab.tab.content-view > .tab-item {
+ display: flex;
+
+ min-width: 110px;
+ min-height: 110px;
+
+ margin: 10px;
+
+ flex-direction: column;
+ align-items: center;
+}
+
+.new-tab.tab.content-view > .tab-item.disabled {
+ opacity: 0.5;
+ -webkit-filter: brightness(90%);
+}
+
+.new-tab.tab.content-view > .tab-item > .box {
+ width: 94px;
+ height: 94px;
+
+ padding: 15px;
+ border-radius: 5px;
+
+ background-color: rgb(210, 210, 210);
+ box-shadow: rgba(0, 0, 0, 0.33) 0 1px 6px;
+
+ display: block;
+}
+
+.new-tab.tab.content-view > .tab-item:not(.disabled):active > .box {
+ -webkit-filter: brightness(90%);
+}
+
+.new-tab.tab.content-view > .tab-item > .box > img {
+ width: 64px;
+ height: 64px;
+
+ opacity: 0.55; /* Assumes black glyphs. */
+
+ -webkit-user-drag: none;
+}
+
+.new-tab.tab.content-view > .tab-item > label {
+ display: block;
+ margin-top: 8px;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNewTabContentViewjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js (0 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple 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 APPLE 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 APPLE 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.
+ */
+
+WebInspector.NewTabContentView = function(identifier)
+{
+ var tabBarItem = new WebInspector.TabBarItem("Images/NewTab.svg", WebInspector.UIString("New Tab"));
+
+ WebInspector.TabContentView.call(this, identifier || "new-tab", "new-tab", tabBarItem);
+
+ var allowedNewTabs = [
+ {image: "Images/Elements.svg", title: WebInspector.UIString("Elements"), type: WebInspector.ElementsTabContentView.Type},
+ {image: "Images/Console.svg", title: WebInspector.UIString("Console"), type: WebInspector.ConsoleTabContentView.Type}
+ ];
+
+ for (var info of allowedNewTabs) {
+ if (!WebInspector.isTabTypeAllowed(info.type))
+ continue;
+
+ var tabItemElement = document.createElement("div");
+ tabItemElement.classList.add("tab-item");
+
+ if (WebInspector.isNewTabWithTypeAllowed(info.type))
+ tabItemElement.addEventListener("click", this._createNewTab.bind(this, info.type));
+ else
+ tabItemElement.classList.add("disabled");
+
+ var boxElement = tabItemElement.appendChild(document.createElement("div"));
+ boxElement.classList.add("box");
+
+ var imageElement = boxElement.appendChild(document.createElement("img"));
+ imageElement.src = info.image;
+
+ var labelElement = tabItemElement.appendChild(document.createElement("label"));
+ labelElement.textContent = info.title;
+
+ this.element.appendChild(tabItemElement);
+ }
+};
+
+WebInspector.NewTabContentView.prototype = {
+ constructor: WebInspector.NewTabContentView,
+ __proto__: WebInspector.TabContentView.prototype,
+
+ // Public
+
+ get type()
+ {
+ return WebInspector.NewTabContentView.Type;
+ },
+
+ // Private
+
+ _createNewTab: function(tabType, event)
+ {
+ WebInspector.createNewTab(tabType, this);
+ }
+};
+
+WebInspector.NewTabContentView.Type = "new-tab";
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTabBarcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.css (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.css        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.css        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -106,20 +106,20 @@
</span><span class="cx"> justify-content: center;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.tab-bar > .item.selected {
</del><ins>+.tab-bar > .item:not(.disabled).selected {
</ins><span class="cx"> border-top-color: rgb(190, 190, 190);
</span><span class="cx"> background-image: linear-gradient(to bottom, rgb(222, 222, 222), rgb(211, 211, 211));
</span><span class="cx"> background-size: 100% 100%;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.tab-bar:not(.animating) > .item:not(.selected):hover,
-.tab-bar > .item.new-tab-button:hover {
</del><ins>+.tab-bar:not(.animating) > .item:not(.selected, .disabled):hover,
+.tab-bar > .item.new-tab-button:not(.disabled):hover {
</ins><span class="cx"> background-position: 0 100%;
</span><span class="cx"> border-top-color: rgb(152, 152, 152);
</span><span class="cx"> border-left-color: rgb(152, 152, 152);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.tab-bar:not(.animating) > .item:not(.selected):hover + .item {
</del><ins>+.tab-bar:not(.animating) > .item:not(.selected, .disabled):hover + .item {
</ins><span class="cx"> border-left-color: rgb(152, 152, 152);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -201,8 +201,12 @@
</span><span class="cx"> opacity: 0.7;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.tab-bar:not(.animating) > .item:not(.selected):hover > .icon,
-.tab-bar > .item.new-tab-button:hover > .icon {
</del><ins>+.tab-bar > .item.disabled > .icon {
+ opacity: 0.35;
+}
+
+.tab-bar:not(.animating) > .item:not(.selected, .disabled):hover > .icon,
+.tab-bar > .item.new-tab-button:not(.disabled):hover > .icon {
</ins><span class="cx"> opacity: 0.6;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTabBarjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -351,6 +351,8 @@
</span><span class="cx"> set selectedTabBarItem(tabBarItemOrIndex)
</span><span class="cx"> {
</span><span class="cx"> var tabBarItem = this._findTabBarItem(tabBarItemOrIndex);
</span><ins>+ if (tabBarItem === this._newTabItem)
+ tabBarItem = this._tabBarItems[this._tabBarItems.length - 2];
</ins><span class="cx">
</span><span class="cx"> if (this._selectedTabBarItem === tabBarItem)
</span><span class="cx"> return;
</span><span class="lines">@@ -498,9 +500,17 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> var tabBarItem = itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];
</span><del>- if (!tabBarItem || tabBarItem === this._newTabItem)
</del><ins>+ if (!tabBarItem)
</ins><span class="cx"> return;
</span><span class="cx">
</span><ins>+ if (tabBarItem.disabled)
+ return;
+
+ if (tabBarItem === this._newTabItem) {
+ this.dispatchEventToListeners(WebInspector.TabBar.Event.NewTabItemClicked);
+ return;
+ }
+
</ins><span class="cx"> var closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);
</span><span class="cx"> if (closeButtonElement) {
</span><span class="cx"> this.removeTabBarItem(tabBarItem, false, true);
</span><span class="lines">@@ -668,5 +678,6 @@
</span><span class="cx"> TabBarItemSelected: "tab-bar-tab-bar-item-selected",
</span><span class="cx"> TabBarItemAdded: "tab-bar-tab-bar-item-added",
</span><span class="cx"> TabBarItemRemoved: "tab-bar-tab-bar-item-removed",
</span><del>- TabBarItemsReordered: "tab-bar-tab-bar-items-reordered"
</del><ins>+ TabBarItemsReordered: "tab-bar-tab-bar-items-reordered",
+ NewTabItemClicked: "tab-bar-new-tab-item-clicked"
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTabBarItemjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -100,6 +100,16 @@
</span><span class="cx"> this._element.classList.toggle("selected", selected);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ get disabled()
+ {
+ return this._element.classList.contains("disabled");
+ }
+
+ set disabled(disabled)
+ {
+ this._element.classList.toggle("disabled", disabled);
+ }
+
</ins><span class="cx"> get hideCloseButton()
</span><span class="cx"> {
</span><span class="cx"> return this._element.classList.contains("hide-close-button");
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTabBrowserjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js (183467 => 183468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js        2015-04-28 12:49:30 UTC (rev 183467)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js        2015-04-28 13:04:38 UTC (rev 183468)
</span><span class="lines">@@ -50,8 +50,7 @@
</span><span class="cx"> this._contentViewContainer = new WebInspector.ContentViewContainer;
</span><span class="cx"> this._element.appendChild(this._contentViewContainer.element);
</span><span class="cx">
</span><del>- // FIXME: Support creating new tabs.
- // this._tabBar.newTabItem = new WebInspector.TabBarItem(platformImagePath("NewTabPlus.svg"), WebInspector.UIString("Create a new tab"), true);
</del><ins>+ this._tabBar.newTabItem = new WebInspector.TabBarItem(platformImagePath("NewTabPlus.svg"), WebInspector.UIString("Create a new tab"), true);
</ins><span class="cx">
</span><span class="cx"> this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemSelected, this._tabBarItemSelected, this);
</span><span class="cx"> this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved, this._tabBarItemRemoved, this);
</span><span class="lines">@@ -116,7 +115,7 @@
</span><span class="cx"> return null;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- addTabForContentView(tabContentView, doNotAnimate)
</del><ins>+ addTabForContentView(tabContentView, doNotAnimate, insertionIndex)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(tabContentView instanceof WebInspector.TabContentView);
</span><span class="cx"> if (!(tabContentView instanceof WebInspector.TabContentView))
</span><span class="lines">@@ -143,7 +142,10 @@
</span><span class="cx"> else
</span><span class="cx"> this._recentTabContentViews.push(tabContentView);
</span><span class="cx">
</span><del>- this._tabBar.addTabBarItem(tabBarItem, doNotAnimate);
</del><ins>+ if (typeof insertionIndex === "number")
+ this._tabBar.insertTabBarItem(tabBarItem, insertionIndex, doNotAnimate);
+ else
+ this._tabBar.addTabBarItem(tabBarItem, doNotAnimate);
</ins><span class="cx">
</span><span class="cx"> console.assert(this._recentTabContentViews.length === this._tabBar.tabBarItems.length - (this._tabBar.newTabItem ? 1 : 0));
</span><span class="cx"> console.assert(!this.selectedTabContentView || this.selectedTabContentView === this._recentTabContentViews[0]);
</span><span class="lines">@@ -151,9 +153,9 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- showTabForContentView(tabContentView, doNotAnimate)
</del><ins>+ showTabForContentView(tabContentView, doNotAnimate, insertionIndex)
</ins><span class="cx"> {
</span><del>- if (!this.addTabForContentView(tabContentView, doNotAnimate))
</del><ins>+ if (!this.addTabForContentView(tabContentView, doNotAnimate, insertionIndex))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> this._tabBar.selectedTabBarItem = tabContentView.tabBarItem;
</span><span class="lines">@@ -171,10 +173,10 @@
</span><span class="cx"> if (!(tabContentView.tabBarItem instanceof WebInspector.TabBarItem))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (tabBarItem.parentTabBar !== this._tabBar)
</del><ins>+ if (tabContentView.tabBarItem.parentTabBar !== this._tabBar)
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- this._tabBar.removeTabBarItem(tabBarItem, doNotAnimate);
</del><ins>+ this._tabBar.removeTabBarItem(tabContentView.tabBarItem, doNotAnimate);
</ins><span class="cx">
</span><span class="cx"> console.assert(this._recentTabContentViews.length === this._tabBar.tabBarItems.length - (this._tabBar.newTabItem ? 1 : 0));
</span><span class="cx"> console.assert(!this.selectedTabContentView || this.selectedTabContentView === this._recentTabContentViews[0]);
</span></span></pre>
</div>
</div>
</body>
</html>