Title: [228479] trunk/Source/WebInspectorUI
Revision
228479
Author
mattba...@apple.com
Date
2018-02-14 12:17:30 -0800 (Wed, 14 Feb 2018)

Log Message

Web Inspector: TabBar redesign: only show allowed tabs in the available tabs context menu
https://bugs.webkit.org/show_bug.cgi?id=182721
<rdar://problem/37479019>

Reviewed by Timothy Hatcher.

In addition to only including allowed tabs in the TabBar context menu,
perform a sanity check when setting the selected tab item, since the
serialized selection index could refer to a tab that is no longer allowed.

* UserInterface/Views/LegacyTabBar.js:
(WI.LegacyTabBar.prototype.set selectedTabBarItem):
(WI.LegacyTabBar.prototype._handleContextMenu):

* UserInterface/Views/TabBar.js:
(WI.TabBar.prototype.set selectedTabBarItem):
(WI.TabBar.prototype._handleContextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (228478 => 228479)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-02-14 19:47:57 UTC (rev 228478)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-02-14 20:17:30 UTC (rev 228479)
@@ -1,3 +1,23 @@
+2018-02-14  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: TabBar redesign: only show allowed tabs in the available tabs context menu
+        https://bugs.webkit.org/show_bug.cgi?id=182721
+        <rdar://problem/37479019>
+
+        Reviewed by Timothy Hatcher.
+
+        In addition to only including allowed tabs in the TabBar context menu,
+        perform a sanity check when setting the selected tab item, since the
+        serialized selection index could refer to a tab that is no longer allowed.
+
+        * UserInterface/Views/LegacyTabBar.js:
+        (WI.LegacyTabBar.prototype.set selectedTabBarItem):
+        (WI.LegacyTabBar.prototype._handleContextMenu):
+
+        * UserInterface/Views/TabBar.js:
+        (WI.TabBar.prototype.set selectedTabBarItem):
+        (WI.TabBar.prototype._handleContextMenu):
+
 2018-02-09  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: Canvas tab: tree selection abruptly changes when selecting a recording frame

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LegacyTabBar.js (228478 => 228479)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LegacyTabBar.js	2018-02-14 19:47:57 UTC (rev 228478)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LegacyTabBar.js	2018-02-14 20:17:30 UTC (rev 228479)
@@ -364,8 +364,8 @@
     set selectedTabBarItem(tabBarItemOrIndex)
     {
         let tabBarItem = this._findTabBarItem(tabBarItemOrIndex);
-        if (tabBarItem === this._newTabTabBarItem) {
-            // Get the item before the New-Tab item since it is not selectable.
+        if (tabBarItem === this._newTabTabBarItem || tabBarItem === this._tabPickerTabBarItem) {
+            // Get the last normal tab item if the item is not selectable.
             tabBarItem = this._tabBarItems[this.normalTabCount - 1];
         }
 
@@ -804,7 +804,7 @@
         let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         for (let tabClass of WI.knownTabClasses()) {
-            if (tabClass.tabInfo().isEphemeral)
+            if (!tabClass.isTabAllowed() || tabClass.tabInfo().isEphemeral)
                 continue;
 
             let openTabBarItem = null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (228478 => 228479)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2018-02-14 19:47:57 UTC (rev 228478)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2018-02-14 20:17:30 UTC (rev 228479)
@@ -336,6 +336,11 @@
     set selectedTabBarItem(tabBarItemOrIndex)
     {
         let tabBarItem = this._findTabBarItem(tabBarItemOrIndex);
+        if (tabBarItem === this._tabPickerTabBarItem) {
+            // Get the last normal tab item if the item is not selectable.
+            tabBarItem = this._tabBarItems[this.normalTabCount - 1];
+        }
+
         if (this._selectedTabBarItem === tabBarItem)
             return;
 
@@ -767,7 +772,7 @@
         let contextMenu = WI.ContextMenu.createFromEvent(event);
 
         for (let tabClass of WI.knownTabClasses()) {
-            if (tabClass.tabInfo().isEphemeral)
+            if (!tabClass.isTabAllowed() || tabClass.tabInfo().isEphemeral)
                 continue;
 
             let openTabBarItem = null;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to