Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (218983 => 218984)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-06-30 02:16:05 UTC (rev 218983)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-06-30 02:25:02 UTC (rev 218984)
@@ -1,5 +1,35 @@
2017-06-29 Devin Rousso <[email protected]>
+ Web Inspector: Provide a way for creating a new tab but not making it immediately selected
+ https://bugs.webkit.org/show_bug.cgi?id=173983
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Views/TabBar.js:
+ (WebInspector.TabBar):
+ (WebInspector.TabBar.prototype.addTabBarItem):
+ (WebInspector.TabBar.prototype.insertTabBarItem):
+ (WebInspector.TabBar.prototype.removeTabBarItem):
+ (WebInspector.TabBar.prototype._handleClick):
+ (WebInspector.TabBar.prototype._handleNewTabClick):
+ * UserInterface/Views/TabBrowser.js:
+ (WebInspector.TabBrowser.prototype.addTabForContentView):
+ (WebInspector.TabBrowser.prototype.showTabForContentView):
+ (WebInspector.TabBrowser.prototype.closeTabForContentView):
+ * UserInterface/Base/Main.js:
+ (WebInspector.contentLoaded):
+ (WebInspector._openDefaultTab):
+ (WebInspector._tryToRestorePendingTabs):
+ (WebInspector.showNewTabTab):
+ (WebInspector.createNewTabWithType):
+ Add `options` dictionaries instead of optional parameters.
+
+ (WebInspector.tabContentViewClassForRepresentedObject):
+ Drive-by fix: remove incorrect placement of WebInspector.Collection check. This function
+ determines TabContentView classes, not ContentView.
+
+2017-06-29 Devin Rousso <[email protected]>
+
Web Inspector: Remove unnecessary hasChildren from TreeOutline
https://bugs.webkit.org/show_bug.cgi?id=173986
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (218983 => 218984)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2017-06-30 02:16:05 UTC (rev 218983)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2017-06-30 02:25:02 UTC (rev 218984)
@@ -474,7 +474,7 @@
let tabContentView = this._createTabContentViewForType(tabType);
if (!tabContentView)
continue;
- this.tabBrowser.addTabForContentView(tabContentView, true);
+ this.tabBrowser.addTabForContentView(tabContentView, {suppressAnimations: true});
}
this._restoreCookieForOpenTabs(WebInspector.StateRestorationType.Load);
@@ -485,7 +485,7 @@
this.tabBar.selectedTabBarItem = 0;
if (!this.tabBar.normalTabCount)
- this.showNewTabTab();
+ this.showNewTabTab({suppressAnimations: true});
// Listen to the events after restoring the saved tabs to avoid recursion.
this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._rememberOpenTabs, this);
@@ -589,7 +589,7 @@
WebInspector._openDefaultTab = function(event)
{
- this.showNewTabTab();
+ this.showNewTabTab({suppressAnimations: true});
};
WebInspector._showSettingsTab = function(event)
@@ -610,7 +610,10 @@
if (!tabContentView)
continue;
- this.tabBrowser.addTabForContentView(tabContentView, true, index);
+ this.tabBrowser.addTabForContentView(tabContentView, {
+ suppressAnimations: true,
+ insertionIndex: index,
+ });
tabContentView.restoreStateFromCookie(WebInspector.StateRestorationType.Load);
}
@@ -620,7 +623,7 @@
this.tabBrowser.tabBar.updateNewTabTabBarItemState();
};
-WebInspector.showNewTabTab = function(shouldAnimate)
+WebInspector.showNewTabTab = function(options)
{
if (!this.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type))
return;
@@ -628,7 +631,7 @@
let tabContentView = this.tabBrowser.bestTabContentViewForClass(WebInspector.NewTabContentView);
if (!tabContentView)
tabContentView = new WebInspector.NewTabContentView;
- this.tabBrowser.showTabForContentView(tabContentView, !shouldAnimate);
+ this.tabBrowser.showTabForContentView(tabContentView, options);
};
WebInspector.isNewTabWithTypeAllowed = function(tabType)
@@ -666,11 +669,13 @@
let tabContentView = this._createTabContentViewForType(tabType);
const suppressAnimations = true;
- let insertionIndex = referencedView ? this.tabBar.tabBarItems.indexOf(referencedView.tabBarItem) : undefined;
- this.tabBrowser.addTabForContentView(tabContentView, suppressAnimations, insertionIndex);
+ this.tabBrowser.addTabForContentView(tabContentView, {
+ suppressAnimations,
+ insertionIndex: referencedView ? this.tabBar.tabBarItems.indexOf(referencedView.tabBarItem) : undefined,
+ });
if (shouldReplaceTab)
- this.tabBrowser.closeTabForContentView(referencedView, suppressAnimations);
+ this.tabBrowser.closeTabForContentView(referencedView, {suppressAnimations});
if (shouldShowNewTab)
this.tabBrowser.showTabForContentView(tabContentView);
@@ -1119,9 +1124,6 @@
representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
return WebInspector.ResourcesTabContentView;
- if (representedObject instanceof WebInspector.Collection)
- return WebInspector.CollectionContentView;
-
return null;
};
@@ -1151,7 +1153,7 @@
if (!tabContentView)
return;
- this.tabBrowser.showTabForContentView(tabContentView);
+ this.tabBrowser.showTabForContentView(tabContentView, options);
tabContentView.showRepresentedObject(representedObject, cookie);
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (218983 => 218984)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js 2017-06-30 02:16:05 UTC (rev 218983)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js 2017-06-30 02:25:02 UTC (rev 218984)
@@ -44,12 +44,12 @@
this.addTabBarItem(tabBarItem);
}
- this.addTabBarItem(WebInspector.settingsTabContentView.tabBarItem, true);
+ this.addTabBarItem(WebInspector.settingsTabContentView.tabBarItem, {suppressAnimations: true});
this._newTabTabBarItem = new WebInspector.PinnedTabBarItem("Images/NewTabPlus.svg", WebInspector.UIString("Create a new tab"));
this._newTabTabBarItem.element.addEventListener("mouseenter", this._handleNewTabMouseEnter.bind(this));
this._newTabTabBarItem.element.addEventListener("click", this._handleNewTabClick.bind(this));
- this.addTabBarItem(this._newTabTabBarItem, true);
+ this.addTabBarItem(this._newTabTabBarItem, {suppressAnimations: true});
}
// Public
@@ -62,12 +62,12 @@
this._newTabTabBarItem.disabled = newTabExists;
}
- addTabBarItem(tabBarItem, doNotAnimate)
+ addTabBarItem(tabBarItem, options = {})
{
- return this.insertTabBarItem(tabBarItem, this._tabBarItems.length, doNotAnimate);
+ return this.insertTabBarItem(tabBarItem, this._tabBarItems.length, options);
}
- insertTabBarItem(tabBarItem, index, doNotAnimate)
+ insertTabBarItem(tabBarItem, index, options = {})
{
console.assert(tabBarItem instanceof WebInspector.TabBarItem);
if (!(tabBarItem instanceof WebInspector.TabBarItem))
@@ -74,14 +74,14 @@
return null;
if (tabBarItem.parentTabBar === this)
- return;
+ return null;
if (this._tabAnimatedClosedSinceMouseEnter) {
// Delay adding the new tab until we can expand the tabs after a closed tab.
this._finishExpandingTabsAfterClose().then(() => {
- this.insertTabBarItem(tabBarItem, index, doNotAnimate);
+ this.insertTabBarItem(tabBarItem, index, options);
});
- return;
+ return null;
}
if (tabBarItem.parentTabBar)
@@ -93,11 +93,11 @@
if (this.element.classList.contains("animating")) {
requestAnimationFrame(removeStyles.bind(this));
- doNotAnimate = true;
+ options.suppressAnimations = true;
}
var beforeTabSizesAndPositions;
- if (!doNotAnimate)
+ if (!options.suppressAnimations)
beforeTabSizesAndPositions = this._recordTabBarItemSizesAndPositions();
this._tabBarItems.splice(index, 0, tabBarItem);
@@ -138,7 +138,7 @@
this.element.removeEventListener("webkitTransitionEnd", removeStylesListener);
}
- if (!doNotAnimate) {
+ if (!options.suppressAnimations) {
var afterTabSizesAndPositions = this._recordTabBarItemSizesAndPositions();
this.updateLayout();
@@ -171,7 +171,7 @@
return tabBarItem;
}
- removeTabBarItem(tabBarItemOrIndex, doNotAnimate, doNotExpand)
+ removeTabBarItem(tabBarItemOrIndex, options = {})
{
let tabBarItem = this._findTabBarItem(tabBarItemOrIndex);
if (!tabBarItem || tabBarItem instanceof WebInspector.PinnedTabBarItem)
@@ -190,11 +190,11 @@
if (this.element.classList.contains("animating")) {
requestAnimationFrame(removeStyles.bind(this));
- doNotAnimate = true;
+ options.suppressAnimations = true;
}
var beforeTabSizesAndPositions;
- if (!doNotAnimate)
+ if (!options.suppressAnimations)
beforeTabSizesAndPositions = this._recordTabBarItemSizesAndPositions();
// Subtract 1 from normalTabCount since arrays begin indexing at 0.
@@ -208,10 +208,10 @@
const shouldOpenDefaultTab = !tabBarItem.isDefaultTab && !this.normalTabCount;
if (shouldOpenDefaultTab)
- doNotAnimate = true;
+ options.suppressAnimations = true;
- if (!hasMoreThanOneNormalTab || wasLastNormalTab || !doNotExpand) {
- if (!doNotAnimate) {
+ if (!hasMoreThanOneNormalTab || wasLastNormalTab || !options.suppressExpansion) {
+ if (!options.suppressAnimations) {
this._tabAnimatedClosedSinceMouseEnter = true;
this._finishExpandingTabsAfterClose(beforeTabSizesAndPositions);
} else
@@ -280,7 +280,7 @@
this.element.removeEventListener("webkitTransitionEnd", removeStylesListener);
}
- if (!doNotAnimate) {
+ if (!options.suppressAnimations) {
this.element.classList.add("static-layout");
this._tabAnimatedClosedSinceMouseEnter = true;
@@ -615,7 +615,7 @@
return;
if (!event.altKey) {
- this.removeTabBarItem(tabBarItem, false, true);
+ this.removeTabBarItem(tabBarItem, {suppressExpansion: true});
return;
}
@@ -752,8 +752,7 @@
_handleNewTabClick(event)
{
- const shouldAnimate = true;
- WebInspector.showNewTabTab(shouldAnimate);
+ WebInspector.showNewTabTab();
}
_handleNewTabMouseEnter(event)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js (218983 => 218984)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js 2017-06-30 02:16:05 UTC (rev 218983)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js 2017-06-30 02:25:02 UTC (rev 218984)
@@ -136,7 +136,7 @@
return null;
}
- addTabForContentView(tabContentView, doNotAnimate, insertionIndex)
+ addTabForContentView(tabContentView, options = {})
{
console.assert(tabContentView instanceof WebInspector.TabContentView);
if (!(tabContentView instanceof WebInspector.TabContentView))
@@ -163,10 +163,10 @@
else
this._recentTabContentViews.push(tabContentView);
- if (typeof insertionIndex === "number")
- this._tabBar.insertTabBarItem(tabBarItem, insertionIndex, doNotAnimate);
+ if (typeof options.insertionIndex === "number")
+ this._tabBar.insertTabBarItem(tabBarItem, options.insertionIndex, options);
else
- this._tabBar.addTabBarItem(tabBarItem, doNotAnimate);
+ this._tabBar.addTabBarItem(tabBarItem, options);
console.assert(this._recentTabContentViews.length === this._tabBar.normalTabCount);
console.assert(!this.selectedTabContentView || this.selectedTabContentView === this._recentTabContentViews[0]);
@@ -174,12 +174,13 @@
return true;
}
- showTabForContentView(tabContentView, doNotAnimate, insertionIndex)
+ showTabForContentView(tabContentView, options = {})
{
- if (!this.addTabForContentView(tabContentView, doNotAnimate, insertionIndex))
+ if (!this.addTabForContentView(tabContentView, options))
return false;
- this._tabBar.selectedTabBarItem = tabContentView.tabBarItem;
+ if (!options.suppressSelection)
+ this._tabBar.selectedTabBarItem = tabContentView.tabBarItem;
// FIXME: this is a workaround for <https://webkit.org/b/151876>.
// Without this extra call, we might never lay out the child tab
@@ -191,7 +192,7 @@
return true;
}
- closeTabForContentView(tabContentView, doNotAnimate)
+ closeTabForContentView(tabContentView, options = {})
{
console.assert(tabContentView instanceof WebInspector.TabContentView);
if (!(tabContentView instanceof WebInspector.TabContentView))
@@ -204,7 +205,7 @@
if (tabContentView.tabBarItem.parentTabBar !== this._tabBar)
return false;
- this._tabBar.removeTabBarItem(tabContentView.tabBarItem, doNotAnimate);
+ this._tabBar.removeTabBarItem(tabContentView.tabBarItem, options);
console.assert(this._recentTabContentViews.length === this._tabBar.normalTabCount);
console.assert(!this.selectedTabContentView || this.selectedTabContentView === this._recentTabContentViews[0]);