Title: [183762] trunk/Source/WebInspectorUI
Revision
183762
Author
[email protected]
Date
2015-05-04 12:33:38 -0700 (Mon, 04 May 2015)

Log Message

Web Inspector: Switching recordings in the Timeline navigation bar is broken
https://bugs.webkit.org/show_bug.cgi?id=144519

Reviewed by Joseph Pecoraro.

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype._hierarchicalPathComponentWasSelected): Use revealAndSelect
on the TreeElement instead of showing the representedObject directly. This fixes an exception in
TimelineRecordingContentView where it wouldn't be initialized with the TimelineSidebarPanel extra argument.
* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview.prototype.get visibleDuration): Fix an annoying assert. We show the view
early in construction, before it is in the document. Future updateLayout calls work and fix this.
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype.shown): Call _currentContentViewDidChange
to trigger the sidebar to update when this recording view is shown.
* UserInterface/Views/TimelineSidebarPanel.js:
(WebInspector.TimelineSidebarPanel.prototype._recordingsTreeElementSelected): Moved code from here...
(WebInspector.TimelineSidebarPanel.prototype._recordingSelected): ... to here. Take two different paths
to state restoration here. If the view existed before, use its state. If now, use the current state that
is captured by the cookie logic and explicitly restore it.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (183761 => 183762)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-05-04 19:28:23 UTC (rev 183761)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-05-04 19:33:38 UTC (rev 183762)
@@ -1,3 +1,26 @@
+2015-05-04  Timothy Hatcher  <[email protected]>
+
+        Web Inspector: Switching recordings in the Timeline navigation bar is broken
+        https://bugs.webkit.org/show_bug.cgi?id=144519
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype._hierarchicalPathComponentWasSelected): Use revealAndSelect
+        on the TreeElement instead of showing the representedObject directly. This fixes an exception in
+        TimelineRecordingContentView where it wouldn't be initialized with the TimelineSidebarPanel extra argument.
+        * UserInterface/Views/TimelineOverview.js:
+        (WebInspector.TimelineOverview.prototype.get visibleDuration): Fix an annoying assert. We show the view
+        early in construction, before it is in the document. Future updateLayout calls work and fix this.
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView.prototype.shown): Call _currentContentViewDidChange
+        to trigger the sidebar to update when this recording view is shown.
+        * UserInterface/Views/TimelineSidebarPanel.js:
+        (WebInspector.TimelineSidebarPanel.prototype._recordingsTreeElementSelected): Moved code from here...
+        (WebInspector.TimelineSidebarPanel.prototype._recordingSelected): ... to here. Take two different paths
+        to state restoration here. If the view existed before, use its state. If now, use the current state that
+        is captured by the cookie logic and explicitly restore it.
+
 2015-05-03  Timothy Hatcher  <[email protected]>
 
         Web Inspector: Exception under ContentViewContainer _disassociateFromContentView

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js (183761 => 183762)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2015-05-04 19:28:23 UTC (rev 183761)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2015-05-04 19:33:38 UTC (rev 183762)
@@ -573,7 +573,7 @@
         if (!treeElement)
             return;
 
-        this.showContentViewForRepresentedObject(treeElement.representedObject);
+        treeElement.revealAndSelect();
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (183761 => 183762)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-05-04 19:28:23 UTC (rev 183761)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-05-04 19:33:38 UTC (rev 183762)
@@ -184,7 +184,8 @@
     {
         if (isNaN(this._cachedScrollContainerWidth)) {
             this._cachedScrollContainerWidth = this._scrollContainerElement.offsetWidth;
-            console.assert(this._cachedScrollContainerWidth > 0);
+            if (!this._cachedScrollContainerWidth)
+                this._cachedScrollContainerWidth = NaN;
         }
 
         return this._cachedScrollContainerWidth * this._durationPerPixel;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (183761 => 183762)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-05-04 19:28:23 UTC (rev 183761)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-05-04 19:33:38 UTC (rev 183762)
@@ -170,6 +170,8 @@
         this._contentViewContainer.shown();
         this._clearTimelineNavigationItem.enabled = this._recording.isWritable();
 
+        this._currentContentViewDidChange();
+
         if (!this._updating && WebInspector.timelineManager.activeRecording === this._recording && WebInspector.timelineManager.isCapturing())
             this._startUpdatingCurrentTime();
     },

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js (183761 => 183762)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2015-05-04 19:28:23 UTC (rev 183761)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2015-05-04 19:33:38 UTC (rev 183762)
@@ -395,20 +395,8 @@
     _recordingsTreeElementSelected(treeElement, selectedByUser)
     {
         console.assert(treeElement.representedObject instanceof WebInspector.TimelineRecording);
-        console.assert(!selectedByUser, "Recording tree elements should be hidden and only programmatically selectable.");
 
         this._recordingSelected(treeElement.representedObject);
-
-        // Deselect or re-select the timeline tree element for the timeline view being displayed.
-        var currentTimelineView = this._displayedContentView.currentTimelineView;
-        if (currentTimelineView && currentTimelineView.representedObject instanceof WebInspector.Timeline) {
-            var wasSelectedByUser = false; // This is a simulated selection.
-            var shouldSuppressOnSelect = false;
-            this._timelineTreeElementMap.get(currentTimelineView.representedObject).select(true, wasSelectedByUser, shouldSuppressOnSelect, true);
-        } else if (this._timelinesTreeOutline.selectedTreeElement)
-            this._timelinesTreeOutline.selectedTreeElement.deselect();
-
-        this.updateFilter();
     }
 
     _renderingFrameTimelineTimesUpdated(event)
@@ -503,9 +491,32 @@
         for (var timeline of recording.timelines.values())
             this._timelineAdded(timeline);
 
-        this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, false, {timelineSidebarPanel: this});
-        if (this.selected)
-            this.contentBrowser.showContentView(this._displayedContentView);
+        // Save the current state incase we need to restore it to a new recording.
+        var cookie = {};
+        this.saveStateToCookie(cookie);
+
+        // Try to get the recording content view if it exists already, if it does we don't want to restore the cookie.
+        var _onlyExisting_ = true;
+        this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, onlyExisting, {timelineSidebarPanel: this});
+        if (this._displayedContentView) {
+            // Show the timeline that was being shown to update the sidebar tree state.
+            var currentTimelineView = this._displayedContentView.currentTimelineView;
+            if (currentTimelineView && currentTimelineView.representedObject instanceof WebInspector.Timeline)
+                this.showTimelineViewForTimeline(currentTimelineView.representedObject);
+            else
+                this.showTimelineOverview();
+
+            this.updateFilter();
+            return;
+        }
+
+        _onlyExisting_ = false;
+        this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, onlyExisting, {timelineSidebarPanel: this});
+
+        // Restore the cookie to carry over the previous recording view state to the new recording.
+        this.restoreStateFromCookie(cookie);
+
+        this.updateFilter();
     }
 
     _recordingLoaded(event)
@@ -534,6 +545,7 @@
             button.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked, this.showTimelineOverview, this);
             timelineTreeElement.status = button.element;
         }.bind(this));
+
         this._timelinesTreeOutline.appendChild(timelineTreeElement);
         this._timelineTreeElementMap.set(timeline, timelineTreeElement);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to