Title: [217750] trunk/Source/WebInspectorUI
Revision
217750
Author
[email protected]
Date
2017-06-02 20:44:51 -0700 (Fri, 02 Jun 2017)

Log Message

Web Inspector: Don't create NavigationSidebarPanel classes until they are needed by a Tab
https://bugs.webkit.org/show_bug.cgi?id=172621

Reviewed by Timothy Hatcher.

* UserInterface/Views/ContentBrowserTabContentView.js:
(WebInspector.ContentBrowserTabContentView):
(WebInspector.ContentBrowserTabContentView.prototype.shown):
* UserInterface/Views/TabContentView.js:
(WebInspector.TabContentView):
(WebInspector.TabContentView.prototype.get navigationSidebarPanel):

* UserInterface/Views/NetworkTabContentView.js:
(WebInspector.NetworkTabContentView.prototype.canShowRepresentedObject):
* UserInterface/Views/SearchTabContentView.js:
(WebInspector.SearchTabContentView.prototype.canShowRepresentedObject):
Use public getter for navigationSidebarPanel.

* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel):
(WebInspector.ResourceSidebarPanel.prototype.initialLayout): Added.
Load information about the current frame once the sidebar panel is displayed.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (217749 => 217750)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-06-03 03:37:53 UTC (rev 217749)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-06-03 03:44:51 UTC (rev 217750)
@@ -1,5 +1,30 @@
 2017-06-02  Devin Rousso  <[email protected]>
 
+        Web Inspector: Don't create NavigationSidebarPanel classes until they are needed by a Tab
+        https://bugs.webkit.org/show_bug.cgi?id=172621
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/ContentBrowserTabContentView.js:
+        (WebInspector.ContentBrowserTabContentView):
+        (WebInspector.ContentBrowserTabContentView.prototype.shown):
+        * UserInterface/Views/TabContentView.js:
+        (WebInspector.TabContentView):
+        (WebInspector.TabContentView.prototype.get navigationSidebarPanel):
+
+        * UserInterface/Views/NetworkTabContentView.js:
+        (WebInspector.NetworkTabContentView.prototype.canShowRepresentedObject):
+        * UserInterface/Views/SearchTabContentView.js:
+        (WebInspector.SearchTabContentView.prototype.canShowRepresentedObject):
+        Use public getter for navigationSidebarPanel.
+
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel):
+        (WebInspector.ResourceSidebarPanel.prototype.initialLayout): Added.
+        Load information about the current frame once the sidebar panel is displayed.
+
+2017-06-02  Devin Rousso  <[email protected]>
+
         Web Inspector: Use initialLayout for DetailsSidebarPanel classes
         https://bugs.webkit.org/show_bug.cgi?id=172381
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js (217749 => 217750)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2017-06-03 03:37:53 UTC (rev 217749)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2017-06-03 03:44:51 UTC (rev 217750)
@@ -25,7 +25,7 @@
 
 WebInspector.ContentBrowserTabContentView = class ContentBrowserTabContentView extends WebInspector.TabContentView
 {
-    constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelClass, detailsSidebarPanelConstructors, disableBackForward)
+    constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors, disableBackForward)
     {
         if (typeof styleClassNames === "string")
             styleClassNames = [styleClassNames];
@@ -33,9 +33,8 @@
         styleClassNames.push("content-browser");
 
         var contentBrowser = new WebInspector.ContentBrowser(null, null, disableBackForward);
-        var navigationSidebarPanel = navigationSidebarPanelClass ? new navigationSidebarPanelClass(contentBrowser) : null;
 
-        super(identifier, styleClassNames, tabBarItem, navigationSidebarPanel, detailsSidebarPanelConstructors);
+        super(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors);
 
         this._contentBrowser = contentBrowser;
         this._contentBrowser.delegate = this;
@@ -49,7 +48,7 @@
         // Explicitly update the path for the navigation bar to prevent it from showing up as blank.
         this._contentBrowser.updateHierarchicalPathForCurrentContentView();
 
-        if (navigationSidebarPanel) {
+        if (navigationSidebarPanelConstructor) {
             let showToolTip = WebInspector.UIString("Show the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);
             let hideToolTip = WebInspector.UIString("Hide the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);
             let image = WebInspector.resolvedLayoutDirection() == WebInspector.LayoutDirection.RTL ? "Images/ToggleRightSidebar.svg" : "Images/ToggleLeftSidebar.svg";
@@ -61,8 +60,6 @@
             this._contentBrowser.navigationBar.insertNavigationItem(this._showNavigationSidebarItem, 0);
             this._contentBrowser.navigationBar.insertNavigationItem(new WebInspector.DividerNavigationItem, 1);
 
-            navigationSidebarPanel.contentBrowser = this._contentBrowser;
-
             WebInspector.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange, this._navigationSidebarCollapsedStateDidChange, this);
         }
 
@@ -99,8 +96,13 @@
 
         this._contentBrowser.shown();
 
-        if (this.navigationSidebarPanel && !this._contentBrowser.currentContentView)
-            this.navigationSidebarPanel.showDefaultContentView();
+        if (this.navigationSidebarPanel) {
+            if (!this.navigationSidebarPanel.contentBrowser)
+                this.navigationSidebarPanel.contentBrowser = this._contentBrowser;
+
+            if (!this._contentBrowser.currentContentView)
+                this.navigationSidebarPanel.showDefaultContentView();
+        }
     }
 
     hidden()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js (217749 => 217750)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js	2017-06-03 03:37:53 UTC (rev 217749)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js	2017-06-03 03:44:51 UTC (rev 217750)
@@ -59,7 +59,7 @@
         if (!(representedObject instanceof WebInspector.Resource))
             return false;
 
-        return !!this._navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
+        return !!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
     }
 
     get supportsSplitContentBrowser()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (217749 => 217750)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2017-06-03 03:37:53 UTC (rev 217749)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2017-06-03 03:44:51 UTC (rev 217750)
@@ -76,9 +76,6 @@
             this.contentTreeOutline.disclosureButtons = false;
             WebInspector.SourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, () => { this.contentTreeOutline.disclosureButtons = true; }, this);
         }
-
-        if (WebInspector.frameResourceManager.mainFrame)
-            this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);
     }
 
     // Public
@@ -192,6 +189,14 @@
 
     // Protected
 
+    initialLayout()
+    {
+        super.initialLayout();
+
+        if (WebInspector.frameResourceManager.mainFrame)
+            this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);
+    }
+
     hasCustomFilters()
     {
         console.assert(this._scopeBar.selectedItems.length === 1);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js (217749 => 217750)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js	2017-06-03 03:37:53 UTC (rev 217749)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js	2017-06-03 03:44:51 UTC (rev 217750)
@@ -73,7 +73,7 @@
         if (!(representedObject instanceof WebInspector.Resource) && !(representedObject instanceof WebInspector.Script) && !(representedObject instanceof WebInspector.DOMTree))
             return false;
 
-        return !!this._navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
+        return !!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
     }
 
     focusSearchField()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabContentView.js (217749 => 217750)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabContentView.js	2017-06-03 03:37:53 UTC (rev 217749)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabContentView.js	2017-06-03 03:44:51 UTC (rev 217750)
@@ -25,12 +25,12 @@
 
 WebInspector.TabContentView = class TabContentView extends WebInspector.ContentView
 {
-    constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanel, detailsSidebarPanelConstructors)
+    constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors)
     {
         console.assert(typeof identifier === "string");
         console.assert(typeof styleClassNames === "string" || styleClassNames.every((className) => typeof className === "string"));
         console.assert(tabBarItem instanceof WebInspector.TabBarItem);
-        console.assert(!navigationSidebarPanel || navigationSidebarPanel instanceof WebInspector.NavigationSidebarPanel);
+        console.assert(!navigationSidebarPanelConstructor || typeof navigationSidebarPanelConstructor === "function");
         console.assert(!detailsSidebarPanelConstructors || detailsSidebarPanelConstructors.every((detailsSidebarPanelConstructor) => typeof detailsSidebarPanelConstructor === "function"));
 
         super(null);
@@ -44,7 +44,7 @@
 
         this._identifier = identifier;
         this._tabBarItem = tabBarItem;
-        this._navigationSidebarPanel = navigationSidebarPanel || null;
+        this._navigationSidebarPanelConstructor = navigationSidebarPanelConstructor || null;
         this._detailsSidebarPanelConstructors = detailsSidebarPanelConstructors || [];
 
         const defaultSidebarWidth = 300;
@@ -173,7 +173,13 @@
         this._cookieSetting.value = cookie;
     }
 
-    get navigationSidebarPanel() { return this._navigationSidebarPanel; }
+    get navigationSidebarPanel()
+    {
+        if (!this._navigationSidebarPanelConstructor)
+            return null;
+        return WebInspector.instanceForClass(this._navigationSidebarPanelConstructor);
+    }
+
     get navigationSidebarCollapsedSetting() { return this._navigationSidebarCollapsedSetting; }
     get navigationSidebarWidthSetting() { return this._navigationSidebarWidthSetting; }
 
@@ -184,6 +190,7 @@
 
         return this._detailsSidebarPanels;
     }
+
     get detailsSidebarCollapsedSetting() { return this._detailsSidebarCollapsedSetting; }
     get detailsSidebarSelectedPanelSetting() { return this._detailsSidebarSelectedPanelSetting; }
     get detailsSidebarWidthSetting() { return this._detailsSidebarWidthSetting; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to