Changeset 228024 in webkit
- Timestamp:
- Feb 2, 2018 1:04:52 PM (6 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 22 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r227864 r228024 1 2018-02-02 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: TabBar redesign: remove New Tab button and add experimental feature flag 4 https://bugs.webkit.org/show_bug.cgi?id=182342 5 <rdar://problem/37078662> 6 7 Reviewed by Devin Rousso. 8 9 This patch adds a new experimental setting group, "User Interface", with 10 a single setting, "Enable New TabBar". When enabled, the New Tab button is 11 no longer available in the top-level TabBar. The 'open tabs' context menu 12 no longer allows the last non-ephemeral open tab to be closed (unchecked). 13 14 * Localizations/en.lproj/localizedStrings.js: 15 16 * UserInterface/Base/Main.js: 17 (WI.contentLoaded): 18 (WI._tryToRestorePendingTabs): 19 Retain legacy behavior behind experimental feature setting. 20 (WI.isNewTabWithTypeAllowed): 21 22 * UserInterface/Base/Setting.js: 23 * UserInterface/Main.html: 24 25 * UserInterface/Views/CanvasTabContentView.js: 26 (WI.CanvasTabContentView): 27 * UserInterface/Views/ConsoleTabContentView.js: 28 (WI.ConsoleTabContentView): 29 * UserInterface/Views/DebuggerTabContentView.js: 30 (WI.DebuggerTabContentView): 31 * UserInterface/Views/ElementsTabContentView.js: 32 (WI.ElementsTabContentView): 33 34 * UserInterface/Views/GeneralTabBarItem.js: 35 (WI.GeneralTabBarItem): 36 (WI.GeneralTabBarItem.prototype.fromTabInfo): 37 (WI.GeneralTabBarItem.prototype.get isEphemeral): 38 (WI.GeneralTabBarItem.fromTabContentViewConstructor): Deleted. 39 40 * UserInterface/Views/LayersTabContentView.js: 41 (WI.LayersTabContentView): 42 43 * UserInterface/Views/LegacyTabBar.js: Copied from Source/WebInspectorUI/UserInterface/Views/TabBar.js. 44 (WI.LegacyTabBar): 45 (WI.LegacyTabBar.prototype.get newTabTabBarItem): 46 (WI.LegacyTabBar.prototype.updateNewTabTabBarItemState): 47 (WI.LegacyTabBar.prototype.addTabBarItem): 48 (WI.LegacyTabBar.prototype.insertTabBarItem.animateTabs): 49 (WI.LegacyTabBar.prototype.insertTabBarItem.removeStyles): 50 (WI.LegacyTabBar.prototype.insertTabBarItem): 51 (WI.LegacyTabBar.prototype.removeTabBarItem.animateTabs): 52 (WI.LegacyTabBar.prototype.removeTabBarItem.removeStyles): 53 (WI.LegacyTabBar.prototype.removeTabBarItem): 54 (WI.LegacyTabBar.prototype.selectPreviousTab): 55 (WI.LegacyTabBar.prototype.selectNextTab): 56 (WI.LegacyTabBar.prototype.get selectedTabBarItem): 57 (WI.LegacyTabBar.prototype.set selectedTabBarItem): 58 (WI.LegacyTabBar.prototype.get tabBarItems): 59 (WI.LegacyTabBar.prototype.get normalTabCount): 60 (WI.LegacyTabBar.prototype.layout.forceItemHidden): 61 (WI.LegacyTabBar.prototype.layout): 62 (WI.LegacyTabBar.prototype._tabBarItemsFromLeftToRight): 63 (WI.LegacyTabBar.prototype._findTabBarItem): 64 (WI.LegacyTabBar.prototype._hasMoreThanOneNormalTab): 65 (WI.LegacyTabBar.prototype._openDefaultTab): 66 (WI.LegacyTabBar.prototype._recordTabBarItemSizesAndPositions): 67 (WI.LegacyTabBar.prototype._applyTabBarItemSizesAndPositions): 68 (WI.LegacyTabBar.prototype._clearTabBarItemSizesAndPositions): 69 (WI.LegacyTabBar.prototype._finishExpandingTabsAfterClose.): 70 (WI.LegacyTabBar.prototype._finishExpandingTabsAfterClose): 71 (WI.LegacyTabBar.prototype._handleMouseDown): 72 (WI.LegacyTabBar.prototype._handleClick): 73 (WI.LegacyTabBar.prototype._handleMouseMoved): 74 (WI.LegacyTabBar.prototype._handleMouseUp): 75 (WI.LegacyTabBar.prototype._handleMouseLeave): 76 (WI.LegacyTabBar.prototype._handleContextMenu): 77 (WI.LegacyTabBar.prototype._handleNewTabClick): 78 (WI.LegacyTabBar.prototype._handleTabPickerTabContextMenu): 79 (WI.LegacyTabBar.prototype._handleNewTabMouseEnter): 80 81 * UserInterface/Views/NetworkTabContentView.js: 82 (WI.NetworkTabContentView): 83 * UserInterface/Views/NewTabContentView.js: 84 (WI.NewTabContentView): 85 (WI.NewTabContentView.tabInfo): 86 (WI.NewTabContentView.isEphemeral): Deleted. 87 * UserInterface/Views/ResourcesTabContentView.js: 88 (WI.ResourcesTabContentView): 89 * UserInterface/Views/SearchTabContentView.js: 90 (WI.SearchTabContentView): 91 (WI.SearchTabContentView.tabInfo): 92 (WI.SearchTabContentView.isEphemeral): Deleted. 93 94 * UserInterface/Views/SettingsTabContentView.js: 95 (WI.SettingsTabContentView.tabInfo): 96 (WI.SettingsTabContentView.prototype._createExperimentalSettingsView): 97 (WI.SettingsTabContentView.isEphemeral): Deleted. 98 99 * UserInterface/Views/StorageTabContentView.js: 100 (WI.StorageTabContentView): 101 102 * UserInterface/Views/TabBar.css: 103 * UserInterface/Views/TabBar.js: 104 (WI.TabBar): 105 (WI.TabBar.prototype.insertTabBarItem): 106 (WI.TabBar.prototype.removeTabBarItem): 107 (WI.TabBar.prototype.set selectedTabBarItem): 108 (WI.TabBar.prototype.get normalNonEphemeralTabCount): 109 (WI.TabBar.prototype._handleMouseDown): 110 (WI.TabBar.prototype._handleClick): 111 (WI.TabBar.prototype._handleMouseMoved): 112 (WI.TabBar.prototype._handleMouseLeave): 113 (WI.TabBar.prototype._handleContextMenu): 114 (WI.TabBar.prototype._handleTabPickerTabContextMenu): 115 (WI.TabBar.prototype.get newTabTabBarItem): Deleted. 116 (WI.TabBar.prototype.updateNewTabTabBarItemState): Deleted. 117 (WI.TabBar.prototype._openDefaultTab): Deleted. 118 (WI.TabBar.prototype._handleNewTabClick): Deleted. 119 (WI.TabBar.prototype._handleNewTabMouseEnter): Deleted. 120 Remove support for the New Tab button and default tab. Without a default 121 tab, there is nothing to display when no tabs are open, so prevent the 122 last non-pinned tab from being removed. 123 124 * UserInterface/Views/TabBrowser.js: 125 (WI.TabBrowser._tabBarItemRemoved): 126 * UserInterface/Views/TabContentView.js: 127 (WI.TabContentView.isEphemeral): Deleted. 128 * UserInterface/Views/TimelineTabContentView.js: 129 (WI.TimelineTabContentView): 130 1 131 2018-01-30 Devin Rousso <webkit@devinrousso.com> 2 132 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r227703 r228024 368 368 localizedStrings["Enable Event Listener"] = "Enable Event Listener"; 369 369 localizedStrings["Enable Layers Tab"] = "Enable Layers Tab"; 370 localizedStrings["Enable New Tab Bar"] = "Enable New Tab Bar"; 370 371 localizedStrings["Enable Program"] = "Enable Program"; 371 372 localizedStrings["Enable all breakpoints (%s)"] = "Enable all breakpoints (%s)"; … … 1009 1010 localizedStrings["User Agent"] = "User Agent"; 1010 1011 localizedStrings["User Agent Stylesheet"] = "User Agent Stylesheet"; 1012 localizedStrings["User Interface:"] = "User Interface:"; 1011 1013 localizedStrings["User Stylesheet"] = "User Stylesheet"; 1012 1014 localizedStrings["Using Keyword Value"] = "Using Keyword Value"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r227864 r228024 271 271 this.toolbar = new WI.Toolbar(document.getElementById("toolbar")); 272 272 273 this.tabBar = new WI.TabBar(document.getElementById("tab-bar")); 274 this.tabBar.addEventListener(WI.TabBar.Event.OpenDefaultTab, this._openDefaultTab, this); 273 if (WI.settings.experimentalEnableNewTabBar.value) 274 this.tabBar = new WI.TabBar(document.getElementById("tab-bar")); 275 else { 276 this.tabBar = new WI.LegacyTabBar(document.getElementById("tab-bar")); 277 this.tabBar.addEventListener(WI.TabBar.Event.OpenDefaultTab, this._openDefaultTab, this); 278 } 275 279 276 280 this._contentElement = document.getElementById("content"); … … 602 606 this._pendingOpenTabs = stillPendingOpenTabs; 603 607 604 this.tabBrowser.tabBar.updateNewTabTabBarItemState(); 608 if (!WI.settings.experimentalEnableNewTabBar.value) 609 this.tabBrowser.tabBar.updateNewTabTabBarItemState(); 605 610 }; 606 611 … … 633 638 if (tabClass === WI.NewTabContentView) { 634 639 let allTabs = Array.from(this.knownTabClasses()); 635 let addableTabs = allTabs.filter((tabClass) => !tabClass. isEphemeral());640 let addableTabs = allTabs.filter((tabClass) => !tabClass.tabInfo().isEphemeral); 636 641 let canMakeNewTab = addableTabs.some((tabClass) => WI.isNewTabWithTypeAllowed(tabClass.Type)); 637 642 return canMakeNewTab; -
trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js
r225547 r228024 127 127 experimentalLegacyStyleEditor: new WI.Setting("experimental-legacy-style-editor", false), 128 128 experimentalLegacyVisualSidebar: new WI.Setting("experimental-legacy-visual-sidebar", false), 129 experimentalEnableNewTabBar: new WI.Setting("experimental-enable-new-tab-bar", false), 129 130 }; -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r227244 r228024 480 480 <script src="Views/TreeOutlineGroup.js"></script> 481 481 482 <script src="Views/LegacyTabBar.js"></script> 483 482 484 <script src="Views/ButtonNavigationItem.js"></script> 483 485 <script src="Views/DatabaseUserQueryViewBase.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/CanvasTabContentView.js
r227703 r228024 30 30 console.assert(!representedObject || representedObject instanceof WI.Canvas); 31 31 32 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.CanvasTabContentView);32 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.CanvasTabContentView.tabInfo()); 33 33 34 34 const navigationSidebarPanelConstructor = WI.RecordingNavigationSidebarPanel; -
trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.ConsoleTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.ConsoleTabContentView.tabInfo()); 31 31 32 32 super(identifier || "console", "console", tabBarItem, null, null, true); -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.DebuggerTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.DebuggerTabContentView.tabInfo()); 31 31 let detailsSidebarPanelConstructors = [WI.ScopeChainDetailsSidebarPanel, WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel]; 32 32 -
trunk/Source/WebInspectorUI/UserInterface/Views/ElementsTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.ElementsTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.ElementsTabContentView.tabInfo()); 31 31 let detailsSidebarPanelConstructors = [WI.RulesStyleDetailsSidebarPanel, WI.ComputedStyleDetailsSidebarPanel, WI.DOMNodeDetailsSidebarPanel]; 32 32 -
trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTabBarItem.js
r227703 r228024 27 27 WI.GeneralTabBarItem = class GeneralTabBarItem extends WI.TabBarItem 28 28 { 29 constructor(image, title, isEphemeral )29 constructor(image, title, isEphemeral = false) 30 30 { 31 31 super(image, title); 32 32 33 if (isEphemeral) { 33 this._isEphemeral = isEphemeral; 34 35 if (this._isEphemeral) { 34 36 this.element.classList.add("ephemeral"); 35 37 … … 43 45 } 44 46 45 static fromTab ContentViewConstructor(constructor)47 static fromTabInfo({image, title, isEphemeral}) 46 48 { 47 let {image, title} = constructor.tabInfo();48 let isEphemeral = constructor.isEphemeral();49 49 return new WI.GeneralTabBarItem(image, title, isEphemeral); 50 50 } 51 51 52 52 // Public 53 54 get isEphemeral() { return this._isEphemeral; } 53 55 54 56 get title() -
trunk/Source/WebInspectorUI/UserInterface/Views/LayersTabContentView.js
r227703 r228024 28 28 constructor() 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.LayersTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.LayersTabContentView.tabInfo()); 31 31 32 32 const navigationSidebarPanelConstructor = null; -
trunk/Source/WebInspectorUI/UserInterface/Views/LegacyTabBar.js
r228023 r228024 1 1 /* 2 * Copyright (C) 201 5Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WI. TabBar = classTabBar extends WI.View26 WI.LegacyTabBar = class LegacyTabBar extends WI.View 27 27 { 28 28 constructor(element, tabBarItems) … … 805 805 806 806 for (let tabClass of WI.knownTabClasses()) { 807 if (tabClass. isEphemeral())807 if (tabClass.tabInfo().isEphemeral) 808 808 continue; 809 809 … … 855 855 } 856 856 }; 857 858 WI.TabBar.CachedWidthSymbol = Symbol("cached-width");859 860 WI.TabBar.Event = {861 TabBarItemSelected: "tab-bar-tab-bar-item-selected",862 TabBarItemAdded: "tab-bar-tab-bar-item-added",863 TabBarItemRemoved: "tab-bar-tab-bar-item-removed",864 TabBarItemsReordered: "tab-bar-tab-bar-items-reordered",865 OpenDefaultTab: "tab-bar-open-default-tab"866 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.NetworkTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.NetworkTabContentView.tabInfo()); 31 31 32 32 super(identifier || "network", "network", tabBarItem); -
trunk/Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.NewTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.NewTabContentView.tabInfo()); 31 31 tabBarItem.isDefaultTab = true; 32 32 … … 36 36 37 37 let allTabClasses = Array.from(WI.knownTabClasses()); 38 this._shownTabClasses = allTabClasses.filter((tabClass) => tabClass.isTabAllowed() && !tabClass. isEphemeral());38 this._shownTabClasses = allTabClasses.filter((tabClass) => tabClass.isTabAllowed() && !tabClass.tabInfo().isEphemeral); 39 39 this._shownTabClasses.sort((a, b) => a.tabInfo().title.extendedLocaleCompare(b.tabInfo().title)); 40 40 } … … 45 45 image: "Images/NewTab.svg", 46 46 title: WI.UIString("New Tab"), 47 isEphemeral: true, 47 48 }; 48 }49 50 static isEphemeral()51 {52 return true;53 49 } 54 50 -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourcesTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.ResourcesTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.ResourcesTabContentView.tabInfo()); 31 31 const detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel]; 32 32 super(identifier || "resources", "resources", tabBarItem, WI.ResourceSidebarPanel, detailsSidebarPanelConstructors); -
trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.SearchTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.SearchTabContentView.tabInfo()); 31 31 let detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel, 32 32 WI.DOMNodeDetailsSidebarPanel, WI.ComputedStyleDetailsSidebarPanel, WI.RulesStyleDetailsSidebarPanel]; … … 45 45 image: "Images/SearchResults.svg", 46 46 title: WI.UIString("Search"), 47 isEphemeral: true, 47 48 }; 48 }49 50 static isEphemeral()51 {52 return true;53 49 } 54 50 -
trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
r225663 r228024 45 45 image: "Images/Gear.svg", 46 46 title: WI.UIString("Settings"), 47 isEphemeral: true, 47 48 }; 48 }49 50 static isEphemeral()51 {52 return true;53 49 } 54 50 … … 255 251 } 256 252 253 experimentalSettingsView.addSetting(WI.UIString("User Interface:"), WI.settings.experimentalEnableNewTabBar, WI.UIString("Enable New Tab Bar")); 254 experimentalSettingsView.addSeparator(); 255 257 256 let reloadInspectorButton = document.createElement("button"); 258 257 reloadInspectorButton.textContent = WI.UIString("Reload Web Inspector"); … … 272 271 listenForChange(WI.settings.experimentalLegacyVisualSidebar); 273 272 listenForChange(WI.settings.experimentalEnableLayersTab); 273 listenForChange(WI.settings.experimentalEnableNewTabBar); 274 274 275 275 this.addSettingsView(experimentalSettingsView); -
trunk/Source/WebInspectorUI/UserInterface/Views/StorageTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.StorageTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.StorageTabContentView.tabInfo()); 31 31 let detailsSidebarPanelConstructors = [WI.ApplicationCacheDetailsSidebarPanel, WI.IndexedDatabaseDetailsSidebarPanel]; 32 32 -
trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.css
r227703 r228024 1 1 /* 2 * Copyright (C) 2015-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2015-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without -
trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js
r227703 r228024 49 49 this.addTabBarItem(WI.settingsTabContentView.tabBarItem, {suppressAnimations: true}); 50 50 51 this._newTabTabBarItem = new WI.PinnedTabBarItem("Images/NewTabPlus.svg", WI.UIString("Create a new tab"));52 this._newTabTabBarItem.element.addEventListener("mouseenter", this._handleNewTabMouseEnter.bind(this));53 this._newTabTabBarItem.element.addEventListener("click", this._handleNewTabClick.bind(this));54 this.addTabBarItem(this._newTabTabBarItem, {suppressAnimations: true});55 56 51 this._tabPickerTabBarItem = new WI.PinnedTabBarItem("Images/TabPicker.svg", WI.UIString("Show hidden tabs")); 57 52 this._tabPickerTabBarItem.element.classList.add("tab-picker"); … … 61 56 62 57 // Public 63 64 get newTabTabBarItem() { return this._newTabTabBarItem; }65 66 updateNewTabTabBarItemState()67 {68 let newTabExists = !WI.isNewTabWithTypeAllowed(WI.NewTabContentView.Type);69 this._newTabTabBarItem.disabled = newTabExists;70 }71 58 72 59 addTabBarItem(tabBarItem, options = {}) … … 171 158 this.needsLayout(); 172 159 173 if (!(tabBarItem instanceof WI.PinnedTabBarItem))174 this.updateNewTabTabBarItemState();175 176 160 this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemAdded, {tabBarItem}); 177 161 … … 183 167 let tabBarItem = this._findTabBarItem(tabBarItemOrIndex); 184 168 if (!tabBarItem || tabBarItem instanceof WI.PinnedTabBarItem) 169 return null; 170 171 if (!tabBarItem.isEphemeral && this.normalNonEphemeralTabCount === 1) 185 172 return null; 186 173 … … 213 200 var hasMoreThanOneNormalTab = this._hasMoreThanOneNormalTab(); 214 201 this.element.classList.toggle("single-tab", !hasMoreThanOneNormalTab); 215 216 const shouldOpenDefaultTab = !tabBarItem.isDefaultTab && !this.normalTabCount;217 if (shouldOpenDefaultTab)218 options.suppressAnimations = true;219 202 220 203 if (!hasMoreThanOneNormalTab || wasLastNormalTab || !options.suppressExpansion) { … … 225 208 this.needsLayout(); 226 209 227 this.updateNewTabTabBarItemState();228 229 210 this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemRemoved, {tabBarItem}); 230 231 if (shouldOpenDefaultTab)232 this._openDefaultTab();233 234 211 return tabBarItem; 235 212 } … … 301 278 this.needsLayout(); 302 279 303 this.updateNewTabTabBarItemState();304 305 280 this.dispatchEventToListeners(WI.TabBar.Event.TabBarItemRemoved, {tabBarItem}); 306 307 if (shouldOpenDefaultTab)308 this._openDefaultTab();309 281 310 282 return tabBarItem; … … 365 337 { 366 338 let tabBarItem = this._findTabBarItem(tabBarItemOrIndex); 367 if (tabBarItem === this._newTabTabBarItem) {368 // Get the item before the New-Tab item since it is not selectable.369 tabBarItem = this._tabBarItems[this.normalTabCount - 1];370 }371 372 339 if (this._selectedTabBarItem === tabBarItem) 373 340 return; … … 395 362 { 396 363 return this._tabBarItems.filter((item) => !(item instanceof WI.PinnedTabBarItem)).length; 364 } 365 366 get normalNonEphemeralTabCount() 367 { 368 return this._tabBarItems.filter((item) => !item.isEphemeral && !(item instanceof WI.PinnedTabBarItem)).length; 397 369 } 398 370 … … 492 464 } 493 465 494 _openDefaultTab()495 {496 this.dispatchEventToListeners(WI.TabBar.Event.OpenDefaultTab);497 }498 499 466 _recordTabBarItemSizesAndPositions() 500 467 { … … 597 564 return; 598 565 599 if (tabBarItem === this._newTabTabBarItem)600 return;601 602 566 if (tabBarItem === this._tabPickerTabBarItem) { 603 567 if (!this._hiddenTabBarItems.length) … … 660 624 var closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WI.TabBarItem.CloseButtonStyleClassName); 661 625 if (closeButtonElement || clickedMiddleButton) { 662 // Disallow closing the default tab if it is theonly tab.663 if (t abBarItem.isDefaultTab && this.element.classList.contains("single-tab"))626 // Disallow closing the only tab. 627 if (this.element.classList.contains("single-tab")) 664 628 return; 665 629 … … 734 698 735 699 let nextSibling = this._tabBarItems[newIndex + 1]; 736 let nextSiblingElement = nextSibling ? nextSibling.element : this._newTabTabBarItem.element;700 let nextSiblingElement = nextSibling ? nextSibling.element : null; 737 701 738 702 this.element.insertBefore(this._selectedTabBarItem.element, nextSiblingElement); … … 742 706 let left = 0; 743 707 for (let tabBarItem of this._tabBarItemsFromLeftToRight()) { 744 if (tabBarItem !== this._selectedTabBarItem && tabBarItem !== this._newTabTabBarItem &&parseFloat(tabBarItem.element.style.left) !== left)708 if (tabBarItem !== this._selectedTabBarItem && parseFloat(tabBarItem.element.style.left) !== left) 745 709 tabBarItem.element.style.left = left + "px"; 746 710 left += parseFloat(tabBarItem.element.style.width); … … 793 757 // FIXME: Is this a WebKit bug or correct behavior? 794 758 const barRect = this.element.getBoundingClientRect(); 795 const newTabItemRect = this._newTabTabBarItem.element.getBoundingClientRect(); 796 if (event.pageY > barRect.top && event.pageY < barRect.bottom && event.pageX > barRect.left && event.pageX < (newTabItemRect ? newTabItemRect.right : barRect.right)) 759 if (event.pageY > barRect.top && event.pageY < barRect.bottom && event.pageX > barRect.left && event.pageX < barRect.right) 797 760 return; 798 761 … … 805 768 806 769 for (let tabClass of WI.knownTabClasses()) { 807 if (tabClass. isEphemeral())770 if (tabClass.tabInfo().isEphemeral) 808 771 continue; 809 772 … … 820 783 } 821 784 785 let checked = !!openTabBarItem; 786 let disabled = checked && this.normalNonEphemeralTabCount === 1; 822 787 contextMenu.appendCheckboxItem(tabClass.tabInfo().title, () => { 823 788 if (openTabBarItem) … … 825 790 else 826 791 WI.createNewTabWithType(tabClass.Type, {shouldShowNewTab: true}); 827 }, !!openTabBarItem); 828 } 829 } 830 831 _handleNewTabClick(event) 832 { 833 WI.showNewTabTab(); 792 }, checked, disabled); 793 } 834 794 } 835 795 … … 845 805 }); 846 806 } 847 }848 849 _handleNewTabMouseEnter(event)850 {851 if (!this._tabAnimatedClosedSinceMouseEnter || !this.element.classList.contains("static-layout") || this.element.classList.contains("animating"))852 return;853 854 this._finishExpandingTabsAfterClose();855 807 } 856 808 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js
r226963 r228024 284 284 this._recentTabContentViews.remove(tabContentView); 285 285 286 if (!tabContentView.constructor. isEphemeral())286 if (!tabContentView.constructor.tabInfo().isEphemeral) 287 287 this._closedTabClasses.add(tabContentView.constructor); 288 288 -
trunk/Source/WebInspectorUI/UserInterface/Views/TabContentView.js
r224981 r228024 64 64 // Returns false if a necessary domain or other features are unavailable. 65 65 return true; 66 }67 68 static isEphemeral()69 {70 // Returns true if the tab should not be shown in the new tab content view.71 return false;72 66 } 73 67 -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js
r227703 r228024 28 28 constructor(identifier) 29 29 { 30 let tabBarItem = WI.GeneralTabBarItem.fromTab ContentViewConstructor(WI.TimelineTabContentView);30 let tabBarItem = WI.GeneralTabBarItem.fromTabInfo(WI.TimelineTabContentView.tabInfo()); 31 31 let detailsSidebarPanelConstructors = [WI.ResourceDetailsSidebarPanel, WI.ProbeDetailsSidebarPanel]; 32 32
Note: See TracChangeset
for help on using the changeset viewer.