Changeset 183821 in webkit


Ignore:
Timestamp:
May 5, 2015, 11:11:50 AM (11 years ago)
Author:
timothy@apple.com
Message:

REGRESSION: Web Inspector: no way to navigate to a resource/source location from overview timeline view
https://bugs.webkit.org/show_bug.cgi?id=144539

Reviewed by Brian Burg.

  • UserInterface/Views/GeneralTreeElement.js:

(WebInspector.GeneralTreeElement.prototype.set status): Call didChange() so the onchange event fires. This allows
TimelineSidebarPanel to update the status element when it goes from a spinner to empty for ResourceTreeElements.
(WebInspector.GeneralTreeElement.prototype.onattach): Don't call _updateStatusElement, just append it if needed.
Calling _updateStatusElement caused DOMNodeFragments as status elements to be appended a second time and fail.

  • UserInterface/Views/NavigationSidebarPanel.js:

(WebInspector.NavigationSidebarPanel.prototype.treeElementAddedOrChanged):
(WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):

  • UserInterface/Views/NetworkTimelineView.js:

(WebInspector.NetworkTimelineView.prototype.canShowContentViewForTreeElement):
(WebInspector.NetworkTimelineView.prototype.showContentViewForTreeElement):
(WebInspector.NetworkTimelineView.prototype.treeElementSelected):
(WebInspector.NetworkTimelineView.prototype._dataGridNodeSelected):
(WebInspector.NetworkTimelineView.prototype._updateTreeElementWithCloseButton): Deleted.
(WebInspector.NetworkTimelineView.prototype._closeStatusButtonClicked): Deleted.

  • UserInterface/Views/OverviewTimelineView.js:

(WebInspector.OverviewTimelineView.prototype.canShowContentViewForTreeElement):
(WebInspector.OverviewTimelineView.prototype.showContentViewForTreeElement):
(WebInspector.OverviewTimelineView.prototype._dataGridNodeSelected):
(WebInspector.OverviewTimelineView.prototype._treeElementDeselected): Deleted.
(WebInspector.OverviewTimelineView.prototype._treeElementSelected): Deleted.
(WebInspector.OverviewTimelineView.prototype._updateTreeElementWithCloseButton): Deleted.
(WebInspector.OverviewTimelineView.prototype._closeStatusButtonClicked): Deleted.

  • UserInterface/Views/RenderingFrameTimelineView.js:

(WebInspector.RenderingFrameTimelineView.prototype.canShowContentViewForTreeElement):
(WebInspector.RenderingFrameTimelineView.prototype.showContentViewForTreeElement):

  • UserInterface/Views/ResourceTimelineDataGridNode.js:

(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent): Don't show a go-to arrow in the Domain column.
(WebInspector.ResourceTimelineDataGridNode.prototype._goToResource): Deleted.

  • UserInterface/Views/ScriptTimelineView.js:

(WebInspector.ScriptTimelineView.prototype.canShowContentViewForTreeElement):
(WebInspector.ScriptTimelineView.prototype.showContentViewForTreeElement):
(WebInspector.ScriptTimelineView.prototype.treeElementSelected):

  • UserInterface/Views/TimelineRecordTreeElement.js:

(WebInspector.TimelineRecordTreeElement.prototype.get sourceCodeLocation):

  • UserInterface/Views/TimelineSidebarPanel.css:

(.sidebar > .panel.navigation.timeline .item:hover:not(.selected) .status .close.status-button):
(.sidebar > .panel.navigation.timeline:not(.timeline-recording-content-view-showing) .status .go-to-arrow.status-button):
(.sidebar > .panel.navigation.timeline.timeline-recording-content-view-showing .status .close.status-button):

  • UserInterface/Views/TimelineSidebarPanel.js:

(WebInspector.TimelineSidebarPanel.prototype.treeElementAddedOrChanged): Added.
(WebInspector.TimelineSidebarPanel.prototype.canShowDifferentContentView):
(WebInspector.TimelineSidebarPanel.prototype._treeElementGoToArrowWasClicked): Added.
(WebInspector.TimelineSidebarPanel.prototype._treeElementCloseButtonClicked): Added.

  • UserInterface/Views/TimelineView.js:

(WebInspector.TimelineView):
(WebInspector.TimelineView.prototype.canShowContentViewForTreeElement):
(WebInspector.TimelineView.prototype.showContentViewForTreeElement):
(WebInspector.TimelineView.prototype.treeElementDeselected):
(WebInspector.TimelineView.prototype.treeElementSelected):
(WebInspector.TimelineView.prototype.needsLayout):
(WebInspector.TimelineView.prototype._closeStatusButtonClicked): Deleted.
(WebInspector.TimelineView.prototype._updateTreeElementWithCloseButton): Deleted.

  • UserInterface/Views/TreeElementStatusButton.css:

(.item > .status > .status-button): Fix an alignment issue with close and go-to arrows being side-by-side.
Does not happen in the final patch because they are mutually exclusive, but still good to fix.

Location:
trunk/Source/WebInspectorUI
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r183816 r183821  
     12015-05-05  Timothy Hatcher  <timothy@apple.com>
     2
     3        REGRESSION: Web Inspector: no way to navigate to a resource/source location from overview timeline view
     4        https://bugs.webkit.org/show_bug.cgi?id=144539
     5
     6        Reviewed by Brian Burg.
     7
     8        * UserInterface/Views/GeneralTreeElement.js:
     9        (WebInspector.GeneralTreeElement.prototype.set status): Call didChange() so the onchange event fires. This allows
     10        TimelineSidebarPanel to update the status element when it goes from a spinner to empty for ResourceTreeElements.
     11        (WebInspector.GeneralTreeElement.prototype.onattach): Don't call _updateStatusElement, just append it if needed.
     12        Calling _updateStatusElement caused DOMNodeFragments as status elements to be appended a second time and fail.
     13        * UserInterface/Views/NavigationSidebarPanel.js:
     14        (WebInspector.NavigationSidebarPanel.prototype.treeElementAddedOrChanged):
     15        (WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):
     16        * UserInterface/Views/NetworkTimelineView.js:
     17        (WebInspector.NetworkTimelineView.prototype.canShowContentViewForTreeElement):
     18        (WebInspector.NetworkTimelineView.prototype.showContentViewForTreeElement):
     19        (WebInspector.NetworkTimelineView.prototype.treeElementSelected):
     20        (WebInspector.NetworkTimelineView.prototype._dataGridNodeSelected):
     21        (WebInspector.NetworkTimelineView.prototype._updateTreeElementWithCloseButton): Deleted.
     22        (WebInspector.NetworkTimelineView.prototype._closeStatusButtonClicked): Deleted.
     23        * UserInterface/Views/OverviewTimelineView.js:
     24        (WebInspector.OverviewTimelineView.prototype.canShowContentViewForTreeElement):
     25        (WebInspector.OverviewTimelineView.prototype.showContentViewForTreeElement):
     26        (WebInspector.OverviewTimelineView.prototype._dataGridNodeSelected):
     27        (WebInspector.OverviewTimelineView.prototype._treeElementDeselected): Deleted.
     28        (WebInspector.OverviewTimelineView.prototype._treeElementSelected): Deleted.
     29        (WebInspector.OverviewTimelineView.prototype._updateTreeElementWithCloseButton): Deleted.
     30        (WebInspector.OverviewTimelineView.prototype._closeStatusButtonClicked): Deleted.
     31        * UserInterface/Views/RenderingFrameTimelineView.js:
     32        (WebInspector.RenderingFrameTimelineView.prototype.canShowContentViewForTreeElement):
     33        (WebInspector.RenderingFrameTimelineView.prototype.showContentViewForTreeElement):
     34        * UserInterface/Views/ResourceTimelineDataGridNode.js:
     35        (WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent): Don't show a go-to arrow in the Domain column.
     36        (WebInspector.ResourceTimelineDataGridNode.prototype._goToResource): Deleted.
     37        * UserInterface/Views/ScriptTimelineView.js:
     38        (WebInspector.ScriptTimelineView.prototype.canShowContentViewForTreeElement):
     39        (WebInspector.ScriptTimelineView.prototype.showContentViewForTreeElement):
     40        (WebInspector.ScriptTimelineView.prototype.treeElementSelected):
     41        * UserInterface/Views/TimelineRecordTreeElement.js:
     42        (WebInspector.TimelineRecordTreeElement.prototype.get sourceCodeLocation):
     43        * UserInterface/Views/TimelineSidebarPanel.css:
     44        (.sidebar > .panel.navigation.timeline .item:hover:not(.selected) .status .close.status-button):
     45        (.sidebar > .panel.navigation.timeline:not(.timeline-recording-content-view-showing) .status .go-to-arrow.status-button):
     46        (.sidebar > .panel.navigation.timeline.timeline-recording-content-view-showing .status .close.status-button):
     47        * UserInterface/Views/TimelineSidebarPanel.js:
     48        (WebInspector.TimelineSidebarPanel.prototype.treeElementAddedOrChanged): Added.
     49        (WebInspector.TimelineSidebarPanel.prototype.canShowDifferentContentView):
     50        (WebInspector.TimelineSidebarPanel.prototype._treeElementGoToArrowWasClicked): Added.
     51        (WebInspector.TimelineSidebarPanel.prototype._treeElementCloseButtonClicked): Added.
     52        * UserInterface/Views/TimelineView.js:
     53        (WebInspector.TimelineView):
     54        (WebInspector.TimelineView.prototype.canShowContentViewForTreeElement):
     55        (WebInspector.TimelineView.prototype.showContentViewForTreeElement):
     56        (WebInspector.TimelineView.prototype.treeElementDeselected):
     57        (WebInspector.TimelineView.prototype.treeElementSelected):
     58        (WebInspector.TimelineView.prototype.needsLayout):
     59        (WebInspector.TimelineView.prototype._closeStatusButtonClicked): Deleted.
     60        (WebInspector.TimelineView.prototype._updateTreeElementWithCloseButton): Deleted.
     61        * UserInterface/Views/TreeElementStatusButton.css:
     62        (.item > .status > .status-button): Fix an alignment issue with close and go-to arrows being side-by-side.
     63        Does not happen in the final patch because they are mutually exclusive, but still good to fix.
     64
    1652015-05-05  Timothy Hatcher  <timothy@apple.com>
    266
  • trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js

    r182990 r183821  
    189189        this._status = x || "";
    190190        this._updateStatusElement();
     191        this.didChange();
    191192    }
    192193
     
    220221        this._listItemNode.classList.add("item");
    221222
    222         if (this._classNames) {
     223        if (this._classNames)
    223224            this._listItemNode.classList.add(...this._classNames);
    224         }
    225225
    226226        if (this._small)
     
    232232        this._listItemNode.appendChild(this._disclosureButton);
    233233        this._listItemNode.appendChild(this._iconElement);
     234        if (this._statusElement)
     235            this._listItemNode.appendChild(this._statusElement);
    234236        this._listItemNode.appendChild(this._titlesElement);
    235237
     
    243245            this._listItemNode.addEventListener("contextmenu", this._boundContextMenuEventHandler);
    244246        }
    245 
    246         this._updateStatusElement();
    247247    }
    248248
  • trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js

    r183713 r183821  
    389389    }
    390390
     391    treeElementAddedOrChanged(treeElement)
     392    {
     393        // Implemented by subclasses if needed.
     394    }
     395
    391396    show()
    392397    {
     
    521526        if (this.selected)
    522527            this._checkElementsForPendingViewStateCookie(treeElement);
     528
     529        this.treeElementAddedOrChanged(treeElement);
    523530    }
    524531
  • trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js

    r183764 r183821  
    155155    // Protected
    156156
     157    canShowContentViewForTreeElement: function(treeElement)
     158    {
     159        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement)
     160            return true;
     161        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
     162    },
     163
    157164    showContentViewForTreeElement: function(treeElement)
    158165    {
    159166        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
    160167            WebInspector.showSourceCode(treeElement.representedObject);
    161             return true;
     168            return;
    162169        }
    163170
    164171        console.error("Unknown tree element selected.", treeElement);
    165         return false;
    166172    },
    167173
     
    177183    {
    178184        if (this._dataGrid.shouldIgnoreSelectionEvent())
    179             return false;
     185            return;
    180186
    181187        WebInspector.TimelineView.prototype.treeElementSelected.call(this, treeElement, selectedByUser);
     
    222228    {
    223229        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
    224     },
    225 
    226     _updateTreeElementWithCloseButton: function(treeElement)
    227     {
    228         if (this._closeStatusButton) {
    229             treeElement.status = this._closeStatusButton.element;
    230             return;
    231         }
    232 
    233         wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
    234             this._closeStatusButton = new WebInspector.TreeElementStatusButton(element);
    235             this._closeStatusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._closeStatusButtonClicked, this);
    236             if (treeElement === this.navigationSidebarTreeOutline.selectedTreeElement)
    237                 this._updateTreeElementWithCloseButton(treeElement);
    238         }.bind(this));
    239     },
    240 
    241     _closeStatusButtonClicked: function(event)
    242     {
    243         this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
    244         this.timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
    245230    }
    246231};
  • trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js

    r183764 r183821  
    2828    WebInspector.TimelineView.call(this, recording, extraArguments);
    2929
    30     this.navigationSidebarTreeOutline.onselect = this._treeElementSelected.bind(this);
    31     this.navigationSidebarTreeOutline.ondeselect = this._treeElementDeselected.bind(this);
    32 
    3330    this._recording = recording;
    3431
     
    160157    },
    161158
     159    canShowContentViewForTreeElement: function(treeElement)
     160    {
     161        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement)
     162            return true;
     163        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
     164    },
     165
     166    showContentViewForTreeElement: function(treeElement)
     167    {
     168        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
     169            WebInspector.showSourceCode(treeElement.representedObject);
     170            return;
     171        }
     172
     173        if (!(treeElement instanceof WebInspector.SourceCodeTimelineTreeElement)) {
     174            console.error("Unknown tree element selected.");
     175            return;
     176        }
     177
     178        if (!treeElement.sourceCodeTimeline.sourceCodeLocation) {
     179            this.timelineSidebarPanel.showTimelineOverview();
     180            return;
     181        }
     182
     183        WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
     184    },
     185
    162186    // Private
    163187
     
    330354    {
    331355        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
    332     },
    333 
    334     _treeElementDeselected: function(treeElement)
    335     {
    336         if (treeElement.status)
    337             treeElement.status = "";
    338     },
    339 
    340     _treeElementSelected: function(treeElement, selectedByUser)
    341     {
    342         if (!this.timelineSidebarPanel.canShowDifferentContentView())
    343             return;
    344 
    345         if (treeElement instanceof WebInspector.FolderTreeElement)
    346             return;
    347 
    348         if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
    349             WebInspector.showSourceCode(treeElement.representedObject);
    350             this._updateTreeElementWithCloseButton(treeElement);
    351             return;
    352         }
    353 
    354         if (!(treeElement instanceof WebInspector.SourceCodeTimelineTreeElement)) {
    355             console.error("Unknown tree element selected.");
    356             return;
    357         }
    358 
    359         if (!treeElement.sourceCodeTimeline.sourceCodeLocation) {
    360             this.timelineSidebarPanel.showTimelineOverview();
    361             this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
    362             return;
    363         }
    364 
    365         WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
    366         this._updateTreeElementWithCloseButton(treeElement);
    367     },
    368 
    369     _updateTreeElementWithCloseButton: function(treeElement)
    370     {
    371         if (this._closeStatusButton) {
    372             treeElement.status = this._closeStatusButton.element;
    373             return;
    374         }
    375 
    376         wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
    377             this._closeStatusButton = new WebInspector.TreeElementStatusButton(element);
    378             this._closeStatusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._closeStatusButtonClicked, this);
    379             if (treeElement === this.navigationSidebarTreeOutline.selectedTreeElement)
    380                 this._updateTreeElementWithCloseButton(treeElement);
    381         }.bind(this));
    382     },
    383 
    384     _closeStatusButtonClicked: function(event)
    385     {
    386         this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
    387         this.timelineSidebarPanel.showTimelineOverview();
    388356    }
    389357};
  • trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js

    r183764 r183821  
    157157    // Protected
    158158
     159    canShowContentViewForTreeElement: function(treeElement)
     160    {
     161        if (treeElement instanceof WebInspector.ProfileNodeTreeElement)
     162            return !!treeElement.profileNode.sourceCodeLocation;
     163        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
     164    },
     165
    159166    showContentViewForTreeElement: function(treeElement)
    160167    {
    161         if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) {
    162             WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
    163             return true;
     168        if (treeElement instanceof WebInspector.ProfileNodeTreeElement) {
     169            if (treeElement.profileNode.sourceCodeLocation)
     170                WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
     171            return;
    164172        }
    165173
    166         return WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
     174        WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
    167175    },
    168176
  • trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js

    r183331 r183821  
    117117
    118118        case "domain":
    119             var fragment = document.createDocumentFragment();
    120 
    121             var goToButton = WebInspector.createGoToArrowButton();
    122             goToButton.addEventListener("click", this._goToResource.bind(this));
    123             fragment.appendChild(goToButton);
    124 
    125             var text = document.createTextNode(value || emptyValuePlaceholderString);
    126             fragment.appendChild(text);
    127 
    128             return fragment;
     119            return value || emptyValuePlaceholderString;
    129120
    130121        case "size":
     
    168159    },
    169160
    170     _goToResource: function(event)
    171     {
    172         WebInspector.showSourceCode(this._resource);
    173     },
    174 
    175161    _timelineRecordUpdated: function(event)
    176162    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js

    r183764 r183821  
    170170    // Protected
    171171
     172    canShowContentViewForTreeElement: function(treeElement)
     173    {
     174        if (treeElement instanceof WebInspector.ProfileNodeTreeElement)
     175            return !!treeElement.profileNode.sourceCodeLocation;
     176        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
     177    },
     178
    172179    showContentViewForTreeElement: function(treeElement)
    173180    {
    174         if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) {
    175             WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
    176             return true;
    177         }
    178 
    179         return WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
     181        if (treeElement instanceof WebInspector.ProfileNodeTreeElement) {
     182            if (treeElement.profileNode.sourceCodeLocation)
     183                WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
     184            return;
     185        }
     186
     187        WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
    180188    },
    181189
     
    191199    {
    192200        if (this._dataGrid.shouldIgnoreSelectionEvent())
    193             return false;
     201            return;
    194202
    195203        WebInspector.TimelineView.prototype.treeElementSelected.call(this, treeElement, selectedByUser);
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js

    r182660 r183821  
    134134    }
    135135
     136    get sourceCodeLocation()
     137    {
     138        return this._sourceCodeLocation;
     139    }
     140
    136141    // Protected
    137142
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.css

    r183721 r183821  
    194194}
    195195
     196.sidebar > .panel.navigation.timeline .item:not(:hover, .selected) .status .status-button,
     197.sidebar > .panel.navigation.timeline .item:hover:not(.selected) .status .close.status-button {
     198    display: none;
     199}
     200
     201.sidebar > .panel.navigation.timeline:not(.timeline-recording-content-view-showing) .status .go-to-arrow.status-button {
     202    display: none;
     203}
     204
     205.sidebar > .panel.navigation.timeline.timeline-recording-content-view-showing .status .close.status-button {
     206    display: none;
     207}
     208
    196209.sidebar > .panel.navigation.timeline > .timelines-content > .details-section > div.header {
    197210    display: none;
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js

    r183764 r183821  
    355355    }
    356356
     357    treeElementAddedOrChanged(treeElement)
     358    {
     359        if (treeElement.status)
     360            return;
     361
     362        if (!treeElement.treeOutline || typeof treeElement.treeOutline.__canShowContentViewForTreeElement !== "function")
     363            return;
     364
     365        if (!treeElement.treeOutline.__canShowContentViewForTreeElement(treeElement))
     366            return;
     367
     368        wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
     369            var fragment = document.createDocumentFragment();
     370
     371            var closeButton = new WebInspector.TreeElementStatusButton(element);
     372            closeButton.element.classList.add("close");
     373            closeButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementCloseButtonClicked, this);
     374            fragment.appendChild(closeButton.element);
     375
     376            var goToButton = new WebInspector.TreeElementStatusButton(WebInspector.createGoToArrowButton());
     377            goToButton.__treeElement = treeElement;
     378            goToButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementGoToArrowWasClicked, this);
     379            fragment.appendChild(goToButton.element);
     380
     381            treeElement.status = fragment;
     382        }.bind(this));
     383    }
     384
    357385    canShowDifferentContentView()
    358386    {
     387        if (this._clickedTreeElementGoToArrow)
     388            return true;
     389
    359390        if (this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView)
    360391            return false;
     
    409440
    410441    // Private
     442
     443    _treeElementGoToArrowWasClicked(event)
     444    {
     445        this._clickedTreeElementGoToArrow = true;
     446
     447        var treeElement = event.target.__treeElement;
     448        console.assert(treeElement instanceof WebInspector.TreeElement);
     449
     450        treeElement.select(true, true);
     451
     452        this._clickedTreeElementGoToArrow = false;
     453    }
     454
     455    _treeElementCloseButtonClicked(event)
     456    {
     457        var currentTimelineView = this._displayedContentView ? this._displayedContentView.currentTimelineView : null;
     458        if (currentTimelineView && currentTimelineView.representedObject instanceof WebInspector.Timeline)
     459            this.showTimelineViewForTimeline(currentTimelineView.representedObject);
     460        else
     461            this.showTimelineOverview();
     462    }
    411463
    412464    _recordingsTreeElementSelected(treeElement, selectedByUser)
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js

    r183579 r183821  
    4040    this._contentTreeOutline.onselect = this.treeElementSelected.bind(this);
    4141    this._contentTreeOutline.ondeselect = this.treeElementDeselected.bind(this);
     42    this._contentTreeOutline.__canShowContentViewForTreeElement = this.canShowContentViewForTreeElement.bind(this);
    4243
    4344    this.element.classList.add("timeline-view");
     
    192193    // Protected
    193194
     195    canShowContentViewForTreeElement: function(treeElement)
     196    {
     197        // Implemented by sub-classes if needed.
     198
     199        if (treeElement instanceof WebInspector.TimelineRecordTreeElement)
     200            return !!treeElement.sourceCodeLocation;
     201        return false;
     202    },
     203
    194204    showContentViewForTreeElement: function(treeElement)
    195205    {
     
    198208        if (!(treeElement instanceof WebInspector.TimelineRecordTreeElement)) {
    199209            console.error("Unknown tree element selected.", treeElement);
    200             return false;
    201         }
    202 
    203         var sourceCodeLocation = treeElement.record.sourceCodeLocation;
     210            return;
     211        }
     212
     213        var sourceCodeLocation = treeElement.sourceCodeLocation;
    204214        if (!sourceCodeLocation) {
    205215            this._timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
    206             return true;
     216            return;
    207217        }
    208218
    209219        WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
    210         return true;
    211220    },
    212221
     
    219228    {
    220229        // Implemented by sub-classes if needed.
    221 
    222         if (this._closeStatusButton && treeElement.status === this._closeStatusButton.element)
    223             treeElement.status = "";
    224230    },
    225231
     
    234240            return;
    235241
    236         if (!this.showContentViewForTreeElement(treeElement))
    237             return;
    238 
    239         this._updateTreeElementWithCloseButton(treeElement);
     242        this.showContentViewForTreeElement(treeElement);
    240243    },
    241244
     
    249252
    250253        this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
    251     },
    252 
    253     // Private
    254 
    255     _closeStatusButtonClicked: function(event)
    256     {
    257         if (this.navigationSidebarTreeOutline.selectedTreeElement)
    258             this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
    259 
    260         this._timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
    261     },
    262 
    263     _updateTreeElementWithCloseButton: function(treeElement)
    264     {
    265         if (this._closeStatusButton) {
    266             treeElement.status = this._closeStatusButton.element;
    267             return;
    268         }
    269 
    270         wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
    271             this._closeStatusButton = new WebInspector.TreeElementStatusButton(element);
    272             this._closeStatusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._closeStatusButtonClicked, this);
    273             if (treeElement === this.navigationSidebarTreeOutline.selectedTreeElement)
    274                 this._updateTreeElementWithCloseButton(treeElement);
    275         }.bind(this));
    276254    }
    277255};
  • trunk/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.css

    r183579 r183821  
    2828    height: 16px;
    2929    display: inline-block;
     30    vertical-align: middle;
    3031}
    3132
Note: See TracChangeset for help on using the changeset viewer.