Title: [183821] trunk/Source/WebInspectorUI
Revision
183821
Author
[email protected]
Date
2015-05-05 11:11:50 -0700 (Tue, 05 May 2015)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (183820 => 183821)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-05-05 18:11:50 UTC (rev 183821)
@@ -1,5 +1,69 @@
 2015-05-05  Timothy Hatcher  <[email protected]>
 
+        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.
+
+2015-05-05  Timothy Hatcher  <[email protected]>
+
         Web Inspector: Fix some issues with Search tabs
         https://bugs.webkit.org/show_bug.cgi?id=144531
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -188,6 +188,7 @@
 
         this._status = x || "";
         this._updateStatusElement();
+        this.didChange();
     }
 
     get filterableData()
@@ -219,9 +220,8 @@
 
         this._listItemNode.classList.add("item");
 
-        if (this._classNames) {
+        if (this._classNames)
             this._listItemNode.classList.add(...this._classNames);
-        }
 
         if (this._small)
             this._listItemNode.classList.add(WebInspector.GeneralTreeElement.SmallStyleClassName);
@@ -231,6 +231,8 @@
 
         this._listItemNode.appendChild(this._disclosureButton);
         this._listItemNode.appendChild(this._iconElement);
+        if (this._statusElement)
+            this._listItemNode.appendChild(this._statusElement);
         this._listItemNode.appendChild(this._titlesElement);
 
         if (this.oncontextmenu && typeof this._oncontextmenu_ === "function") {
@@ -242,8 +244,6 @@
             this._boundContextMenuEventHandler = function(event) { this.treeOutline.oncontextmenu(event, this); }.bind(this);
             this._listItemNode.addEventListener("contextmenu", this._boundContextMenuEventHandler);
         }
-
-        this._updateStatusElement();
     }
 
     ondetach()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -388,6 +388,11 @@
         treeElement.hidden = true;
     }
 
+    treeElementAddedOrChanged(treeElement)
+    {
+        // Implemented by subclasses if needed.
+    }
+
     show()
     {
         if (!this.parentSidebar)
@@ -520,6 +525,8 @@
 
         if (this.selected)
             this._checkElementsForPendingViewStateCookie(treeElement);
+
+        this.treeElementAddedOrChanged(treeElement);
     }
 
     _treeElementExpandedOrCollapsed(treeElement)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -154,15 +154,21 @@
 
     // Protected
 
+    canShowContentViewForTreeElement: function(treeElement)
+    {
+        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement)
+            return true;
+        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
+    },
+
     showContentViewForTreeElement: function(treeElement)
     {
         if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
             WebInspector.showSourceCode(treeElement.representedObject);
-            return true;
+            return;
         }
 
         console.error("Unknown tree element selected.", treeElement);
-        return false;
     },
 
     treeElementPathComponentSelected: function(event)
@@ -176,7 +182,7 @@
     treeElementSelected: function(treeElement, selectedByUser)
     {
         if (this._dataGrid.shouldIgnoreSelectionEvent())
-            return false;
+            return;
 
         WebInspector.TimelineView.prototype.treeElementSelected.call(this, treeElement, selectedByUser);
     },
@@ -221,26 +227,5 @@
     _dataGridNodeSelected: function(event)
     {
         this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-    },
-
-    _updateTreeElementWithCloseButton: function(treeElement)
-    {
-        if (this._closeStatusButton) {
-            treeElement.status = this._closeStatusButton.element;
-            return;
-        }
-
-        wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
-            this._closeStatusButton = new WebInspector.TreeElementStatusButton(element);
-            this._closeStatusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._closeStatusButtonClicked, this);
-            if (treeElement === this.navigationSidebarTreeOutline.selectedTreeElement)
-                this._updateTreeElementWithCloseButton(treeElement);
-        }.bind(this));
-    },
-
-    _closeStatusButtonClicked: function(event)
-    {
-        this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
-        this.timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -27,9 +27,6 @@
 {
     WebInspector.TimelineView.call(this, recording, extraArguments);
 
-    this.navigationSidebarTreeOutline._onselect_ = this._treeElementSelected.bind(this);
-    this.navigationSidebarTreeOutline._ondeselect_ = this._treeElementDeselected.bind(this);
-
     this._recording = recording;
 
     var columns = {"graph": {width: "100%"}};
@@ -159,6 +156,33 @@
         dataGridNode.revealAndSelect();
     },
 
+    canShowContentViewForTreeElement: function(treeElement)
+    {
+        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement)
+            return true;
+        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
+    },
+
+    showContentViewForTreeElement: function(treeElement)
+    {
+        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
+            WebInspector.showSourceCode(treeElement.representedObject);
+            return;
+        }
+
+        if (!(treeElement instanceof WebInspector.SourceCodeTimelineTreeElement)) {
+            console.error("Unknown tree element selected.");
+            return;
+        }
+
+        if (!treeElement.sourceCodeTimeline.sourceCodeLocation) {
+            this.timelineSidebarPanel.showTimelineOverview();
+            return;
+        }
+
+        WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
+    },
+
     // Private
 
     _compareTreeElementsByDetails: function(a, b)
@@ -329,61 +353,5 @@
     _dataGridNodeSelected: function(event)
     {
         this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-    },
-
-    _treeElementDeselected: function(treeElement)
-    {
-        if (treeElement.status)
-            treeElement.status = "";
-    },
-
-    _treeElementSelected: function(treeElement, selectedByUser)
-    {
-        if (!this.timelineSidebarPanel.canShowDifferentContentView())
-            return;
-
-        if (treeElement instanceof WebInspector.FolderTreeElement)
-            return;
-
-        if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
-            WebInspector.showSourceCode(treeElement.representedObject);
-            this._updateTreeElementWithCloseButton(treeElement);
-            return;
-        }
-
-        if (!(treeElement instanceof WebInspector.SourceCodeTimelineTreeElement)) {
-            console.error("Unknown tree element selected.");
-            return;
-        }
-
-        if (!treeElement.sourceCodeTimeline.sourceCodeLocation) {
-            this.timelineSidebarPanel.showTimelineOverview();
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-            return;
-        }
-
-        WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
-        this._updateTreeElementWithCloseButton(treeElement);
-    },
-
-    _updateTreeElementWithCloseButton: function(treeElement)
-    {
-        if (this._closeStatusButton) {
-            treeElement.status = this._closeStatusButton.element;
-            return;
-        }
-
-        wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
-            this._closeStatusButton = new WebInspector.TreeElementStatusButton(element);
-            this._closeStatusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._closeStatusButtonClicked, this);
-            if (treeElement === this.navigationSidebarTreeOutline.selectedTreeElement)
-                this._updateTreeElementWithCloseButton(treeElement);
-        }.bind(this));
-    },
-
-    _closeStatusButtonClicked: function(event)
-    {
-        this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
-        this.timelineSidebarPanel.showTimelineOverview();
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -156,14 +156,22 @@
 
     // Protected
 
+    canShowContentViewForTreeElement: function(treeElement)
+    {
+        if (treeElement instanceof WebInspector.ProfileNodeTreeElement)
+            return !!treeElement.profileNode.sourceCodeLocation;
+        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
+    },
+
     showContentViewForTreeElement: function(treeElement)
     {
-        if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) {
-            WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
-            return true;
+        if (treeElement instanceof WebInspector.ProfileNodeTreeElement) {
+            if (treeElement.profileNode.sourceCodeLocation)
+                WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
+            return;
         }
 
-        return WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
+        WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
     },
 
     treeElementSelected: function(treeElement, selectedByUser)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -116,17 +116,8 @@
             return value ? WebInspector.UIString("Yes") : WebInspector.UIString("No");
 
         case "domain":
-            var fragment = document.createDocumentFragment();
+            return value || emptyValuePlaceholderString;
 
-            var goToButton = WebInspector.createGoToArrowButton();
-            goToButton.addEventListener("click", this._goToResource.bind(this));
-            fragment.appendChild(goToButton);
-
-            var text = document.createTextNode(value || emptyValuePlaceholderString);
-            fragment.appendChild(text);
-
-            return fragment;
-
         case "size":
         case "transferSize":
             return isNaN(value) ? emptyValuePlaceholderString : Number.bytesToString(value, true);
@@ -167,11 +158,6 @@
         this._scheduledRefreshIdentifier = requestAnimationFrame(this.refresh.bind(this));
     },
 
-    _goToResource: function(event)
-    {
-        WebInspector.showSourceCode(this._resource);
-    },
-
     _timelineRecordUpdated: function(event)
     {
         if (this.isRecordVisible(this._record))

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -169,14 +169,22 @@
 
     // Protected
 
+    canShowContentViewForTreeElement: function(treeElement)
+    {
+        if (treeElement instanceof WebInspector.ProfileNodeTreeElement)
+            return !!treeElement.profileNode.sourceCodeLocation;
+        return WebInspector.TimelineView.prototype.canShowContentViewForTreeElement(treeElement);
+    },
+
     showContentViewForTreeElement: function(treeElement)
     {
-        if (treeElement instanceof WebInspector.ProfileNodeTreeElement && treeElement.profileNode.sourceCodeLocation) {
-            WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
-            return true;
+        if (treeElement instanceof WebInspector.ProfileNodeTreeElement) {
+            if (treeElement.profileNode.sourceCodeLocation)
+                WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.profileNode.sourceCodeLocation);
+            return;
         }
 
-        return WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
+        WebInspector.TimelineView.prototype.showContentViewForTreeElement.call(this, treeElement);
     },
 
     treeElementPathComponentSelected: function(event)
@@ -190,7 +198,7 @@
     treeElementSelected: function(treeElement, selectedByUser)
     {
         if (this._dataGrid.shouldIgnoreSelectionEvent())
-            return false;
+            return;
 
         WebInspector.TimelineView.prototype.treeElementSelected.call(this, treeElement, selectedByUser);
     },

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -133,6 +133,11 @@
         return {text: [this.mainTitle, url || "", this._record.details || ""]};
     }
 
+    get sourceCodeLocation()
+    {
+        return this._sourceCodeLocation;
+    }
+
     // Protected
 
     onattach()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.css (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.css	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.css	2015-05-05 18:11:50 UTC (rev 183821)
@@ -193,6 +193,19 @@
     right: -16px;
 }
 
+.sidebar > .panel.navigation.timeline .item:not(:hover, .selected) .status .status-button,
+.sidebar > .panel.navigation.timeline .item:hover:not(.selected) .status .close.status-button {
+    display: none;
+}
+
+.sidebar > .panel.navigation.timeline:not(.timeline-recording-content-view-showing) .status .go-to-arrow.status-button {
+    display: none;
+}
+
+.sidebar > .panel.navigation.timeline.timeline-recording-content-view-showing .status .close.status-button {
+    display: none;
+}
+
 .sidebar > .panel.navigation.timeline > .timelines-content > .details-section > div.header {
     display: none;
 }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -354,8 +354,39 @@
         return this._displayedContentView.matchTreeElementAgainstCustomFilters(treeElement);
     }
 
+    treeElementAddedOrChanged(treeElement)
+    {
+        if (treeElement.status)
+            return;
+
+        if (!treeElement.treeOutline || typeof treeElement.treeOutline.__canShowContentViewForTreeElement !== "function")
+            return;
+
+        if (!treeElement.treeOutline.__canShowContentViewForTreeElement(treeElement))
+            return;
+
+        wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
+            var fragment = document.createDocumentFragment();
+
+            var closeButton = new WebInspector.TreeElementStatusButton(element);
+            closeButton.element.classList.add("close");
+            closeButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementCloseButtonClicked, this);
+            fragment.appendChild(closeButton.element);
+
+            var goToButton = new WebInspector.TreeElementStatusButton(WebInspector.createGoToArrowButton());
+            goToButton.__treeElement = treeElement;
+            goToButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._treeElementGoToArrowWasClicked, this);
+            fragment.appendChild(goToButton.element);
+
+            treeElement.status = fragment;
+        }.bind(this));
+    }
+
     canShowDifferentContentView()
     {
+        if (this._clickedTreeElementGoToArrow)
+            return true;
+
         if (this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView)
             return false;
 
@@ -409,6 +440,27 @@
 
     // Private
 
+    _treeElementGoToArrowWasClicked(event)
+    {
+        this._clickedTreeElementGoToArrow = true;
+
+        var treeElement = event.target.__treeElement;
+        console.assert(treeElement instanceof WebInspector.TreeElement);
+
+        treeElement.select(true, true);
+
+        this._clickedTreeElementGoToArrow = false;
+    }
+
+    _treeElementCloseButtonClicked(event)
+    {
+        var currentTimelineView = this._displayedContentView ? this._displayedContentView.currentTimelineView : null;
+        if (currentTimelineView && currentTimelineView.representedObject instanceof WebInspector.Timeline)
+            this.showTimelineViewForTimeline(currentTimelineView.representedObject);
+        else
+            this.showTimelineOverview();
+    }
+
     _recordingsTreeElementSelected(treeElement, selectedByUser)
     {
         console.assert(treeElement.representedObject instanceof WebInspector.TimelineRecording);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js	2015-05-05 18:11:50 UTC (rev 183821)
@@ -39,6 +39,7 @@
     this._contentTreeOutline = this._timelineSidebarPanel.createContentTreeOutline();
     this._contentTreeOutline._onselect_ = this.treeElementSelected.bind(this);
     this._contentTreeOutline._ondeselect_ = this.treeElementDeselected.bind(this);
+    this._contentTreeOutline.__canShowContentViewForTreeElement = this.canShowContentViewForTreeElement.bind(this);
 
     this.element.classList.add("timeline-view");
 
@@ -191,23 +192,31 @@
 
     // Protected
 
+    canShowContentViewForTreeElement: function(treeElement)
+    {
+        // Implemented by sub-classes if needed.
+
+        if (treeElement instanceof WebInspector.TimelineRecordTreeElement)
+            return !!treeElement.sourceCodeLocation;
+        return false;
+    },
+
     showContentViewForTreeElement: function(treeElement)
     {
         // Implemented by sub-classes if needed.
 
         if (!(treeElement instanceof WebInspector.TimelineRecordTreeElement)) {
             console.error("Unknown tree element selected.", treeElement);
-            return false;
+            return;
         }
 
-        var sourceCodeLocation = treeElement.record.sourceCodeLocation;
+        var sourceCodeLocation = treeElement.sourceCodeLocation;
         if (!sourceCodeLocation) {
             this._timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
-            return true;
+            return;
         }
 
         WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
-        return true;
     },
 
     treeElementPathComponentSelected: function(event)
@@ -218,9 +227,6 @@
     treeElementDeselected: function(treeElement)
     {
         // Implemented by sub-classes if needed.
-
-        if (this._closeStatusButton && treeElement.status === this._closeStatusButton.element)
-            treeElement.status = "";
     },
 
     treeElementSelected: function(treeElement, selectedByUser)
@@ -233,10 +239,7 @@
         if (treeElement instanceof WebInspector.FolderTreeElement)
             return;
 
-        if (!this.showContentViewForTreeElement(treeElement))
-            return;
-
-        this._updateTreeElementWithCloseButton(treeElement);
+        this.showContentViewForTreeElement(treeElement);
     },
 
     needsLayout: function()
@@ -248,30 +251,5 @@
             return;
 
         this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
-    },
-
-    // Private
-
-    _closeStatusButtonClicked: function(event)
-    {
-        if (this.navigationSidebarTreeOutline.selectedTreeElement)
-            this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
-
-        this._timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
-    },
-
-    _updateTreeElementWithCloseButton: function(treeElement)
-    {
-        if (this._closeStatusButton) {
-            treeElement.status = this._closeStatusButton.element;
-            return;
-        }
-
-        wrappedSVGDocument("Images/Close.svg", null, WebInspector.UIString("Close resource view"), function(element) {
-            this._closeStatusButton = new WebInspector.TreeElementStatusButton(element);
-            this._closeStatusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this._closeStatusButtonClicked, this);
-            if (treeElement === this.navigationSidebarTreeOutline.selectedTreeElement)
-                this._updateTreeElementWithCloseButton(treeElement);
-        }.bind(this));
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.css (183820 => 183821)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.css	2015-05-05 18:02:09 UTC (rev 183820)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.css	2015-05-05 18:11:50 UTC (rev 183821)
@@ -27,6 +27,7 @@
     width: 16px;
     height: 16px;
     display: inline-block;
+    vertical-align: middle;
 }
 
 .item > .status > .status-button > svg .filled {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to