Web Inspector: Support passing extra arguments to ContentViews during construction
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:17:23 +0000 (01:17 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:17:23 +0000 (01:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144055

This allows us to pass the TimelineSidebarPanel to Timeline views since in the future
there could be multiple timeline sidebars, one per tab. So the global instance will
be going away.

This also removes the exception catching in ContentViewContainer. It doesn't really
help us and it makes debugging an exception harder.

Reviewed by Joseph Pecoraro.

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype.showContentViewForRepresentedObject):
(WebInspector.ContentBrowser.prototype.contentViewForRepresentedObject):
* UserInterface/Views/ContentView.js:
(WebInspector.ContentView):
* UserInterface/Views/ContentViewContainer.js:
(WebInspector.ContentViewContainer.prototype.contentViewForRepresentedObject):
(WebInspector.ContentViewContainer.prototype.showContentViewForRepresentedObject):
* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype._dataGridFiltersDidChange):
(WebInspector.LayoutTimelineView.prototype._treeElementSelected):
(WebInspector.LayoutTimelineView.prototype._closeStatusButtonClicked):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype._dataGridFiltersDidChange):
(WebInspector.NetworkTimelineView.prototype._treeElementSelected):
(WebInspector.NetworkTimelineView.prototype._closeStatusButtonClicked):
* UserInterface/Views/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype._treeElementSelected):
(WebInspector.OverviewTimelineView.prototype._closeStatusButtonClicked):
* UserInterface/Views/RenderingFrameTimelineView.js:
(WebInspector.RenderingFrameTimelineView):
* UserInterface/Views/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView):
(WebInspector.ScriptTimelineView.prototype._dataGridFiltersDidChange):
(WebInspector.ScriptTimelineView.prototype._treeElementSelected):
(WebInspector.ScriptTimelineView.prototype._closeStatusButtonClicked):
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
(WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
(WebInspector.TimelineRecordingContentView.prototype._contentViewSelectionPathComponentDidChange):
(WebInspector.TimelineRecordingContentView.prototype._updateTimes):
(WebInspector.TimelineRecordingContentView.prototype._timeRangeSelectionChanged):
* UserInterface/Views/TimelineSidebarPanel.js:
* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView):
(WebInspector.TimelineView.prototype.get timelineSidebarPanel):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183325 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/ContentView.js
Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js
Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js
Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js
Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js
Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js
Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/TimelineView.js

index 39f9059..1523a2b 100644 (file)
@@ -1,3 +1,54 @@
+2015-04-22  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: Support passing extra arguments to ContentViews during construction
+        https://bugs.webkit.org/show_bug.cgi?id=144055
+
+        This allows us to pass the TimelineSidebarPanel to Timeline views since in the future
+        there could be multiple timeline sidebars, one per tab. So the global instance will
+        be going away.
+
+        This also removes the exception catching in ContentViewContainer. It doesn't really
+        help us and it makes debugging an exception harder.
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype.showContentViewForRepresentedObject):
+        (WebInspector.ContentBrowser.prototype.contentViewForRepresentedObject):
+        * UserInterface/Views/ContentView.js:
+        (WebInspector.ContentView):
+        * UserInterface/Views/ContentViewContainer.js:
+        (WebInspector.ContentViewContainer.prototype.contentViewForRepresentedObject):
+        (WebInspector.ContentViewContainer.prototype.showContentViewForRepresentedObject):
+        * UserInterface/Views/LayoutTimelineView.js:
+        (WebInspector.LayoutTimelineView.prototype._dataGridFiltersDidChange):
+        (WebInspector.LayoutTimelineView.prototype._treeElementSelected):
+        (WebInspector.LayoutTimelineView.prototype._closeStatusButtonClicked):
+        * UserInterface/Views/NetworkTimelineView.js:
+        (WebInspector.NetworkTimelineView.prototype._dataGridFiltersDidChange):
+        (WebInspector.NetworkTimelineView.prototype._treeElementSelected):
+        (WebInspector.NetworkTimelineView.prototype._closeStatusButtonClicked):
+        * UserInterface/Views/OverviewTimelineView.js:
+        (WebInspector.OverviewTimelineView.prototype._treeElementSelected):
+        (WebInspector.OverviewTimelineView.prototype._closeStatusButtonClicked):
+        * UserInterface/Views/RenderingFrameTimelineView.js:
+        (WebInspector.RenderingFrameTimelineView):
+        * UserInterface/Views/ScriptTimelineView.js:
+        (WebInspector.ScriptTimelineView):
+        (WebInspector.ScriptTimelineView.prototype._dataGridFiltersDidChange):
+        (WebInspector.ScriptTimelineView.prototype._treeElementSelected):
+        (WebInspector.ScriptTimelineView.prototype._closeStatusButtonClicked):
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView):
+        (WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
+        (WebInspector.TimelineRecordingContentView.prototype._contentViewSelectionPathComponentDidChange):
+        (WebInspector.TimelineRecordingContentView.prototype._updateTimes):
+        (WebInspector.TimelineRecordingContentView.prototype._timeRangeSelectionChanged):
+        * UserInterface/Views/TimelineSidebarPanel.js:
+        * UserInterface/Views/TimelineView.js:
+        (WebInspector.TimelineView):
+        (WebInspector.TimelineView.prototype.get timelineSidebarPanel):
+
 2015-04-18  Timothy Hatcher  <timothy@apple.com>
 
         Web Inspector: Disable global keyboard shortcuts for background tabs
index 67a04bb..11b9d33 100644 (file)
@@ -171,9 +171,9 @@ WebInspector.ContentBrowser.prototype = {
         this._contentViewContainer.updateLayout();
     },
 
-    showContentViewForRepresentedObject: function(representedObject, cookie)
+    showContentViewForRepresentedObject: function(representedObject, cookie, extraArguments)
     {
-        var contentView = this.contentViewForRepresentedObject(representedObject);
+        var contentView = this.contentViewForRepresentedObject(representedObject, false, extraArguments);
         return this._contentViewContainer.showContentView(contentView, cookie);
     },
 
@@ -182,9 +182,9 @@ WebInspector.ContentBrowser.prototype = {
         return this._contentViewContainer.showContentView(contentView, cookie);
     },
 
-    contentViewForRepresentedObject: function(representedObject, onlyExisting)
+    contentViewForRepresentedObject: function(representedObject, onlyExisting, extraArguments)
     {
-        return this._contentViewContainer.contentViewForRepresentedObject(representedObject, onlyExisting);
+        return this._contentViewContainer.contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments);
     },
 
     canGoBack: function()
index 5d553e2..40abef7 100644 (file)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentView = function(representedObject)
+WebInspector.ContentView = function(representedObject, extraArguments)
 {
     if (this.constructor === WebInspector.ContentView) {
         // When instantiated directly return an instance of a type-based concrete subclass.
@@ -31,64 +31,64 @@ WebInspector.ContentView = function(representedObject)
         console.assert(representedObject);
 
         if (representedObject instanceof WebInspector.Frame)
-            return new WebInspector.FrameContentView(representedObject);
+            return new WebInspector.FrameContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.Resource)
-            return new WebInspector.ResourceClusterContentView(representedObject);
+            return new WebInspector.ResourceClusterContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.Script)
-            return new WebInspector.ScriptContentView(representedObject);
+            return new WebInspector.ScriptContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.TimelineRecording)
-            return new WebInspector.TimelineRecordingContentView(representedObject);
+            return new WebInspector.TimelineRecordingContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.Timeline) {
             var timelineType = representedObject.type;
             if (timelineType === WebInspector.TimelineRecord.Type.Network)
-                return new WebInspector.NetworkTimelineView(representedObject);
+                return new WebInspector.NetworkTimelineView(representedObject, extraArguments);
 
             if (timelineType === WebInspector.TimelineRecord.Type.Layout)
-                return new WebInspector.LayoutTimelineView(representedObject);
+                return new WebInspector.LayoutTimelineView(representedObject, extraArguments);
 
             if (timelineType === WebInspector.TimelineRecord.Type.Script)
-                return new WebInspector.ScriptTimelineView(representedObject);
+                return new WebInspector.ScriptTimelineView(representedObject, extraArguments);
 
             if (timelineType === WebInspector.TimelineRecord.Type.RenderingFrame)
-                return new WebInspector.RenderingFrameTimelineView(representedObject);
+                return new WebInspector.RenderingFrameTimelineView(representedObject, extraArguments);
         }
 
         if (representedObject instanceof WebInspector.DOMStorageObject)
-            return new WebInspector.DOMStorageContentView(representedObject);
+            return new WebInspector.DOMStorageContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.CookieStorageObject)
-            return new WebInspector.CookieStorageContentView(representedObject);
+            return new WebInspector.CookieStorageContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.DatabaseTableObject)
-            return new WebInspector.DatabaseTableContentView(representedObject);
+            return new WebInspector.DatabaseTableContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.DatabaseObject)
-            return new WebInspector.DatabaseContentView(representedObject);
+            return new WebInspector.DatabaseContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.IndexedDatabaseObjectStore)
-            return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject);
+            return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
-            return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject);
+            return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.ApplicationCacheFrame)
-            return new WebInspector.ApplicationCacheFrameContentView(representedObject);
+            return new WebInspector.ApplicationCacheFrameContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.DOMTree)
-            return new WebInspector.FrameDOMTreeContentView(representedObject);
+            return new WebInspector.FrameDOMTreeContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.LogObject)
-            return new WebInspector.LogContentView(representedObject);
+            return new WebInspector.LogContentView(representedObject, extraArguments);
 
         if (representedObject instanceof WebInspector.ContentFlow)
-            return new WebInspector.ContentFlowDOMTreeContentView(representedObject);
+            return new WebInspector.ContentFlowDOMTreeContentView(representedObject, extraArguments);
 
         if (typeof representedObject === "string" || representedObject instanceof String)
-            return new WebInspector.TextContentView(representedObject);
+            return new WebInspector.TextContentView(representedObject, extraArguments);
 
         console.assert(!WebInspector.ContentView.isViewable(representedObject));
 
index c8ef030..2a6789a 100644 (file)
@@ -82,7 +82,7 @@ WebInspector.ContentViewContainer.prototype = {
             currentContentView.updateLayout();
     },
 
-    contentViewForRepresentedObject: function(representedObject, onlyExisting)
+    contentViewForRepresentedObject: function(representedObject, onlyExisting, extraArguments)
     {
         console.assert(representedObject);
         if (!representedObject)
@@ -107,13 +107,12 @@ WebInspector.ContentViewContainer.prototype = {
         if (onlyExisting)
             return null;
 
-        try {
-            // No existing content view found, make a new one.
-            contentView = new WebInspector.ContentView(representedObject);
-        } catch (e) {
-            console.error(e);
+        // No existing content view found, make a new one.
+        contentView = new WebInspector.ContentView(representedObject, extraArguments);
+
+        console.assert(contentView, "Unknown representedObject", representedObject);
+        if (!contentView)
             return null;
-        }
 
         // Remember this content view for future calls.
         if (!representedObject.__contentViews)
@@ -123,9 +122,9 @@ WebInspector.ContentViewContainer.prototype = {
         return contentView;
     },
 
-    showContentViewForRepresentedObject: function(representedObject)
+    showContentViewForRepresentedObject: function(representedObject, extraArguments)
     {
-        var contentView = this.contentViewForRepresentedObject(representedObject);
+        var contentView = this.contentViewForRepresentedObject(representedObject, false, extraArguments);
         if (!contentView)
             return null;
 
index 02d4b60..ab7e454 100644 (file)
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayoutTimelineView = function(timeline)
+WebInspector.LayoutTimelineView = function(timeline, extraArguments)
 {
-    WebInspector.TimelineView.call(this, timeline);
+    WebInspector.TimelineView.call(this, timeline, extraArguments);
 
     console.assert(timeline.type === WebInspector.TimelineRecord.Type.Layout);
 
@@ -209,7 +209,7 @@ WebInspector.LayoutTimelineView.prototype = {
 
     _dataGridFiltersDidChange: function(event)
     {
-        WebInspector.timelineSidebarPanel.updateFilter();
+        this.timelineSidebarPanel.updateFilter();
     },
 
     _dataGridNodeSelected: function(event)
index 6af16e7..a5ffff2 100644 (file)
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkTimelineView = function(timeline)
+WebInspector.NetworkTimelineView = function(timeline, extraArguments)
 {
-    WebInspector.TimelineView.call(this, timeline);
+    WebInspector.TimelineView.call(this, timeline, extraArguments);
 
     console.assert(timeline.type === WebInspector.TimelineRecord.Type.Network);
 
@@ -209,7 +209,7 @@ WebInspector.NetworkTimelineView.prototype = {
 
     _dataGridFiltersDidChange: function(event)
     {
-        WebInspector.timelineSidebarPanel.updateFilter();
+        this.timelineSidebarPanel.updateFilter();
     },
 
     _dataGridNodeSelected: function(event)
@@ -235,6 +235,6 @@ WebInspector.NetworkTimelineView.prototype = {
     _closeStatusButtonClicked: function(event)
     {
         this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
-        WebInspector.timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
+        this.timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
     }
 };
index bd80ed2..1e1b687 100644 (file)
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.OverviewTimelineView = function(recording)
+WebInspector.OverviewTimelineView = function(recording, extraArguments)
 {
-    WebInspector.TimelineView.call(this, recording);
+    WebInspector.TimelineView.call(this, recording, extraArguments);
 
     this.navigationSidebarTreeOutline.onselect = this._treeElementSelected.bind(this);
     this.navigationSidebarTreeOutline.ondeselect = this._treeElementDeselected.bind(this);
@@ -38,7 +38,7 @@ WebInspector.OverviewTimelineView = function(recording)
     this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
     this._dataGrid.element.classList.add("no-header");
 
-    this._treeOutlineDataGridSynchronizer = new WebInspector.TreeOutlineDataGridSynchronizer(this._contentTreeOutline, this._dataGrid);
+    this._treeOutlineDataGridSynchronizer = new WebInspector.TreeOutlineDataGridSynchronizer(this.navigationSidebarTreeOutline, this._dataGrid);
 
     this._timelineRuler = new WebInspector.TimelineRuler;
     this._timelineRuler.allowsClippedLabels = true;
@@ -333,7 +333,7 @@ WebInspector.OverviewTimelineView.prototype = {
 
     _treeElementSelected: function(treeElement, selectedByUser)
     {
-        if (!WebInspector.timelineSidebarPanel.canShowDifferentContentView())
+        if (!this.timelineSidebarPanel.canShowDifferentContentView())
             return;
 
         if (treeElement instanceof WebInspector.FolderTreeElement)
@@ -351,7 +351,7 @@ WebInspector.OverviewTimelineView.prototype = {
         }
 
         if (!treeElement.sourceCodeTimeline.sourceCodeLocation) {
-            WebInspector.timelineSidebarPanel.showTimelineOverview();
+            this.timelineSidebarPanel.showTimelineOverview();
             this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
             return;
         }
@@ -378,6 +378,6 @@ WebInspector.OverviewTimelineView.prototype = {
     _closeStatusButtonClicked: function(event)
     {
         this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
-        WebInspector.timelineSidebarPanel.showTimelineOverview();
+        this.timelineSidebarPanel.showTimelineOverview();
     }
 };
index f23dee0..ccc201e 100644 (file)
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RenderingFrameTimelineView = function(timeline)
+WebInspector.RenderingFrameTimelineView = function(timeline, extraArguments)
 {
-    WebInspector.TimelineView.call(this, timeline);
+    WebInspector.TimelineView.call(this, timeline, extraArguments);
 
     console.assert(WebInspector.TimelineRecord.Type.RenderingFrame);
 
index 2f5d1b8..aa67187 100644 (file)
@@ -23,9 +23,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ScriptTimelineView = function(timeline)
+WebInspector.ScriptTimelineView = function(timeline, extraArguments)
 {
-    WebInspector.TimelineView.call(this, timeline);
+    WebInspector.TimelineView.call(this, timeline, extraArguments);
 
     console.assert(timeline.type === WebInspector.TimelineRecord.Type.Script);
 
@@ -254,7 +254,7 @@ WebInspector.ScriptTimelineView.prototype = {
 
     _dataGridFiltersDidChange: function(event)
     {
-        WebInspector.timelineSidebarPanel.updateFilter();
+        this.timelineSidebarPanel.updateFilter();
     },
 
     _dataGridNodeSelected: function(event)
index c00a5bb..6f0140f 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineRecordingContentView = function(recording)
+WebInspector.TimelineRecordingContentView = function(recording, extraArguments)
 {
+    console.assert(extraArguments);
+    console.assert(extraArguments.timelineSidebarPanel instanceof WebInspector.TimelineSidebarPanel);
+
     WebInspector.ContentView.call(this, recording);
 
     this._recording = recording;
+    this._timelineSidebarPanel = extraArguments.timelineSidebarPanel;
 
     this.element.classList.add(WebInspector.TimelineRecordingContentView.StyleClassName);
 
@@ -49,7 +53,7 @@ WebInspector.TimelineRecordingContentView = function(recording)
     this._clearTimelineNavigationItem = new WebInspector.ButtonNavigationItem("clear-timeline", WebInspector.UIString("Clear Timeline"), trashImage.src, trashImage.width, trashImage.height);
     this._clearTimelineNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearTimeline, this);
 
-    this._overviewTimelineView = new WebInspector.OverviewTimelineView(recording);
+    this._overviewTimelineView = new WebInspector.OverviewTimelineView(recording, {timelineSidebarPanel: this._timelineSidebarPanel});
     this._overviewTimelineView.secondsPerPixel = this._timelineOverview.secondsPerPixel;
 
     this._timelineViewMap = new Map;
@@ -315,8 +319,8 @@ WebInspector.TimelineRecordingContentView.prototype = {
     {
         var timelineView = this.currentTimelineView;
         if (timelineView) {
-            WebInspector.timelineSidebarPanel.contentTreeOutline = timelineView.navigationSidebarTreeOutline;
-            WebInspector.timelineSidebarPanel.contentTreeOutlineLabel = timelineView.navigationSidebarTreeOutlineLabel;
+            this._timelineSidebarPanel.contentTreeOutline = timelineView.navigationSidebarTreeOutline;
+            this._timelineSidebarPanel.contentTreeOutlineLabel = timelineView.navigationSidebarTreeOutlineLabel;
 
             timelineView.startTime = this._timelineOverview.selectionStartTime;
             timelineView.endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
@@ -329,7 +333,7 @@ WebInspector.TimelineRecordingContentView.prototype = {
 
     _pathComponentSelected: function(event)
     {
-        WebInspector.timelineSidebarPanel.showTimelineViewForTimeline(event.data.pathComponent.representedObject);
+        this._timelineSidebarPanel.showTimelineViewForTimeline(event.data.pathComponent.representedObject);
     },
 
     _contentViewSelectionPathComponentDidChange: function(event)
@@ -395,7 +399,7 @@ WebInspector.TimelineRecordingContentView.prototype = {
         if (this.currentTimelineView)
             this.currentTimelineView.currentTime = currentTime;
 
-        WebInspector.timelineSidebarPanel.updateFilter();
+        this._timelineSidebarPanel.updateFilter();
 
         // Force a layout now since we are already in an animation frame and don't need to delay it until the next.
         this._timelineOverview.updateLayoutIfNeeded();
@@ -502,7 +506,7 @@ WebInspector.TimelineRecordingContentView.prototype = {
 
         console.assert(!this._timelineViewMap.has(timeline), timeline);
 
-        this._timelineViewMap.set(timeline, new WebInspector.ContentView(timeline));
+        this._timelineViewMap.set(timeline, new WebInspector.ContentView(timeline, {timelineSidebarPanel: this._timelineSidebarPanel}));
 
         var pathComponent = new WebInspector.HierarchicalPathComponent(timeline.displayName, timeline.iconClassName, timeline);
         pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._pathComponentSelected, this);
@@ -592,7 +596,7 @@ WebInspector.TimelineRecordingContentView.prototype = {
             var selectedTreeElement = this.currentTimelineView && this.currentTimelineView.navigationSidebarTreeOutline ? this.currentTimelineView.navigationSidebarTreeOutline.selectedTreeElement : null;
             var selectionWasHidden = selectedTreeElement && selectedTreeElement.hidden;
 
-            WebInspector.timelineSidebarPanel.updateFilter();
+            this._timelineSidebarPanel.updateFilter();
 
             if (selectedTreeElement && selectedTreeElement.hidden !== selectionWasHidden)
                 this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
index b8b02a0..772c5bf 100644 (file)
@@ -423,7 +423,7 @@ WebInspector.TimelineSidebarPanel = class TimelineSidebarPanel extends WebInspec
         for (var timeline of recording.timelines.values())
             this._timelineAdded(timeline);
 
-        this._displayedContentView = WebInspector.contentBrowser.contentViewForRepresentedObject(this._displayedRecording);
+        this._displayedContentView = WebInspector.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, false, {timelineSidebarPanel: this});
         if (this.selected)
             WebInspector.contentBrowser.showContentView(this._displayedContentView);
     }
index 4cca0e4..18b5f51 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2015 University of Washington.
  *
  * Redistribution and use in source and binary forms, with or without
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineView = function(representedObject)
+WebInspector.TimelineView = function(representedObject, extraArguments)
 {
     // This class should not be instantiated directly. Create a concrete subclass instead.
     console.assert(this.constructor !== WebInspector.TimelineView && this instanceof WebInspector.TimelineView);
 
+    console.assert(extraArguments);
+    console.assert(extraArguments.timelineSidebarPanel instanceof WebInspector.TimelineSidebarPanel);
+
     WebInspector.ContentView.call(this, representedObject);
 
-    this._contentTreeOutline = WebInspector.timelineSidebarPanel.createContentTreeOutline();
+    this._timelineSidebarPanel = extraArguments.timelineSidebarPanel;
+
+    this._contentTreeOutline = this._timelineSidebarPanel.createContentTreeOutline();
     this._contentTreeOutline.onselect = this.treeElementSelected.bind(this);
     this._contentTreeOutline.ondeselect = this.treeElementDeselected.bind(this);
 
-    this.element.classList.add(WebInspector.TimelineView.StyleClassName);
+    this.element.classList.add("timeline-view");
 
     this._zeroTime = 0;
     this._startTime = 0;
@@ -43,8 +48,6 @@ WebInspector.TimelineView = function(representedObject)
     this._currentTime = 0;
 };
 
-WebInspector.TimelineView.StyleClassName = "timeline-view";
-
 WebInspector.TimelineView.prototype = {
     constructor: WebInspector.TimelineView,
     __proto__: WebInspector.ContentView.prototype,
@@ -62,6 +65,11 @@ WebInspector.TimelineView.prototype = {
         return null;
     },
 
+    get timelineSidebarPanel()
+    {
+        return this._timelineSidebarPanel;
+    },
+
     get selectionPathComponents()
     {
         if (!this._contentTreeOutline.selectedTreeElement || this._contentTreeOutline.selectedTreeElement.hidden)
@@ -194,7 +202,7 @@ WebInspector.TimelineView.prototype = {
 
         var sourceCodeLocation = treeElement.record.sourceCodeLocation;
         if (!sourceCodeLocation) {
-            WebInspector.timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
+            this._timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
             return true;
         }
 
@@ -219,7 +227,7 @@ WebInspector.TimelineView.prototype = {
     {
         // Implemented by sub-classes if needed.
 
-        if (!WebInspector.timelineSidebarPanel.canShowDifferentContentView())
+        if (!this._timelineSidebarPanel.canShowDifferentContentView())
             return;
 
         if (treeElement instanceof WebInspector.FolderTreeElement)
@@ -249,7 +257,7 @@ WebInspector.TimelineView.prototype = {
         if (this.navigationSidebarTreeOutline.selectedTreeElement)
             this.navigationSidebarTreeOutline.selectedTreeElement.deselect();
 
-        WebInspector.timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
+        this._timelineSidebarPanel.showTimelineViewForTimeline(this.representedObject);
     },
 
     _updateTreeElementWithCloseButton: function(treeElement)