Title: [196606] trunk/Source/WebInspectorUI
Revision
196606
Author
[email protected]
Date
2016-02-15 15:57:25 -0800 (Mon, 15 Feb 2016)

Log Message

Web Inspector: eliminate the linear and rendering frames TimelineOverview subclasses
https://bugs.webkit.org/show_bug.cgi?id=154000
<rdar://problem/24553105>

Reviewed by Timothy Hatcher.

This patch eliminates the TimelineOverview subclasses, and moves logic for switching between
a time-based or frame-based graph into the overview itself. The values of the overview's start
time, current time, and end time now match the values in the timeline recording regardless of the
current view mode. When viewing the rendering frames graph, the recording times are ignored and
all frames are included. The overview maintains separate zoom level and ruler selection settings
for each view mode.

* UserInterface/Main.html:
* UserInterface/Views/LinearTimelineOverview.js: Removed.
* UserInterface/Views/RenderingFrameTimelineOverview.js: Removed.
Removed TimelineOverview subclasses.

* UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
(WebInspector.RenderingFrameTimelineOverviewGraph.prototype.get height):
Set FPS graph height to 108 pixels.

* UserInterface/Views/TimelineOverview.css:
(.timeline-overview:not(.frames) > .graphs-container > .timeline-overview-graph:nth-child(even)):
(.timeline-overview:not(.frames) > .graphs-container > .timeline-overview-graph:not(:first-child)):
(.timeline-overview > .graphs-container > .timeline-overview-graph:nth-child(even)): Deleted.
(.timeline-overview > .graphs-container > .timeline-overview-graph:not(:first-child)): Deleted.
Disable alternating graph styles when showing FPS instrument.

* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview):
Create separate settings for timelines and FPS view modes.
(WebInspector.TimelineOverview.prototype.get viewMode):
(WebInspector.TimelineOverview.prototype.set viewMode):
(WebInspector.TimelineOverview.prototype.set startTime):
Adjust the current ruler selection when start time changes. Not necessary
when showing the FPS instrument, which doesn't have a start time.
(WebInspector.TimelineOverview.prototype.get secondsPerPixel):
(WebInspector.TimelineOverview.prototype.set secondsPerPixel):
Now a wrapper around the corresponding view mode setting.
(WebInspector.TimelineOverview.prototype.set pixelAlignDuration):
(WebInspector.TimelineOverview.prototype.get scrollStartTime):
(WebInspector.TimelineOverview.prototype.set scrollStartTime):
Now a wrapper around the corresponding view mode setting.
(WebInspector.TimelineOverview.prototype.get visibleDuration):
(WebInspector.TimelineOverview.prototype.get height):
Return the sum height of all visible overview graphs.
(WebInspector.TimelineOverview.prototype.shown):
Show overview graphs for the current view mode.
(WebInspector.TimelineOverview.prototype.hidden):
(WebInspector.TimelineOverview.prototype.reset):
(WebInspector.TimelineOverview.prototype.recordWasFiltered):
(WebInspector.TimelineOverview.prototype.selectRecord):
(WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
(WebInspector.TimelineOverview.prototype.layout):
Layout for both view modes is largely identical, and differs only in the treatment
of the overview's start time, current time, and end time. Time-based instruments
use time values from the recording, while the FPS instrument has a fixed start time
of zero, and a current and end time pinned to the last rendering frame.
(WebInspector.TimelineOverview.prototype._handleScrollEvent):
(WebInspector.TimelineOverview.prototype._handleWheelEvent):
(WebInspector.TimelineOverview._handleGestureStart):
(WebInspector.TimelineOverview.prototype._handleGestureChange):
(WebInspector.TimelineOverview.prototype._instrumentAdded):
(WebInspector.TimelineOverview.prototype._instrumentRemoved):
(WebInspector.TimelineOverview.prototype._timelineRulerMouseClicked):
(WebInspector.TimelineOverview.prototype._timeRangeSelectionChanged):
Save the selection for the current view mode.
(WebInspector.TimelineOverview.prototype._recordSelected):
(WebInspector.TimelineOverview.prototype._resetSelection.reset):
(WebInspector.TimelineOverview.prototype._resetSelection):
(WebInspector.TimelineOverview.prototype._canShowTimelineType):
(WebInspector.TimelineOverview.prototype._viewModeDidChange):
Sets zoom level, ruler selection, and graph visibility based on current view mode.
(WebInspector.TimelineOverview.prototype._createViewModeSettings):
Helper function for creating an object to track the zoom level and ruler
selection of each view mode.
(WebInspector.TimelineOverview.prototype.get _currentSettings):
Internal getter for retrieving the settings for the current view mode.
(WebInspector.TimelineOverview.prototype.canShowTimeline): Deleted.
Not needed now that the overview contains all timelines.

* UserInterface/Views/TimelineOverviewGraph.js:
(WebInspector.TimelineOverviewGraph):
(WebInspector.TimelineOverviewGraph.prototype.shown):
(WebInspector.TimelineOverviewGraph.prototype.hidden):
Toggle CSS hidden class.

* UserInterface/Views/TimelineRecordFrame.js:
No need to query offsetHeight now that TimelineOverviewGraph has a height property.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
Create a single timeline overview.
(WebInspector.TimelineRecordingContentView.prototype.get timelineOverviewHeight):
(WebInspector.TimelineRecordingContentView.prototype.shown):
(WebInspector.TimelineRecordingContentView.prototype.hidden):
(WebInspector.TimelineRecordingContentView.prototype.recordWasFiltered):
(WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
Update the timeline  overview's mode based on the current timeline view.
(WebInspector.TimelineRecordingContentView.prototype._contentViewSelectionPathComponentDidChange):
(WebInspector.TimelineRecordingContentView.prototype._updateTimes):
Removed special handling for the FPS overview.
Removed selection start time adjustment, which is now handled internally by TimelineOverview.
(WebInspector.TimelineRecordingContentView.prototype._updateTimelineOverviewHeight):
(WebInspector.TimelineRecordingContentView.prototype._recordingReset):
(WebInspector.TimelineRecordingContentView.prototype._timeRangeSelectionChanged):
(WebInspector.TimelineRecordingContentView.prototype._updateFrameSelection):

* UserInterface/Views/TimelineSidebarPanel.js:
(WebInspector.TimelineSidebarPanel):
(WebInspector.TimelineSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
(WebInspector.TimelineSidebarPanel.prototype.saveStateToCookie):
(WebInspector.TimelineSidebarPanel.prototype._renderingFrameTimelineTimesUpdated):
(WebInspector.TimelineSidebarPanel.prototype._contentBrowserCurrentContentViewDidChange):
Refresh the view mode when the content view changes.
(WebInspector.TimelineSidebarPanel.prototype._recordingSelected):
(WebInspector.TimelineSidebarPanel.prototype._viewModeSelected):
(WebInspector.TimelineSidebarPanel.prototype._viewModeForTimeline):
(WebInspector.TimelineSidebarPanel.prototype._updateViewModeIfNeeded):
Sync the tree outline, frames chart, and navigation bar with the current view mode.
(WebInspector.TimelineSidebarPanel.prototype.shown):
Refreshing the frame selection is unnecessary. It's updated by the recording content
view whenever the ruler selection changes.
(WebInspector.TimelineSidebarPanel.prototype.get viewMode): Deleted.
No longer public, since the timeline overview now owns the view mode. Internally the sidebar
still tracks the current state so it can determine when the value has changed.
(WebInspector.TimelineSidebarPanel.prototype.showTimelineOverview):
(WebInspector.TimelineSidebarPanel.prototype.showTimelineViewForTimeline):
The sidebar should only be synced to the overview after the content view has changed.
(WebInspector.TimelineSidebarPanel.prototype.updateFrameSelection):
Removed unnecessary assertion.
(WebInspector.TimelineSidebarPanel.prototype._changeViewMode): Deleted.
Replaced by _updateViewModeIfNeeded.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (196605 => 196606)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-02-15 23:57:25 UTC (rev 196606)
@@ -1,3 +1,140 @@
+2016-02-15  Matt Baker  <[email protected]>
+
+        Web Inspector: eliminate the linear and rendering frames TimelineOverview subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=154000
+        <rdar://problem/24553105>
+
+        Reviewed by Timothy Hatcher.
+
+        This patch eliminates the TimelineOverview subclasses, and moves logic for switching between
+        a time-based or frame-based graph into the overview itself. The values of the overview's start
+        time, current time, and end time now match the values in the timeline recording regardless of the
+        current view mode. When viewing the rendering frames graph, the recording times are ignored and
+        all frames are included. The overview maintains separate zoom level and ruler selection settings
+        for each view mode.
+
+        * UserInterface/Main.html:
+        * UserInterface/Views/LinearTimelineOverview.js: Removed.
+        * UserInterface/Views/RenderingFrameTimelineOverview.js: Removed.
+        Removed TimelineOverview subclasses.
+
+        * UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
+        (WebInspector.RenderingFrameTimelineOverviewGraph.prototype.get height):
+        Set FPS graph height to 108 pixels.
+
+        * UserInterface/Views/TimelineOverview.css:
+        (.timeline-overview:not(.frames) > .graphs-container > .timeline-overview-graph:nth-child(even)):
+        (.timeline-overview:not(.frames) > .graphs-container > .timeline-overview-graph:not(:first-child)):
+        (.timeline-overview > .graphs-container > .timeline-overview-graph:nth-child(even)): Deleted.
+        (.timeline-overview > .graphs-container > .timeline-overview-graph:not(:first-child)): Deleted.
+        Disable alternating graph styles when showing FPS instrument.
+
+        * UserInterface/Views/TimelineOverview.js:
+        (WebInspector.TimelineOverview):
+        Create separate settings for timelines and FPS view modes.
+        (WebInspector.TimelineOverview.prototype.get viewMode):
+        (WebInspector.TimelineOverview.prototype.set viewMode):
+        (WebInspector.TimelineOverview.prototype.set startTime):
+        Adjust the current ruler selection when start time changes. Not necessary
+        when showing the FPS instrument, which doesn't have a start time.
+        (WebInspector.TimelineOverview.prototype.get secondsPerPixel):
+        (WebInspector.TimelineOverview.prototype.set secondsPerPixel):
+        Now a wrapper around the corresponding view mode setting.
+        (WebInspector.TimelineOverview.prototype.set pixelAlignDuration):
+        (WebInspector.TimelineOverview.prototype.get scrollStartTime):
+        (WebInspector.TimelineOverview.prototype.set scrollStartTime):
+        Now a wrapper around the corresponding view mode setting.
+        (WebInspector.TimelineOverview.prototype.get visibleDuration):
+        (WebInspector.TimelineOverview.prototype.get height):
+        Return the sum height of all visible overview graphs.
+        (WebInspector.TimelineOverview.prototype.shown):
+        Show overview graphs for the current view mode.
+        (WebInspector.TimelineOverview.prototype.hidden):
+        (WebInspector.TimelineOverview.prototype.reset):
+        (WebInspector.TimelineOverview.prototype.recordWasFiltered):
+        (WebInspector.TimelineOverview.prototype.selectRecord):
+        (WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
+        (WebInspector.TimelineOverview.prototype.layout):
+        Layout for both view modes is largely identical, and differs only in the treatment
+        of the overview's start time, current time, and end time. Time-based instruments
+        use time values from the recording, while the FPS instrument has a fixed start time
+        of zero, and a current and end time pinned to the last rendering frame.
+        (WebInspector.TimelineOverview.prototype._handleScrollEvent):
+        (WebInspector.TimelineOverview.prototype._handleWheelEvent):
+        (WebInspector.TimelineOverview._handleGestureStart):
+        (WebInspector.TimelineOverview.prototype._handleGestureChange):
+        (WebInspector.TimelineOverview.prototype._instrumentAdded):
+        (WebInspector.TimelineOverview.prototype._instrumentRemoved):
+        (WebInspector.TimelineOverview.prototype._timelineRulerMouseClicked):
+        (WebInspector.TimelineOverview.prototype._timeRangeSelectionChanged):
+        Save the selection for the current view mode.
+        (WebInspector.TimelineOverview.prototype._recordSelected):
+        (WebInspector.TimelineOverview.prototype._resetSelection.reset):
+        (WebInspector.TimelineOverview.prototype._resetSelection):
+        (WebInspector.TimelineOverview.prototype._canShowTimelineType):
+        (WebInspector.TimelineOverview.prototype._viewModeDidChange):
+        Sets zoom level, ruler selection, and graph visibility based on current view mode.
+        (WebInspector.TimelineOverview.prototype._createViewModeSettings):
+        Helper function for creating an object to track the zoom level and ruler
+        selection of each view mode.
+        (WebInspector.TimelineOverview.prototype.get _currentSettings):
+        Internal getter for retrieving the settings for the current view mode.
+        (WebInspector.TimelineOverview.prototype.canShowTimeline): Deleted.
+        Not needed now that the overview contains all timelines.
+
+        * UserInterface/Views/TimelineOverviewGraph.js:
+        (WebInspector.TimelineOverviewGraph):
+        (WebInspector.TimelineOverviewGraph.prototype.shown):
+        (WebInspector.TimelineOverviewGraph.prototype.hidden):
+        Toggle CSS hidden class.
+
+        * UserInterface/Views/TimelineRecordFrame.js:
+        No need to query offsetHeight now that TimelineOverviewGraph has a height property.
+
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView):
+        Create a single timeline overview.
+        (WebInspector.TimelineRecordingContentView.prototype.get timelineOverviewHeight):
+        (WebInspector.TimelineRecordingContentView.prototype.shown):
+        (WebInspector.TimelineRecordingContentView.prototype.hidden):
+        (WebInspector.TimelineRecordingContentView.prototype.recordWasFiltered):
+        (WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
+        Update the timeline  overview's mode based on the current timeline view.
+        (WebInspector.TimelineRecordingContentView.prototype._contentViewSelectionPathComponentDidChange):
+        (WebInspector.TimelineRecordingContentView.prototype._updateTimes):
+        Removed special handling for the FPS overview.
+        Removed selection start time adjustment, which is now handled internally by TimelineOverview.
+        (WebInspector.TimelineRecordingContentView.prototype._updateTimelineOverviewHeight):
+        (WebInspector.TimelineRecordingContentView.prototype._recordingReset):
+        (WebInspector.TimelineRecordingContentView.prototype._timeRangeSelectionChanged):
+        (WebInspector.TimelineRecordingContentView.prototype._updateFrameSelection):
+
+        * UserInterface/Views/TimelineSidebarPanel.js:
+        (WebInspector.TimelineSidebarPanel):
+        (WebInspector.TimelineSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
+        (WebInspector.TimelineSidebarPanel.prototype.saveStateToCookie):
+        (WebInspector.TimelineSidebarPanel.prototype._renderingFrameTimelineTimesUpdated):
+        (WebInspector.TimelineSidebarPanel.prototype._contentBrowserCurrentContentViewDidChange):
+        Refresh the view mode when the content view changes.
+        (WebInspector.TimelineSidebarPanel.prototype._recordingSelected):
+        (WebInspector.TimelineSidebarPanel.prototype._viewModeSelected):
+        (WebInspector.TimelineSidebarPanel.prototype._viewModeForTimeline):
+        (WebInspector.TimelineSidebarPanel.prototype._updateViewModeIfNeeded):
+        Sync the tree outline, frames chart, and navigation bar with the current view mode.
+        (WebInspector.TimelineSidebarPanel.prototype.shown):
+        Refreshing the frame selection is unnecessary. It's updated by the recording content
+        view whenever the ruler selection changes.
+        (WebInspector.TimelineSidebarPanel.prototype.get viewMode): Deleted.
+        No longer public, since the timeline overview now owns the view mode. Internally the sidebar
+        still tracks the current state so it can determine when the value has changed.
+        (WebInspector.TimelineSidebarPanel.prototype.showTimelineOverview):
+        (WebInspector.TimelineSidebarPanel.prototype.showTimelineViewForTimeline):
+        The sidebar should only be synced to the overview after the content view has changed.
+        (WebInspector.TimelineSidebarPanel.prototype.updateFrameSelection):
+        Removed unnecessary assertion.
+        (WebInspector.TimelineSidebarPanel.prototype._changeViewMode): Deleted.
+        Replaced by _updateViewModeIfNeeded.
+
 2016-02-15  Timothy Hatcher  <[email protected]>
 
         Web Inspector: Show inherited CSS variables in the Style sidebar

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html	2016-02-15 23:57:25 UTC (rev 196606)
@@ -518,7 +518,6 @@
     <script src=""
     <script src=""
     <script src=""
-    <script src=""
     <script src=""
     <script src=""
     <script src=""
@@ -548,7 +547,6 @@
     <script src=""
     <script src=""
     <script src=""
-    <script src=""
     <script src=""
     <script src=""
     <script src=""

Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/LinearTimelineOverview.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LinearTimelineOverview.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LinearTimelineOverview.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.LinearTimelineOverview = class LinearTimelineOverview extends WebInspector.TimelineOverview
-{
-    constructor(timelineRecording)
-    {
-        var defaultSettingsValues = {
-            durationPerPixel: 0.01,
-            selectionStartValue: 0,
-            selectionDuration: 15
-        };
-
-        super("linear", timelineRecording, 0.0001, 2, defaultSettingsValues);
-    }
-
-    // Protected
-
-    canShowTimeline(timeline)
-    {
-        return timeline.type !== WebInspector.TimelineRecord.Type.RenderingFrame;
-    }
-};

Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverview.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.RenderingFrameTimelineOverview = class RenderingFrameTimelineOverview extends WebInspector.TimelineOverview
-{
-    constructor(timelineRecording)
-    {
-        var minimumDurationPerPixel = 1 / WebInspector.TimelineRecordFrame.MaximumWidthPixels;
-        var maximumDurationPerPixel = 1 / WebInspector.TimelineRecordFrame.MinimumWidthPixels;
-        var defaultSettingsValues = {
-            durationPerPixel: minimumDurationPerPixel,
-            selectionStartValue: 0,
-            selectionDuration: 100
-        };
-
-        super("frames", timelineRecording, minimumDurationPerPixel, maximumDurationPerPixel, defaultSettingsValues);
-
-        this.pixelAlignDuration = true;
-        this.timelineRuler.minimumSelectionDuration = 1;
-        this.timelineRuler.snapInterval = 1;
-        this.timelineRuler.formatLabelCallback = function(value) {
-            return value.toFixed(0);
-        };
-    }
-
-    // Protected
-
-    get height()
-    {
-        return 108;
-    }
-
-    canShowTimeline(timeline)
-    {
-        return timeline.type === WebInspector.TimelineRecord.Type.RenderingFrame;
-    }
-};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -95,6 +95,11 @@
 
     // Protected
 
+    get height()
+    {
+        return 108;
+    }
+
     layout()
     {
         if (!this._renderingFrameTimeline.records.length)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.css (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.css	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.css	2016-02-15 23:57:25 UTC (rev 196606)
@@ -90,12 +90,12 @@
     height: 36px;
 }
 
-.timeline-overview > .graphs-container > .timeline-overview-graph:nth-child(even) {
+.timeline-overview:not(.frames) > .graphs-container > .timeline-overview-graph:nth-child(even) {
     background-color: hsl(0, 0%, 96%);
     background-clip: padding-box;
 }
 
-.timeline-overview > .graphs-container > .timeline-overview-graph:not(:first-child) {
+.timeline-overview:not(.frames) > .graphs-container > .timeline-overview-graph:not(:first-child) {
     border-top: 1px solid hsla(0, 0%, 0%, 0.09);
 }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -25,19 +25,27 @@
 
 WebInspector.TimelineOverview = class TimelineOverview extends WebInspector.View
 {
-    constructor(identifier, timelineRecording, minimumDurationPerPixel, maximumDurationPerPixel, defaultSettingsValues)
+    constructor(timelineRecording)
     {
         super();
 
         console.assert(timelineRecording instanceof WebInspector.TimelineRecording);
 
+        this._timelinesViewModeSettings = this._createViewModeSettings(WebInspector.TimelineOverview.ViewMode.Timelines, 0.0001, 60, 0.01, 0, 15);
+
+        if (WebInspector.FPSInstrument.supported()) {
+            let minimumDurationPerPixel = 1 / WebInspector.TimelineRecordFrame.MaximumWidthPixels;
+            let maximumDurationPerPixel = 1 / WebInspector.TimelineRecordFrame.MinimumWidthPixels;
+            this._renderingFramesViewModeSettings = this._createViewModeSettings(WebInspector.TimelineOverview.ViewMode.RenderingFrames, minimumDurationPerPixel, maximumDurationPerPixel, minimumDurationPerPixel, 0, 100);
+        }
+
         this._recording = timelineRecording;
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentAdded, this._instrumentAdded, this);
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentRemoved, this._instrumentRemoved, this);
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
 
-        this.element.classList.add("timeline-overview", identifier);
+        this.element.classList.add("timeline-overview");
         this.element.addEventListener("wheel", this._handleWheelEvent.bind(this));
         this.element.addEventListener("gesturestart", this._handleGestureStart.bind(this));
         this.element.addEventListener("gesturechange", this._handleGestureChange.bind(this));
@@ -47,7 +55,7 @@
         this._graphsContainerView.element.classList.add("graphs-container");
         this.addSubview(this._graphsContainerView);
 
-        this._timelineOverviewGraphsMap = new Map;
+        this._overviewGraphsByTypeMap = new Map;
 
         this._timelineRuler = new WebInspector.TimelineRuler;
         this._timelineRuler.allowsClippedLabels = true;
@@ -69,36 +77,40 @@
         this._scrollWidthSizer.classList.add("scroll-width-sizer");
         this._scrollContainerElement.appendChild(this._scrollWidthSizer);
 
-        this._defaultSettingsValues = defaultSettingsValues;
-        this._durationPerPixelSetting = new WebInspector.Setting(identifier + "-timeline-overview-duration-per-pixel", this._defaultSettingsValues.durationPerPixel);
-        this._selectionStartValueSetting = new WebInspector.Setting(identifier + "-timeline-overview-selection-start-value", this._defaultSettingsValues.selectionStartValue);
-        this._selectionDurationSetting = new WebInspector.Setting(identifier + "-timeline-overview-selection-duration", this._defaultSettingsValues.selectionDuration);
-
         this._startTime = 0;
         this._currentTime = 0;
         this._revealCurrentTime = false;
         this._endTime = 0;
-        this._minimumDurationPerPixel = minimumDurationPerPixel;
-        this._maximumDurationPerPixel = maximumDurationPerPixel;
-        this._durationPerPixel = Math.min(this._maximumDurationPerPixel, Math.max(this._minimumDurationPerPixel, this._durationPerPixelSetting.value));
         this._pixelAlignDuration = false;
         this._mouseWheelDelta = 0;
-        this._scrollStartTime = 0;
         this._cachedScrollContainerWidth = NaN;
         this._timelineRulerSelectionChanged = false;
 
-        this.selectionStartTime = this._selectionStartValueSetting.value;
-        this.selectionDuration = this._selectionDurationSetting.value;
-
         for (let instrument of this._recording.instruments)
             this._instrumentAdded(instrument);
 
         if (!WebInspector.timelineManager.isCapturingPageReload())
             this._resetSelection();
+
+        this.viewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
     }
 
     // Public
 
+    get viewMode()
+    {
+        return this._viewMode;
+    }
+
+    set viewMode(x)
+    {
+        if (this._viewMode === x)
+            return;
+
+        this._viewMode = x;
+        this._viewModeDidChange();
+    }
+
     get startTime()
     {
         return this._startTime;
@@ -111,6 +123,11 @@
         if (this._startTime === x)
             return;
 
+        if (this._viewMode !== WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
+            let selectionOffset = this.selectionStartTime - this._startTime;
+            this.selectionStartTime = selectionOffset + x;
+        }
+
         this._startTime = x;
 
         this.needsLayout();
@@ -136,24 +153,23 @@
 
     get secondsPerPixel()
     {
-        return this._durationPerPixel;
+        return this._currentSettings.durationPerPixelSetting.value;
     }
 
     set secondsPerPixel(x)
     {
-        x = Math.min(this._maximumDurationPerPixel, Math.max(this._minimumDurationPerPixel, x));
+        x = Math.min(this._currentSettings.maximumDurationPerPixel, Math.max(this._currentSettings.minimumDurationPerPixel, x));
 
-        if (this._durationPerPixel === x)
+        if (this.secondsPerPixel === x)
             return;
 
         if (this._pixelAlignDuration) {
             x = 1 / Math.round(1 / x);
-            if (this._durationPerPixel === x)
+            if (this.secondsPerPixel === x)
                 return;
         }
 
-        this._durationPerPixel = x;
-        this._durationPerPixelSetting.value = x;
+        this._currentSettings.durationPerPixelSetting.value = x;
 
         this.needsLayout();
     }
@@ -171,7 +187,7 @@
         this._mouseWheelDelta = 0;
         this._pixelAlignDuration = x;
         if (this._pixelAlignDuration)
-            this.secondsPerPixel = 1 / Math.round(1 / this._durationPerPixel);
+            this.secondsPerPixel = 1 / Math.round(1 / this.secondsPerPixel);
     }
 
     get endTime()
@@ -193,17 +209,17 @@
 
     get scrollStartTime()
     {
-        return this._scrollStartTime;
+        return this._currentSettings.scrollStartTime;
     }
 
     set scrollStartTime(x)
     {
         x = x || 0;
 
-        if (this._scrollStartTime === x)
+        if (this.scrollStartTime === x)
             return;
 
-        this._scrollStartTime = x;
+        this._currentSettings.scrollStartTime = x;
 
         this.needsLayout();
     }
@@ -221,7 +237,7 @@
                 this._cachedScrollContainerWidth = NaN;
         }
 
-        return this._cachedScrollContainerWidth * this._durationPerPixel;
+        return this._cachedScrollContainerWidth * this.secondsPerPixel;
     }
 
     get selectionStartTime()
@@ -256,8 +272,10 @@
     get height()
     {
         let height = 0;
-        for (let graph of this._timelineOverviewGraphsMap.values())
-            height += graph.height;
+        for (let overviewGraph of this._overviewGraphsByTypeMap.values()) {
+            if (overviewGraph.visible)
+                height += overviewGraph.height;
+        }
         return height;
     }
 
@@ -270,8 +288,10 @@
     {
         this._visible = true;
 
-        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
-            timelineOverviewGraph.shown();
+        for (let [type, overviewGraph] of this._overviewGraphsByTypeMap) {
+            if (this._canShowTimelineType(type))
+                overviewGraph.shown();
+        }
 
         this.updateLayout(WebInspector.View.LayoutReason.Resize);
     }
@@ -280,14 +300,14 @@
     {
         this._visible = false;
 
-        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
-            timelineOverviewGraph.hidden();
+        for (let overviewGraph of this._overviewGraphsByTypeMap.values())
+            overviewGraph.hidden();
     }
 
     reset()
     {
-        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
-            timelineOverviewGraph.reset();
+        for (let overviewGraph of this._overviewGraphsByTypeMap.values())
+            overviewGraph.reset();
 
         this._mouseWheelDelta = 0;
 
@@ -301,25 +321,25 @@
 
     recordWasFiltered(timeline, record, filtered)
     {
-        console.assert(this.canShowTimeline(timeline), timeline);
-
-        let overviewGraph = this._timelineOverviewGraphsMap.get(timeline);
+        let overviewGraph = this._overviewGraphsByTypeMap.get(timeline.type);
         console.assert(overviewGraph, "Missing overview graph for timeline type " + timeline.type);
         if (!overviewGraph)
             return;
 
+        console.assert(overviewGraph.visible, "Record filtered in hidden overview graph", record);
+
         overviewGraph.recordWasFiltered(record, filtered);
     }
 
     selectRecord(timeline, record)
     {
-        console.assert(this.canShowTimeline(timeline), timeline);
-
-        var overviewGraph = this._timelineOverviewGraphsMap.get(timeline);
+        let overviewGraph = this._overviewGraphsByTypeMap.get(timeline.type);
         console.assert(overviewGraph, "Missing overview graph for timeline type " + timeline.type);
         if (!overviewGraph)
             return;
 
+        console.assert(overviewGraph.visible, "Record selected in hidden overview graph", record);
+
         overviewGraph.selectedRecord = record;
     }
 
@@ -332,8 +352,10 @@
 
         this._timelineRuler.updateLayoutIfNeeded();
 
-        for (let timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
-            timelineOverviewGraph.updateLayoutIfNeeded();
+        for (let overviewGraph of this._overviewGraphsByTypeMap.values()) {
+            if (overviewGraph.visible)
+                overviewGraph.updateLayoutIfNeeded();
+        }
     }
 
     // Protected
@@ -343,25 +365,31 @@
         return this._timelineRuler;
     }
 
-    canShowTimeline(timeline)
-    {
-        // Implemented by subclasses.
-        console.error("Needs to be implemented by a subclass.");
-    }
-
     layout(layoutReason)
     {
         if (layoutReason === WebInspector.View.LayoutReason.Resize)
             this._cachedScrollContainerWidth = NaN;
 
+        let startTime = this._startTime;
+        let endTime = this._endTime;
+        let currentTime = this._currentTime;
+        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
+            let renderingFramesTimeline = this._recording.timelines.get(WebInspector.TimelineRecord.Type.RenderingFrame);
+            console.assert(renderingFramesTimeline, "Recoring missing rendering frames timeline");
+
+            startTime = 0;
+            endTime = renderingFramesTimeline.records.length;
+            currentTime = endTime;
+        }
+
         // Calculate the required width based on the duration and seconds per pixel.
-        let duration = this._endTime - this._startTime;
-        let newWidth = Math.ceil(duration / this._durationPerPixel);
+        let duration = endTime - startTime;
+        let newWidth = Math.ceil(duration / this.secondsPerPixel);
 
         // Update all relevant elements to the new required width.
         this._updateElementWidth(this._scrollWidthSizer, newWidth);
 
-        this._currentTimeMarker.time = this._currentTime;
+        this._currentTimeMarker.time = currentTime;
 
         if (this._revealCurrentTime) {
             this.revealMarker(this._currentTimeMarker);
@@ -371,25 +399,28 @@
         const visibleDuration = this.visibleDuration;
 
         // Clamp the scroll start time to match what the scroll bar would allow.
-        let scrollStartTime = Math.min(this._scrollStartTime, this._endTime - visibleDuration);
-        scrollStartTime = Math.max(this._startTime, scrollStartTime);
+        let scrollStartTime = Math.min(this.scrollStartTime, endTime - visibleDuration);
+        scrollStartTime = Math.max(startTime, scrollStartTime);
 
-        this._timelineRuler.zeroTime = this._startTime;
+        this._timelineRuler.zeroTime = startTime;
         this._timelineRuler.startTime = scrollStartTime;
-        this._timelineRuler.secondsPerPixel = this._durationPerPixel;
+        this._timelineRuler.secondsPerPixel = this.secondsPerPixel;
 
         if (!this._dontUpdateScrollLeft) {
             this._ignoreNextScrollEvent = true;
-            let scrollLeft = Math.ceil((scrollStartTime - this._startTime) / this._durationPerPixel);
+            let scrollLeft = Math.ceil((scrollStartTime - startTime) / this.secondsPerPixel);
             if (scrollLeft)
                 this._scrollContainerElement.scrollLeft = scrollLeft;
         }
 
-        for (let timelineOverviewGraph of this._timelineOverviewGraphsMap.values()) {
-            timelineOverviewGraph.zeroTime = this._startTime;
-            timelineOverviewGraph.startTime = scrollStartTime;
-            timelineOverviewGraph.currentTime = this._currentTime;
-            timelineOverviewGraph.endTime = scrollStartTime + visibleDuration;
+        for (let overviewGraph of this._overviewGraphsByTypeMap.values()) {
+            if (!overviewGraph.visible)
+                continue;
+
+            overviewGraph.zeroTime = startTime;
+            overviewGraph.startTime = scrollStartTime;
+            overviewGraph.currentTime = currentTime;
+            overviewGraph.endTime = scrollStartTime + visibleDuration;
         }
     }
 
@@ -411,8 +442,8 @@
 
         this._dontUpdateScrollLeft = true;
 
-        var scrollOffset = this._scrollContainerElement.scrollLeft;
-        this.scrollStartTime = this._startTime + (scrollOffset * this._durationPerPixel);
+        let scrollOffset = this._scrollContainerElement.scrollLeft;
+        this.scrollStartTime = this._startTime + (scrollOffset * this.secondsPerPixel);
 
         // Force layout so we can update with the scroll position synchronously.
         this.updateLayoutIfNeeded();
@@ -443,25 +474,25 @@
 
         // Remember the mouse position in time.
         let mouseOffset = event.pageX - this.element.totalOffsetLeft;
-        let mousePositionTime = this._scrollStartTime + (mouseOffset * this._durationPerPixel);
+        let mousePositionTime = this._currentSettings.scrollStartTime + (mouseOffset * this.secondsPerPixel);
         let deviceDirection = event.webkitDirectionInvertedFromDevice ? 1 : -1;
-        let delta = event.deltaY * (this._durationPerPixel / WebInspector.TimelineOverview.ScrollDeltaDenominator) * deviceDirection;
+        let delta = event.deltaY * (this.secondsPerPixel / WebInspector.TimelineOverview.ScrollDeltaDenominator) * deviceDirection;
 
         // Reset accumulated wheel delta when direction changes.
         if (this._pixelAlignDuration && (delta < 0 && this._mouseWheelDelta >= 0 || delta >= 0 && this._mouseWheelDelta < 0))
             this._mouseWheelDelta = 0;
 
-        let previousDurationPerPixel = this._durationPerPixel;
+        let previousDurationPerPixel = this.secondsPerPixel;
         this._mouseWheelDelta += delta;
         this.secondsPerPixel += this._mouseWheelDelta;
 
-        if (this._durationPerPixel === this._minimumDurationPerPixel && delta < 0 || this._durationPerPixel === this._maximumDurationPerPixel && delta >= 0)
+        if (this.secondsPerPixel === this._currentSettings.minimumDurationPerPixel && delta < 0 || this.secondsPerPixel === this._currentSettings.maximumDurationPerPixel && delta >= 0)
             this._mouseWheelDelta = 0;
         else
-            this._mouseWheelDelta = previousDurationPerPixel + this._mouseWheelDelta - this._durationPerPixel;
+            this._mouseWheelDelta = previousDurationPerPixel + this._mouseWheelDelta - this.secondsPerPixel;
 
         // Center the zoom around the mouse based on the remembered mouse position time.
-        this.scrollStartTime = mousePositionTime - (mouseOffset * this._durationPerPixel);
+        this.scrollStartTime = mousePositionTime - (mouseOffset * this.secondsPerPixel);
 
         event.preventDefault();
         event.stopPropagation();
@@ -475,11 +506,11 @@
         }
 
         let mouseOffset = event.pageX - this.element.totalOffsetLeft;
-        let mousePositionTime = this._scrollStartTime + (mouseOffset * this._durationPerPixel);
+        let mousePositionTime = this._currentSettings.scrollStartTime + (mouseOffset * this.secondsPerPixel);
 
         this._handlingGesture = true;
         this._gestureStartStartTime = mousePositionTime;
-        this._gestureStartDurationPerPixel = this._durationPerPixel;
+        this._gestureStartDurationPerPixel = this.secondsPerPixel;
 
         event.preventDefault();
         event.stopPropagation();
@@ -494,7 +525,7 @@
         let newSecondsPerPixel = this._gestureStartDurationPerPixel / scale;
 
         this.secondsPerPixel = newSecondsPerPixel;
-        this.scrollStartTime = this._gestureStartStartTime - (mouseOffset * this._durationPerPixel);
+        this.scrollStartTime = this._gestureStartStartTime - (mouseOffset * this.secondsPerPixel);
 
         event.preventDefault();
         event.stopPropagation();
@@ -513,15 +544,16 @@
         console.assert(instrument instanceof WebInspector.Instrument, instrument);
 
         let timeline = this._recording.timelineForInstrument(instrument);
-        console.assert(!this._timelineOverviewGraphsMap.has(timeline), timeline);
-        if (!this.canShowTimeline(timeline))
-            return;
+        console.assert(!this._overviewGraphsByTypeMap.has(timeline.type), timeline);
 
         let overviewGraph = WebInspector.TimelineOverviewGraph.createForTimeline(timeline, this);
         overviewGraph.addEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
-        this._timelineOverviewGraphsMap.set(timeline, overviewGraph);
+        this._overviewGraphsByTypeMap.set(timeline.type, overviewGraph);
 
         this._graphsContainerView.addSubview(overviewGraph);
+
+        if (!this._canShowTimelineType(timeline.type))
+            overviewGraph.hidden();
     }
 
     _instrumentRemoved(event)
@@ -530,12 +562,9 @@
         console.assert(instrument instanceof WebInspector.Instrument, instrument);
 
         let timeline = this._recording.timelineForInstrument(instrument);
-        if (!this.canShowTimeline(timeline))
-            return;
+        console.assert(this._overviewGraphsByTypeMap.has(timeline.type), timeline);
 
-        console.assert(this._timelineOverviewGraphsMap.has(timeline), timeline);
-
-        let overviewGraph = this._timelineOverviewGraphsMap.take(timeline);
+        let overviewGraph = this._overviewGraphsByTypeMap.take(timeline.type);
         overviewGraph.removeEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
         this._graphsContainerView.removeSubview(overviewGraph);
     }
@@ -555,13 +584,13 @@
         if (this._timelineRulerSelectionChanged)
             return;
 
-        for (var overviewGraph of this._timelineOverviewGraphsMap.values()) {
-            var graphRect = overviewGraph.element.getBoundingClientRect();
+        for (let overviewGraph of this._overviewGraphsByTypeMap.values()) {
+            let graphRect = overviewGraph.element.getBoundingClientRect();
             if (!(event.pageX >= graphRect.left && event.pageX <= graphRect.right && event.pageY >= graphRect.top && event.pageY <= graphRect.bottom))
                 continue;
 
             // Clone the event to dispatch it on the overview graph element.
-            var newClickEvent = new event.constructor(event.type, event);
+            let newClickEvent = new event.constructor(event.type, event);
             overviewGraph.element.dispatchEvent(newClickEvent);
             return;
         }
@@ -570,18 +599,22 @@
     _timeRangeSelectionChanged(event)
     {
         this._timelineRulerSelectionChanged = true;
-        this._selectionStartValueSetting.value = this.selectionStartTime - this._startTime;
-        this._selectionDurationSetting.value = this.selectionDuration;
 
+        let startTime = this._viewMode === WebInspector.TimelineOverview.ViewMode.Timelines ? this._startTime : 0;
+        this._currentSettings.selectionStartValueSetting.value = this.selectionStartTime - startTime;
+        this._currentSettings.selectionDurationSetting.value = this.selectionDuration;
+
         this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged);
     }
 
     _recordSelected(event)
     {
-        for (var [timeline, overviewGraph] of this._timelineOverviewGraphsMap) {
+        for (let [type, overviewGraph] of this._overviewGraphsByTypeMap) {
             if (overviewGraph !== event.target)
                 continue;
 
+            let timeline = this._recording.timelines.get(type);
+            console.assert(timeline, "Timeline recording missing timeline type", type);
             this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.RecordSelected, {timeline, record: event.data.record});
             return;
         }
@@ -589,9 +622,20 @@
 
     _resetSelection()
     {
-        this.secondsPerPixel = this._defaultSettingsValues.durationPerPixel;
-        this.selectionStartTime = this._defaultSettingsValues.selectionStartValue;
-        this.selectionDuration = this._defaultSettingsValues.selectionDuration;
+        function reset(settings)
+        {
+            settings.durationPerPixelSetting.reset();
+            settings.selectionStartValueSetting.reset();
+            settings.selectionDurationSetting.reset();
+        }
+
+        reset(this._timelinesViewModeSettings);
+        if (this._renderingFramesViewModeSettings)
+            reset(this._renderingFramesViewModeSettings);
+
+        this.secondsPerPixel = this._currentSettings.durationPerPixelSetting.value;
+        this.selectionStartTime = this._currentSettings.selectionStartValueSetting.value;
+        this.selectionDuration = this._currentSettings.selectionDurationSetting.value;
     }
 
     _recordingReset(event)
@@ -599,10 +643,77 @@
         this._timelineRuler.clearMarkers();
         this._timelineRuler.addMarker(this._currentTimeMarker);
     }
+
+    _canShowTimelineType(type)
+    {
+        let timelineViewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
+        if (type === WebInspector.TimelineRecord.Type.RenderingFrame)
+            timelineViewMode = WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+
+        return timelineViewMode === this._viewMode;
+    }
+
+    _viewModeDidChange()
+    {
+        let startTime = 0;
+        let isRenderingFramesMode = this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+        if (isRenderingFramesMode) {
+            this._timelineRuler.minimumSelectionDuration = 1;
+            this._timelineRuler.snapInterval = 1;
+            this._timelineRuler.formatLabelCallback = (value) => value.toFixed(0);
+        } else {
+            this._timelineRuler.minimumSelectionDuration = 0.01;
+            this._timelineRuler.snapInterval = NaN;
+            this._timelineRuler.formatLabelCallback = null;
+
+            startTime = this._startTime;
+        }
+
+        this.pixelAlignDuration = isRenderingFramesMode;
+        this.selectionStartTime = this._currentSettings.selectionStartValueSetting.value + startTime;
+        this.selectionDuration = this._currentSettings.selectionDurationSetting.value;
+
+        for (let [type, overviewGraph] of this._overviewGraphsByTypeMap) {
+            if (this._canShowTimelineType(type))
+                overviewGraph.shown();
+            else
+                overviewGraph.hidden();
+        }
+
+        this.element.classList.toggle("frames", isRenderingFramesMode);
+    }
+
+    _createViewModeSettings(viewMode, minimumDurationPerPixel, maximumDurationPerPixel, durationPerPixel, selectionStartValue, selectionDuration)
+    {
+        durationPerPixel = Math.min(maximumDurationPerPixel, Math.max(minimumDurationPerPixel, durationPerPixel));
+
+        let durationPerPixelSetting = new WebInspector.Setting(viewMode + "-duration-per-pixel", durationPerPixel);
+        let selectionStartValueSetting = new WebInspector.Setting(viewMode + "-selection-start-value", selectionStartValue);
+        let selectionDurationSetting = new WebInspector.Setting(viewMode + "-selection-duration", selectionDuration);
+
+        return {
+            scrollStartTime: 0,
+            minimumDurationPerPixel,
+            maximumDurationPerPixel,
+            durationPerPixelSetting,
+            selectionStartValueSetting,
+            selectionDurationSetting
+        };
+    }
+
+    get _currentSettings()
+    {
+        return this._viewMode === WebInspector.TimelineOverview.ViewMode.Timelines ? this._timelinesViewModeSettings : this._renderingFramesViewModeSettings;
+    }
 };
 
 WebInspector.TimelineOverview.ScrollDeltaDenominator = 500;
 
+WebInspector.TimelineOverview.ViewMode = {
+    Timelines: "timeline-overview-view-mode-timelines",
+    RenderingFrames: "timeline-overview-view-mode-rendering-frames"
+};
+
 WebInspector.TimelineOverview.Event = {
     RecordSelected: "timeline-overview-record-selected",
     TimeRangeSelectionChanged: "timeline-overview-time-range-selection-changed"

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -39,6 +39,7 @@
         this._selectedRecord = null;
         this._selectedRecordChanged = false;
         this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
+        this._visible = true;
     }
 
     // Public
@@ -172,13 +173,21 @@
 
     shown()
     {
+        if (this._visible)
+            return;
+
         this._visible = true;
+        this.element.classList.toggle("hidden", !this._visible);
         this.updateLayout();
     }
 
     hidden()
     {
+        if (!this._visible)
+            return;
+
         this._visible = false;
+        this.element.classList.toggle("hidden", !this._visible);
     }
 
     reset()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -108,7 +108,7 @@
 
     _calculateFrameDisplayData(graphDataSource)
     {
-        var secondsPerBlock = (graphDataSource.graphHeightSeconds / graphDataSource.element.offsetHeight) * WebInspector.TimelineRecordFrame.MinimumHeightPixels;
+        var secondsPerBlock = (graphDataSource.graphHeightSeconds / graphDataSource.height) * WebInspector.TimelineRecordFrame.MinimumHeightPixels;
         var segments = [];
         var invisibleSegments = [];
         var currentSegment = null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -38,17 +38,11 @@
 
         this.element.classList.add("timeline-recording");
 
-        this._linearTimelineOverview = new WebInspector.LinearTimelineOverview(this._recording);
-        this._linearTimelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
+        this._timelineOverview = new WebInspector.TimelineOverview(this._recording);
+        this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
+        this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.RecordSelected, this._recordSelected, this);
+        this.addSubview(this._timelineOverview);
 
-        this._renderingFrameTimelineOverview = new WebInspector.RenderingFrameTimelineOverview(this._recording);
-        this._renderingFrameTimelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
-        this._renderingFrameTimelineOverview.addEventListener(WebInspector.TimelineOverview.Event.RecordSelected, this._recordSelected, this);
-
-        this._currentTimelineOverview = this._linearTimelineOverview;
-
-        this.addSubview(this._currentTimelineOverview);
-
         this._contentViewContainer = new WebInspector.ContentViewContainer;
         this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
         this.addSubview(this._contentViewContainer);
@@ -57,7 +51,7 @@
         this._clearTimelineNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._clearTimeline, this);
 
         this._overviewTimelineView = new WebInspector.OverviewTimelineView(recording, {timelineSidebarPanel: this._timelineSidebarPanel});
-        this._overviewTimelineView.secondsPerPixel = this._linearTimelineOverview.secondsPerPixel;
+        this._overviewTimelineView.secondsPerPixel = this._timelineOverview.secondsPerPixel;
 
         this._timelineViewMap = new Map;
         this._pathComponentMap = new Map;
@@ -161,12 +155,12 @@
 
     get timelineOverviewHeight()
     {
-        return this._currentTimelineOverview.height;
+        return this._timelineOverview.height;
     }
 
     shown()
     {
-        this._currentTimelineOverview.shown();
+        this._timelineOverview.shown();
         this._contentViewContainer.shown();
         this._clearTimelineNavigationItem.enabled = !this._recording.readonly && !isNaN(this._recording.startTime);
 
@@ -178,7 +172,7 @@
 
     hidden()
     {
-        this._currentTimelineOverview.hidden();
+        this._timelineOverview.hidden();
         this._contentViewContainer.hidden();
 
         if (this._updating)
@@ -249,7 +243,7 @@
         if (!this.currentTimelineView)
             return;
 
-        this._currentTimelineOverview.recordWasFiltered(this.currentTimelineView.representedObject, record, filtered);
+        this._timelineOverview.recordWasFiltered(this.currentTimelineView.representedObject, record, filtered);
     }
 
     matchTreeElementAgainstCustomFilters(treeElement)
@@ -257,20 +251,20 @@
         if (this.currentTimelineView && !this.currentTimelineView.matchTreeElementAgainstCustomFilters(treeElement))
             return false;
 
-        var startTime = this._currentTimelineOverview.selectionStartTime;
-        var endTime = startTime + this._currentTimelineOverview.selectionDuration;
-        var currentTime = this._currentTime || this._recording.startTime;
+        let startTime = this._timelineOverview.selectionStartTime;
+        let endTime = startTime + this._timelineOverview.selectionDuration;
+        let currentTime = this._currentTime || this._recording.startTime;
 
-        if (this._timelineSidebarPanel.viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames) {
+        if (this._timelineOverview.viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
             console.assert(this._renderingFrameTimeline);
 
             if (this._renderingFrameTimeline && this._renderingFrameTimeline.records.length) {
-                var records = this._renderingFrameTimeline.records;
-                var startIndex = this._currentTimelineOverview.timelineRuler.snapInterval ? startTime : Math.floor(startTime);
+                let records = this._renderingFrameTimeline.records;
+                let startIndex = this._timelineOverview.timelineRuler.snapInterval ? startTime : Math.floor(startTime);
                 if (startIndex >= records.length)
                     return false;
 
-                var endIndex = this._currentTimelineOverview.timelineRuler.snapInterval ? endTime - 1: Math.floor(endTime);
+                let endIndex = this._timelineOverview.timelineRuler.snapInterval ? endTime - 1: Math.floor(endTime);
                 endIndex = Math.min(endIndex, records.length - 1);
                 console.assert(startIndex <= endIndex, startIndex);
 
@@ -328,31 +322,22 @@
 
     _currentContentViewDidChange(event)
     {
-        let newTimelineOverview;
+        let newViewMode;
         let timelineView = this.currentTimelineView;
         if (timelineView && timelineView.representedObject.type === WebInspector.TimelineRecord.Type.RenderingFrame)
-            newTimelineOverview = this._renderingFrameTimelineOverview;
+            newViewMode = WebInspector.TimelineOverview.ViewMode.RenderingFrames;
         else
-            newTimelineOverview = this._linearTimelineOverview;
+            newViewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
 
-        if (newTimelineOverview !== this._currentTimelineOverview) {
-            this._currentTimelineOverview.hidden();
+        this._timelineOverview.viewMode = newViewMode;
 
-            this.replaceSubview(this._currentTimelineOverview, newTimelineOverview);
-
-            this._currentTimelineOverview = newTimelineOverview;
-
-            this._updateTimelineOverviewHeight();
-            this._currentTimelineOverview.shown();
-        }
-
         if (timelineView) {
             this._timelineSidebarPanel.contentTreeOutline = timelineView.navigationSidebarTreeOutline;
             this._timelineSidebarPanel.contentTreeOutlineLabel = timelineView.navigationSidebarTreeOutlineLabel;
             this._timelineSidebarPanel.contentTreeOutlineScopeBar = timelineView.navigationSidebarTreeOutlineScopeBar;
 
-            timelineView.startTime = newTimelineOverview.selectionStartTime;
-            timelineView.endTime = newTimelineOverview.selectionStartTime + newTimelineOverview.selectionDuration;
+            timelineView.startTime = this._timelineOverview.selectionStartTime;
+            timelineView.endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
             timelineView.currentTime = this._currentTime;
         }
 
@@ -377,7 +362,7 @@
 
         var recordPathComponent = this.selectionPathComponents.find(function(element) { return element.representedObject instanceof WebInspector.TimelineRecord; });
         var record = recordPathComponent ? recordPathComponent.representedObject : null;
-        this._currentTimelineOverview.selectRecord(event.target.representedObject, record);
+        this._timelineOverview.selectRecord(event.target.representedObject, record);
     }
 
     _contentViewSupplementalRepresentedObjectsDidChange(event)
@@ -419,11 +404,7 @@
     _updateTimes(startTime, currentTime, endTime)
     {
         if (this._startTimeNeedsReset && !isNaN(startTime)) {
-            var selectionOffset = this._linearTimelineOverview.selectionStartTime - this._linearTimelineOverview.startTime;
-
-            this._linearTimelineOverview.startTime = startTime;
-            this._linearTimelineOverview.selectionStartTime = startTime + selectionOffset;
-
+            this._timelineOverview.startTime = startTime;
             this._overviewTimelineView.zeroTime = startTime;
             for (var timelineView of this._timelineViewMap.values())
                 timelineView.zeroTime = startTime;
@@ -431,25 +412,17 @@
             this._startTimeNeedsReset = false;
         }
 
-        this._linearTimelineOverview.endTime = Math.max(endTime, currentTime);
+        this._timelineOverview.endTime = Math.max(endTime, currentTime);
 
         this._currentTime = currentTime;
-        this._linearTimelineOverview.currentTime = currentTime;
+        this._timelineOverview.currentTime = currentTime;
         if (this.currentTimelineView)
             this.currentTimelineView.currentTime = currentTime;
 
-        if (this._renderingFrameTimeline) {
-            var currentFrameNumber = 0;
-            if (this._renderingFrameTimeline.records.length)
-                currentFrameNumber = this._renderingFrameTimeline.records.lastValue.frameNumber;
-
-            this._renderingFrameTimelineOverview.currentTime = this._renderingFrameTimelineOverview.endTime = currentFrameNumber;
-        }
-
         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._currentTimelineOverview.updateLayoutIfNeeded();
+        this._timelineOverview.updateLayoutIfNeeded();
         if (this.currentTimelineView)
             this.currentTimelineView.updateLayoutIfNeeded();
     }
@@ -556,7 +529,7 @@
         const rulerHeight = 29;
         
         let styleValue = (rulerHeight + this.timelineOverviewHeight) + "px";
-        this._currentTimelineOverview.element.style.height = styleValue;
+        this._timelineOverview.element.style.height = styleValue;
         this._contentViewContainer.element.style.top = styleValue;
     }
 
@@ -631,8 +604,7 @@
         this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
         this._waitingToResetCurrentTime = false;
 
-        this._linearTimelineOverview.reset();
-        this._renderingFrameTimelineOverview.reset();
+        this._timelineOverview.reset();
         this._overviewTimelineView.reset();
         for (var timelineView of this._timelineViewMap.values())
             timelineView.reset();
@@ -650,8 +622,8 @@
     _timeRangeSelectionChanged(event)
     {
         if (this.currentTimelineView) {
-            this.currentTimelineView.startTime = this._currentTimelineOverview.selectionStartTime;
-            this.currentTimelineView.endTime = this._currentTimelineOverview.selectionStartTime + this._currentTimelineOverview.selectionDuration;
+            this.currentTimelineView.startTime = this._timelineOverview.selectionStartTime;
+            this.currentTimelineView.endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
 
             if (this.currentTimelineView.representedObject.type === WebInspector.TimelineRecord.Type.RenderingFrame)
                 this._updateFrameSelection();
@@ -701,8 +673,8 @@
         if (!this._renderingFrameTimeline)
             return;
 
-        var startIndex = this._renderingFrameTimelineOverview.selectionStartTime;
-        var endIndex = startIndex + this._renderingFrameTimelineOverview.selectionDuration - 1;
+        let startIndex = this._timelineOverview.selectionStartTime;
+        let endIndex = startIndex + this._timelineOverview.selectionDuration - 1;
         this._timelineSidebarPanel.updateFrameSelection(startIndex, endIndex);
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js (196605 => 196606)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2016-02-15 23:57:22 UTC (rev 196605)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js	2016-02-15 23:57:25 UTC (rev 196606)
@@ -81,8 +81,8 @@
         this.element.insertBefore(this._basicTitleBar, this.element.firstChild);
 
         if (WebInspector.FPSInstrument.supported()) {
-            var timelinesNavigationItem = new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineSidebarPanel.ViewMode.Timelines, WebInspector.UIString("Timelines"))
-            var renderingFramesNavigationItem = new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames, WebInspector.UIString("Rendering Frames"))
+            let timelinesNavigationItem = new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.Timelines, WebInspector.UIString("Timelines"))
+            let renderingFramesNavigationItem = new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.RenderingFrames, WebInspector.UIString("Rendering Frames"))
             this._viewModeNavigationBar = new WebInspector.NavigationBar(null, [timelinesNavigationItem, renderingFramesNavigationItem], "tablist");
             this._viewModeNavigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected, this._viewModeSelected, this);
 
@@ -198,9 +198,6 @@
         if (this._displayedContentView)
             this.contentBrowser.showContentView(this._displayedContentView);
 
-        if (this.viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames)
-            this._refreshFrameSelectionChart();
-
         this._toggleRecordingShortcut.disabled = false;
         this._toggleNewRecordingShortcut.disabled = false;
 
@@ -226,11 +223,6 @@
         WebInspector.timelineManager.reset();
     }
 
-    get viewMode()
-    {
-        return this._viewMode;
-    }
-
     showDefaultContentView()
     {
         if (this._displayedContentView)
@@ -343,9 +335,6 @@
 
         this._displayedContentView.showOverviewTimelineView();
         this.contentBrowser.showContentView(this._displayedContentView);
-
-        var selectedByUser = false;
-        this._changeViewMode(WebInspector.TimelineSidebarPanel.ViewMode.Timelines, selectedByUser);
     }
 
     showTimelineViewForTimeline(timeline)
@@ -353,10 +342,6 @@
         console.assert(timeline instanceof WebInspector.Timeline, timeline);
         console.assert(this._displayedRecording.timelines.has(timeline.type), "Cannot show timeline because it does not belong to the shown recording.", timeline.type);
 
-        // The sidebar view mode must be in the correct state before changing the content view.
-        var selectedByUser = false;
-        this._changeViewMode(this._viewModeForTimeline(timeline), selectedByUser);
-
         if (this._timelineTreeElementMap.has(timeline)) {
             // Defer showing the relevant timeline to the onselect handler of the timelines tree element.
             var wasSelectedByUser = true;
@@ -371,7 +356,6 @@
     updateFrameSelection(startFrameIndex, endFrameIndex)
     {
         console.assert(startFrameIndex <= endFrameIndex, startFrameIndex, endFrameIndex);
-        console.assert(this.viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames, this._viewMode);
         if (this._startFrameIndex === startFrameIndex && this._endFrameIndex === endFrameIndex)
             return;
 
@@ -418,7 +402,7 @@
         if (!this._displayedContentView)
             return true;
 
-        if (this._viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames && this._renderingFrameTaskFilter.size) {
+        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames && this._renderingFrameTaskFilter.size) {
             while (treeElement && !(treeElement.record instanceof WebInspector.TimelineRecord))
                 treeElement = treeElement.parent;
 
@@ -487,7 +471,7 @@
 
         cookie[WebInspector.TimelineSidebarPanel.ShowingTimelineRecordingContentViewCookieKey] = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
 
-        if (this._viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames)
+        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames)
             cookie[WebInspector.TimelineSidebarPanel.SelectedTimelineViewIdentifierCookieKey] = WebInspector.TimelineRecord.Type.RenderingFrame;
         else {
             var selectedTreeElement = this._timelinesTreeOutline.selectedTreeElement;
@@ -593,7 +577,7 @@
 
     _renderingFrameTimelineTimesUpdated(event)
     {
-        if (this.viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames)
+        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames)
             this._refreshFrameSelectionChart();
     }
 
@@ -624,10 +608,19 @@
 
     _contentBrowserCurrentContentViewDidChange(event)
     {
-        var didShowTimelineRecordingContentView = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
+        let didShowTimelineRecordingContentView = this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;
         this.element.classList.toggle(WebInspector.TimelineSidebarPanel.TimelineRecordingContentViewShowingStyleClass, didShowTimelineRecordingContentView);
 
-        if (this.viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames)
+        if (!didShowTimelineRecordingContentView)
+            return;
+
+        this._updateViewModeIfNeeded();
+        this._timelineCountChanged();
+
+        this.updateFilter();
+
+        let timelineView = this.contentBrowser.currentContentView.currentTimelineView;
+        if (timelineView.representedObject.type === WebInspector.TimelineRecord.Type.RenderingFrame)
             this._refreshFrameSelectionChart();
     }
 
@@ -693,10 +686,15 @@
         var cookie = {};
         this.saveStateToCookie(cookie);
 
+        if (this._displayedContentView)
+            this._displayedContentView.removeEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._updateViewModeIfNeeded, this);
+
         // 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) {
+            this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._updateViewModeIfNeeded, this);
+
             // 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)
@@ -710,6 +708,8 @@
 
         _onlyExisting_ = false;
         this._displayedContentView = this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording, onlyExisting, {timelineSidebarPanel: this});
+        if (this._displayedContentView)
+            this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._updateViewModeIfNeeded, this);
 
         // Restore the cookie to carry over the previous recording view state to the new recording.
         this.restoreStateFromCookie(cookie);
@@ -859,52 +859,32 @@
         if (!event.target.selectedNavigationItem)
             return;
 
-        var selectedNavigationItem = event.target.selectedNavigationItem;
-        var selectedByUser = true;
-        this._changeViewMode(selectedNavigationItem.identifier, selectedByUser);
-    }
-
-    _viewModeForTimeline(timeline)
-    {
-        if (timeline && timeline.type === WebInspector.TimelineRecord.Type.RenderingFrame)
-            return WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames;
-
-        return WebInspector.TimelineSidebarPanel.ViewMode.Timelines;
-    }
-
-    _changeViewMode(mode, selectedByUser)
-    {
-        if (!WebInspector.FPSInstrument.supported() || this._viewMode === mode)
+        let selectedNavigationItem = event.target.selectedNavigationItem;
+        let newViewMode = selectedNavigationItem.identifier;
+        if (this._viewMode === newViewMode)
             return;
 
-        this._viewMode = mode;
-        this._viewModeNavigationBar.selectedNavigationItem = this._viewMode;
-
-        if (this._viewMode === WebInspector.TimelineSidebarPanel.ViewMode.Timelines) {
-            this._timelinesTreeOutline.hidden = false;
-            this._frameSelectionChartSection.collapsed = true;
-        } else {
-            this._timelinesTreeOutline.hidden = true;
-            this._frameSelectionChartSection.collapsed = false;
+        let timelineType = this._previousSelectedTimelineType;
+        if (newViewMode === WebInspector.TimelineOverview.ViewMode.RenderingFrames) {
+            this._previousSelectedTimelineType = this._timelinesTreeOutline.selectedTreeElement ? this._timelinesTreeOutline.selectedTreeElement.representedObject.type : null;
+            timelineType = WebInspector.TimelineRecord.Type.RenderingFrame;
         }
 
-        if (selectedByUser) {
-            var timelineType = this._previousSelectedTimelineType;
-            if (this._viewMode === WebInspector.TimelineSidebarPanel.ViewMode.RenderingFrames) {
-                this._previousSelectedTimelineType = this._timelinesTreeOutline.selectedTreeElement ? this._timelinesTreeOutline.selectedTreeElement.representedObject.type : null;
-                timelineType = WebInspector.TimelineRecord.Type.RenderingFrame;
-            }
-
-            if (timelineType) {
-                console.assert(this._displayedRecording.timelines.has(timelineType), timelineType);
-                this.showTimelineViewForTimeline(this._displayedRecording.timelines.get(timelineType));
-            } else
-                this.showTimelineOverview();
+        if (timelineType) {
+            console.assert(this._displayedRecording.timelines.has(timelineType), timelineType);
+            this.showTimelineViewForTimeline(this._displayedRecording.timelines.get(timelineType));
+            return;
         }
 
-        this._timelineCountChanged();
+        this.showTimelineOverview();
+    }
 
-        this.updateFilter();
+    _viewModeForTimeline(timeline)
+    {
+        if (timeline && timeline.type === WebInspector.TimelineRecord.Type.RenderingFrame)
+            return WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+
+        return WebInspector.TimelineOverview.ViewMode.Timelines;
     }
 
     _frameSelectionLegendItemChecked(event)
@@ -1041,11 +1021,29 @@
     {
         this._replayPauseResumeButtonItem.toggled = false;
     }
-};
 
-WebInspector.TimelineSidebarPanel.ViewMode = {
-    Timelines: "timeline-sidebar-panel-view-mode-timelines",
-    RenderingFrames: "timeline-sidebar-panel-view-mode-frames"
+    _updateViewModeIfNeeded()
+    {
+        let timelineView = this.contentBrowser.currentContentView.currentTimelineView;
+        let newViewMode = WebInspector.TimelineOverview.ViewMode.Timelines;
+        if (timelineView.representedObject instanceof WebInspector.Timeline && timelineView.representedObject.type === WebInspector.TimelineRecord.Type.RenderingFrame)
+            newViewMode = WebInspector.TimelineOverview.ViewMode.RenderingFrames;
+
+        if (newViewMode === this._viewMode)
+            return;
+
+        this._viewMode = newViewMode;
+
+        if (this._viewMode === WebInspector.TimelineOverview.ViewMode.Timelines) {
+            this._timelinesTreeOutline.hidden = false;
+            this._frameSelectionChartSection.collapsed = true;
+        } else {
+            this._timelinesTreeOutline.hidden = true;
+            this._frameSelectionChartSection.collapsed = false;
+        }
+
+        this._viewModeNavigationBar.selectedNavigationItem = this._viewMode;
+    }
 };
 
 WebInspector.TimelineSidebarPanel.HiddenStyleClassName = "hidden";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to