Changeset 217750 in webkit


Ignore:
Timestamp:
Jun 2, 2017 8:44:51 PM (7 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebInspectorUI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r217749 r217750  
     12017-06-02  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Don't create NavigationSidebarPanel classes until they are needed by a Tab
     4        https://bugs.webkit.org/show_bug.cgi?id=172621
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Views/ContentBrowserTabContentView.js:
     9        (WebInspector.ContentBrowserTabContentView):
     10        (WebInspector.ContentBrowserTabContentView.prototype.shown):
     11        * UserInterface/Views/TabContentView.js:
     12        (WebInspector.TabContentView):
     13        (WebInspector.TabContentView.prototype.get navigationSidebarPanel):
     14
     15        * UserInterface/Views/NetworkTabContentView.js:
     16        (WebInspector.NetworkTabContentView.prototype.canShowRepresentedObject):
     17        * UserInterface/Views/SearchTabContentView.js:
     18        (WebInspector.SearchTabContentView.prototype.canShowRepresentedObject):
     19        Use public getter for navigationSidebarPanel.
     20
     21        * UserInterface/Views/ResourceSidebarPanel.js:
     22        (WebInspector.ResourceSidebarPanel):
     23        (WebInspector.ResourceSidebarPanel.prototype.initialLayout): Added.
     24        Load information about the current frame once the sidebar panel is displayed.
     25
    1262017-06-02  Devin Rousso  <drousso@apple.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js

    r217460 r217750  
    2626WebInspector.ContentBrowserTabContentView = class ContentBrowserTabContentView extends WebInspector.TabContentView
    2727{
    28     constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelClass, detailsSidebarPanelConstructors, disableBackForward)
     28    constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors, disableBackForward)
    2929    {
    3030        if (typeof styleClassNames === "string")
     
    3434
    3535        var contentBrowser = new WebInspector.ContentBrowser(null, null, disableBackForward);
    36         var navigationSidebarPanel = navigationSidebarPanelClass ? new navigationSidebarPanelClass(contentBrowser) : null;
    37 
    38         super(identifier, styleClassNames, tabBarItem, navigationSidebarPanel, detailsSidebarPanelConstructors);
     36
     37        super(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors);
    3938
    4039        this._contentBrowser = contentBrowser;
     
    5049        this._contentBrowser.updateHierarchicalPathForCurrentContentView();
    5150
    52         if (navigationSidebarPanel) {
     51        if (navigationSidebarPanelConstructor) {
    5352            let showToolTip = WebInspector.UIString("Show the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);
    5453            let hideToolTip = WebInspector.UIString("Hide the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);
     
    6160            this._contentBrowser.navigationBar.insertNavigationItem(this._showNavigationSidebarItem, 0);
    6261            this._contentBrowser.navigationBar.insertNavigationItem(new WebInspector.DividerNavigationItem, 1);
    63 
    64             navigationSidebarPanel.contentBrowser = this._contentBrowser;
    6562
    6663            WebInspector.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange, this._navigationSidebarCollapsedStateDidChange, this);
     
    10097        this._contentBrowser.shown();
    10198
    102         if (this.navigationSidebarPanel && !this._contentBrowser.currentContentView)
    103             this.navigationSidebarPanel.showDefaultContentView();
     99        if (this.navigationSidebarPanel) {
     100            if (!this.navigationSidebarPanel.contentBrowser)
     101                this.navigationSidebarPanel.contentBrowser = this._contentBrowser;
     102
     103            if (!this._contentBrowser.currentContentView)
     104                this.navigationSidebarPanel.showDefaultContentView();
     105        }
    104106    }
    105107
  • trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js

    r217460 r217750  
    6060            return false;
    6161
    62         return !!this._navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
     62        return !!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
    6363    }
    6464
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js

    r217505 r217750  
    7777            WebInspector.SourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, () => { this.contentTreeOutline.disclosureButtons = true; }, this);
    7878        }
    79 
    80         if (WebInspector.frameResourceManager.mainFrame)
    81             this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);
    8279    }
    8380
     
    192189
    193190    // Protected
     191
     192    initialLayout()
     193    {
     194        super.initialLayout();
     195
     196        if (WebInspector.frameResourceManager.mainFrame)
     197            this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);
     198    }
    194199
    195200    hasCustomFilters()
  • trunk/Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js

    r217460 r217750  
    7474            return false;
    7575
    76         return !!this._navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
     76        return !!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);
    7777    }
    7878
  • trunk/Source/WebInspectorUI/UserInterface/Views/TabContentView.js

    r217460 r217750  
    2626WebInspector.TabContentView = class TabContentView extends WebInspector.ContentView
    2727{
    28     constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanel, detailsSidebarPanelConstructors)
     28    constructor(identifier, styleClassNames, tabBarItem, navigationSidebarPanelConstructor, detailsSidebarPanelConstructors)
    2929    {
    3030        console.assert(typeof identifier === "string");
    3131        console.assert(typeof styleClassNames === "string" || styleClassNames.every((className) => typeof className === "string"));
    3232        console.assert(tabBarItem instanceof WebInspector.TabBarItem);
    33         console.assert(!navigationSidebarPanel || navigationSidebarPanel instanceof WebInspector.NavigationSidebarPanel);
     33        console.assert(!navigationSidebarPanelConstructor || typeof navigationSidebarPanelConstructor === "function");
    3434        console.assert(!detailsSidebarPanelConstructors || detailsSidebarPanelConstructors.every((detailsSidebarPanelConstructor) => typeof detailsSidebarPanelConstructor === "function"));
    3535
     
    4545        this._identifier = identifier;
    4646        this._tabBarItem = tabBarItem;
    47         this._navigationSidebarPanel = navigationSidebarPanel || null;
     47        this._navigationSidebarPanelConstructor = navigationSidebarPanelConstructor || null;
    4848        this._detailsSidebarPanelConstructors = detailsSidebarPanelConstructors || [];
    4949
     
    174174    }
    175175
    176     get navigationSidebarPanel() { return this._navigationSidebarPanel; }
     176    get navigationSidebarPanel()
     177    {
     178        if (!this._navigationSidebarPanelConstructor)
     179            return null;
     180        return WebInspector.instanceForClass(this._navigationSidebarPanelConstructor);
     181    }
     182
    177183    get navigationSidebarCollapsedSetting() { return this._navigationSidebarCollapsedSetting; }
    178184    get navigationSidebarWidthSetting() { return this._navigationSidebarWidthSetting; }
     
    185191        return this._detailsSidebarPanels;
    186192    }
     193
    187194    get detailsSidebarCollapsedSetting() { return this._detailsSidebarCollapsedSetting; }
    188195    get detailsSidebarSelectedPanelSetting() { return this._detailsSidebarSelectedPanelSetting; }
Note: See TracChangeset for help on using the changeset viewer.