Title: [215047] trunk/Source/WebInspectorUI
Revision
215047
Author
mattba...@apple.com
Date
2017-04-06 11:50:05 -0700 (Thu, 06 Apr 2017)

Log Message

Web Inspector: Reorder Debugger tab sidebar panels: Scope Chain, Resource, Probes
https://bugs.webkit.org/show_bug.cgi?id=170418
<rdar://problem/31410771>

Reviewed by Timothy Hatcher.

Maintain the sidebar panel order defined by TabContentView when adding
and removing panels.

* UserInterface/Views/ContentBrowserTabContentView.js:
(WebInspector.ContentBrowserTabContentView.prototype.showDetailsSidebarPanels):
Insert sidebar panel based on the panel order defined by TabContentView.

* UserInterface/Views/DebuggerTabContentView.js:
(WebInspector.DebuggerTabContentView):

* UserInterface/Views/Sidebar.js:
(WebInspector.Sidebar.prototype.addSidebarPanel):
Implemented as an insert at the end.
(WebInspector.Sidebar.prototype.insertSidebarPanel):
Allow inserting into the sidebar panel collection.
(WebInspector.Sidebar.prototype.removeSidebarPanel):
Remove unused return value.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (215046 => 215047)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-04-06 18:48:11 UTC (rev 215046)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-04-06 18:50:05 UTC (rev 215047)
@@ -1,3 +1,29 @@
+2017-04-06  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: Reorder Debugger tab sidebar panels: Scope Chain, Resource, Probes
+        https://bugs.webkit.org/show_bug.cgi?id=170418
+        <rdar://problem/31410771>
+
+        Reviewed by Timothy Hatcher.
+
+        Maintain the sidebar panel order defined by TabContentView when adding
+        and removing panels.
+
+        * UserInterface/Views/ContentBrowserTabContentView.js:
+        (WebInspector.ContentBrowserTabContentView.prototype.showDetailsSidebarPanels):
+        Insert sidebar panel based on the panel order defined by TabContentView.
+
+        * UserInterface/Views/DebuggerTabContentView.js:
+        (WebInspector.DebuggerTabContentView):
+
+        * UserInterface/Views/Sidebar.js:
+        (WebInspector.Sidebar.prototype.addSidebarPanel):
+        Implemented as an insert at the end.
+        (WebInspector.Sidebar.prototype.insertSidebarPanel):
+        Allow inserting into the sidebar panel collection.
+        (WebInspector.Sidebar.prototype.removeSidebarPanel):
+        Remove unused return value.
+
 2017-04-05  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: Probe values not showing in sidebar

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js (215046 => 215047)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2017-04-06 18:48:11 UTC (rev 215046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2017-04-06 18:50:05 UTC (rev 215047)
@@ -142,6 +142,8 @@
         this._ignoreDetailsSidebarPanelSelectedEvent = true;
         this._ignoreDetailsSidebarPanelCollapsedEvent = true;
 
+        let hiddenSidebarPanels = 0;
+
         for (var i = 0; i < this.detailsSidebarPanels.length; ++i) {
             var sidebarPanel = this.detailsSidebarPanels[i];
             if (sidebarPanel.inspect(currentRepresentedObjects)) {
@@ -151,7 +153,8 @@
                 }
 
                 // The sidebar panel was not previously showing, so add the panel.
-                WebInspector.detailsSidebar.addSidebarPanel(sidebarPanel);
+                let index = i - hiddenSidebarPanels;
+                WebInspector.detailsSidebar.insertSidebarPanel(sidebarPanel, index);
 
                 if (this._lastSelectedDetailsSidebarPanelSetting.value === sidebarPanel.identifier) {
                     // Restore the sidebar panel selection if this sidebar panel was the last one selected by the user.
@@ -160,6 +163,7 @@
             } else {
                 // The sidebar panel can't inspect the current represented objects, so remove the panel and hide the toolbar item.
                 WebInspector.detailsSidebar.removeSidebarPanel(sidebarPanel);
+                hiddenSidebarPanels++;
             }
         }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js (215046 => 215047)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js	2017-04-06 18:48:11 UTC (rev 215046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js	2017-04-06 18:50:05 UTC (rev 215047)
@@ -29,7 +29,7 @@
     {
         let {image, title} = WebInspector.DebuggerTabContentView.tabInfo();
         let tabBarItem = new WebInspector.GeneralTabBarItem(image, title);
-        let detailsSidebarPanels = [WebInspector.resourceDetailsSidebarPanel, WebInspector.scopeChainDetailsSidebarPanel, WebInspector.probeDetailsSidebarPanel];
+        let detailsSidebarPanels = [WebInspector.scopeChainDetailsSidebarPanel, WebInspector.resourceDetailsSidebarPanel, WebInspector.probeDetailsSidebarPanel];
 
         super(identifier || "debugger", "debugger", tabBarItem, WebInspector.DebuggerSidebarPanel, detailsSidebarPanels);
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js (215046 => 215047)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2017-04-06 18:48:11 UTC (rev 215046)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2017-04-06 18:50:05 UTC (rev 215047)
@@ -62,25 +62,31 @@
 
     addSidebarPanel(sidebarPanel)
     {
+        this.insertSidebarPanel(sidebarPanel, this._sidebarPanels.length);
+    }
+
+    insertSidebarPanel(sidebarPanel, index)
+    {
         console.assert(sidebarPanel instanceof WebInspector.SidebarPanel);
         if (!(sidebarPanel instanceof WebInspector.SidebarPanel))
-            return null;
+            return;
 
         console.assert(!sidebarPanel.parentSidebar);
         if (sidebarPanel.parentSidebar)
-            return null;
+            return;
 
-        this._sidebarPanels.push(sidebarPanel);
-        this.addSubview(sidebarPanel);
+        console.assert(index >= 0 && index <= this._sidebarPanels.length);
+        this._sidebarPanels.splice(index, 0, sidebarPanel);
 
+        let referenceView = this._sidebarPanels[index + 1] || null;
+        this.insertSubviewBefore(sidebarPanel, referenceView);
+
         if (this._navigationBar) {
             console.assert(sidebarPanel.navigationItem);
-            this._navigationBar.addNavigationItem(sidebarPanel.navigationItem);
+            this._navigationBar.insertNavigationItem(sidebarPanel.navigationItem, index);
         }
 
         sidebarPanel.added();
-
-        return sidebarPanel;
     }
 
     removeSidebarPanel(sidebarPanelOrIdentifierOrIndex)
@@ -87,7 +93,7 @@
     {
         var sidebarPanel = this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);
         if (!sidebarPanel)
-            return null;
+            return;
 
         sidebarPanel.selected = false;
 
@@ -110,8 +116,6 @@
         }
 
         sidebarPanel.removed();
-
-        return sidebarPanel;
     }
 
     get selectedSidebarPanel()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to