Title: [192616] trunk/Source/WebInspectorUI
Revision
192616
Author
mattba...@apple.com
Date
2015-11-19 00:05:01 -0800 (Thu, 19 Nov 2015)

Log Message

Web Inspector: Convert remaining timeline views to use View base class
https://bugs.webkit.org/show_bug.cgi?id=151410

Reviewed by Timothy Hatcher.

Converted timeline views to use View base class. Mostly mechanical
changes (override View.prototype.layout, use let in more places).

* UserInterface/Views/LayoutTimelineOverviewGraph.js:
(WebInspector.LayoutTimelineOverviewGraph.prototype.layout):
(WebInspector.LayoutTimelineOverviewGraph.prototype.updateLayout): Deleted.

* UserInterface/Views/NetworkTimelineOverviewGraph.js:
(WebInspector.NetworkTimelineOverviewGraph.prototype.layout.createBar):
(WebInspector.NetworkTimelineOverviewGraph.prototype.layout):
(WebInspector.NetworkTimelineOverviewGraph.prototype.updateLayout.createBar): Deleted.
(WebInspector.NetworkTimelineOverviewGraph.prototype.updateLayout): Deleted.

* UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
(WebInspector.RenderingFrameTimelineOverviewGraph.prototype.layout):
(WebInspector.RenderingFrameTimelineOverviewGraph.prototype.updateLayout): Deleted.

* UserInterface/Views/ScriptTimelineOverviewGraph.js:
(WebInspector.ScriptTimelineOverviewGraph.prototype.layout.createBar):
(WebInspector.ScriptTimelineOverviewGraph.prototype.layout):
(WebInspector.ScriptTimelineOverviewGraph.prototype.updateLayout.createBar): Deleted.
(WebInspector.ScriptTimelineOverviewGraph.prototype.updateLayout): Deleted.

* UserInterface/Views/TimelineOverview.js:
Extend View.
(WebInspector.TimelineOverview):
Add ruler as a subview.
(WebInspector.TimelineOverview.prototype.set startTime):
(WebInspector.TimelineOverview.prototype.set currentTime):
(WebInspector.TimelineOverview.prototype.set secondsPerPixel):
(WebInspector.TimelineOverview.prototype.set endTime):
(WebInspector.TimelineOverview.prototype.set scrollStartTime):
(WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
(WebInspector.TimelineOverview.prototype.get timelineRuler):
(WebInspector.TimelineOverview.prototype.canShowTimeline):
(WebInspector.TimelineOverview.prototype.layout):
(WebInspector.TimelineOverview.prototype._handleWheelEvent):
(WebInspector.TimelineOverview._handleGestureStart):
(WebInspector.TimelineOverview.prototype._handleGestureChange):
(WebInspector.TimelineOverview.prototype._timelineAdded):
(WebInspector.TimelineOverview.prototype._timelineRemoved):
(WebInspector.TimelineOverview.prototype.get element): Deleted.
(WebInspector.TimelineOverview.prototype.updateLayout): Deleted.

* UserInterface/Views/TimelineOverviewGraph.js:
Extend view.
(WebInspector.TimelineOverviewGraph):
(WebInspector.TimelineOverviewGraph.prototype.needsLayout):
(WebInspector.TimelineOverviewGraph.prototype._needsSelectedRecordLayout):
(WebInspector.TimelineOverviewGraph.prototype.updateLayout): Deleted.
(WebInspector.TimelineOverviewGraph.prototype.updateLayoutIfNeeded): Deleted.
(WebInspector.TimelineOverviewGraph.prototype._needsSelectedRecordLayout.update): Deleted.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
Add overview as a subview.
(WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
Use View.prototype.replaceSubview to swap overview graphs.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (192615 => 192616)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-11-19 08:05:01 UTC (rev 192616)
@@ -1,3 +1,69 @@
+2015-11-19  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: Convert remaining timeline views to use View base class
+        https://bugs.webkit.org/show_bug.cgi?id=151410
+
+        Reviewed by Timothy Hatcher.
+
+        Converted timeline views to use View base class. Mostly mechanical
+        changes (override View.prototype.layout, use let in more places).
+
+        * UserInterface/Views/LayoutTimelineOverviewGraph.js:
+        (WebInspector.LayoutTimelineOverviewGraph.prototype.layout):
+        (WebInspector.LayoutTimelineOverviewGraph.prototype.updateLayout): Deleted.
+
+        * UserInterface/Views/NetworkTimelineOverviewGraph.js:
+        (WebInspector.NetworkTimelineOverviewGraph.prototype.layout.createBar):
+        (WebInspector.NetworkTimelineOverviewGraph.prototype.layout):
+        (WebInspector.NetworkTimelineOverviewGraph.prototype.updateLayout.createBar): Deleted.
+        (WebInspector.NetworkTimelineOverviewGraph.prototype.updateLayout): Deleted.
+
+        * UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
+        (WebInspector.RenderingFrameTimelineOverviewGraph.prototype.layout):
+        (WebInspector.RenderingFrameTimelineOverviewGraph.prototype.updateLayout): Deleted.
+
+        * UserInterface/Views/ScriptTimelineOverviewGraph.js:
+        (WebInspector.ScriptTimelineOverviewGraph.prototype.layout.createBar):
+        (WebInspector.ScriptTimelineOverviewGraph.prototype.layout):
+        (WebInspector.ScriptTimelineOverviewGraph.prototype.updateLayout.createBar): Deleted.
+        (WebInspector.ScriptTimelineOverviewGraph.prototype.updateLayout): Deleted.
+
+        * UserInterface/Views/TimelineOverview.js:
+        Extend View.
+        (WebInspector.TimelineOverview):
+        Add ruler as a subview.
+        (WebInspector.TimelineOverview.prototype.set startTime):
+        (WebInspector.TimelineOverview.prototype.set currentTime):
+        (WebInspector.TimelineOverview.prototype.set secondsPerPixel):
+        (WebInspector.TimelineOverview.prototype.set endTime):
+        (WebInspector.TimelineOverview.prototype.set scrollStartTime):
+        (WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
+        (WebInspector.TimelineOverview.prototype.get timelineRuler):
+        (WebInspector.TimelineOverview.prototype.canShowTimeline):
+        (WebInspector.TimelineOverview.prototype.layout):
+        (WebInspector.TimelineOverview.prototype._handleWheelEvent):
+        (WebInspector.TimelineOverview._handleGestureStart):
+        (WebInspector.TimelineOverview.prototype._handleGestureChange):
+        (WebInspector.TimelineOverview.prototype._timelineAdded):
+        (WebInspector.TimelineOverview.prototype._timelineRemoved):
+        (WebInspector.TimelineOverview.prototype.get element): Deleted.
+        (WebInspector.TimelineOverview.prototype.updateLayout): Deleted.
+
+        * UserInterface/Views/TimelineOverviewGraph.js:
+        Extend view.
+        (WebInspector.TimelineOverviewGraph):
+        (WebInspector.TimelineOverviewGraph.prototype.needsLayout):
+        (WebInspector.TimelineOverviewGraph.prototype._needsSelectedRecordLayout):
+        (WebInspector.TimelineOverviewGraph.prototype.updateLayout): Deleted.
+        (WebInspector.TimelineOverviewGraph.prototype.updateLayoutIfNeeded): Deleted.
+        (WebInspector.TimelineOverviewGraph.prototype._needsSelectedRecordLayout.update): Deleted.
+
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView):
+        Add overview as a subview.
+        (WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
+        Use View.prototype.replaceSubview to swap overview graphs.
+
 2015-11-18  Brian Burg  <bb...@apple.com>
 
         Web Inspector: Storage tab shouldn't hide cookies for .example.com when inspected page is foo.bar.example.com

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -58,10 +58,10 @@
         this._timelinePaintRecordRow = createRecordRow.call(this);
     }
 
-    updateLayout()
+    // Protected
+
+    layout()
     {
-        super.updateLayout();
-
         this._updateRowLayout(this._timelinePaintRecordRow);
         this._updateRowLayout(this._timelineLayoutRecordRow);
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -61,17 +61,16 @@
         }
     }
 
-    updateLayout()
+    // Protected
+
+    layout()
     {
-        super.updateLayout();
+        let secondsPerPixel = this.timelineOverview.secondsPerPixel;
+        let recordBarIndex = 0;
 
-        var secondsPerPixel = this.timelineOverview.secondsPerPixel;
-
-        var recordBarIndex = 0;
-
         function createBar(rowElement, rowRecordBars, records, renderMode)
         {
-            var timelineRecordBar = rowRecordBars[recordBarIndex];
+            let timelineRecordBar = rowRecordBars[recordBarIndex];
             if (!timelineRecordBar)
                 timelineRecordBar = rowRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
             else {
@@ -84,9 +83,9 @@
             ++recordBarIndex;
         }
 
-        for (var rowRecords of this._timelineRecordGridRows) {
-            var rowElement = rowRecords.__element;
-            var rowRecordBars = rowRecords.__recordBars;
+        for (let rowRecords of this._timelineRecordGridRows) {
+            let rowElement = rowRecords.__element;
+            let rowRecordBars = rowRecords.__recordBars;
 
             recordBarIndex = 0;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -93,21 +93,21 @@
         this._timelineRecordFrames[frameIndex].filtered = filtered;
     }
 
-    updateLayout()
-    {
-        super.updateLayout();
+    // Protected
 
+    layout()
+    {
         if (!this._renderingFrameTimeline.records.length)
             return;
 
-        var records = this._renderingFrameTimeline.records;
-        var startIndex = Math.floor(this.startTime);
-        var endIndex = Math.min(Math.floor(this.endTime), records.length - 1);
-        var recordFrameIndex = 0;
+        let records = this._renderingFrameTimeline.records;
+        let startIndex = Math.floor(this.startTime);
+        let endIndex = Math.min(Math.floor(this.endTime), records.length - 1);
+        let recordFrameIndex = 0;
 
-        for (var i = startIndex; i <= endIndex; ++i) {
-            var record = records[i];
-            var timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex];
+        for (let i = startIndex; i <= endIndex; ++i) {
+            let record = records[i];
+            let timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex];
             if (!timelineRecordFrame)
                 timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex] = new WebInspector.TimelineRecordFrame(this, record);
             else
@@ -131,8 +131,6 @@
         this._updateFrameMarker();
     }
 
-    // Protected
-
     updateSelectedRecord()
     {
         if (!this.selectedRecord) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -50,17 +50,16 @@
         this.element.removeChildren();
     }
 
-    updateLayout()
+    // Protected
+
+    layout()
     {
-        super.updateLayout();
+        let secondsPerPixel = this.timelineOverview.secondsPerPixel;
+        let recordBarIndex = 0;
 
-        var secondsPerPixel = this.timelineOverview.secondsPerPixel;
-
-        var recordBarIndex = 0;
-
         function createBar(records, renderMode)
         {
-            var timelineRecordBar = this._timelineRecordBars[recordBarIndex];
+            let timelineRecordBar = this._timelineRecordBars[recordBarIndex];
             if (!timelineRecordBar)
                 timelineRecordBar = this._timelineRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
             else {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineOverview = class TimelineOverview extends WebInspector.Object
+WebInspector.TimelineOverview = class TimelineOverview extends WebInspector.View
 {
     constructor(identifier, timelineRecording, minimumDurationPerPixel, maximumDurationPerPixel, defaultSettingsValues)
     {
@@ -37,16 +37,15 @@
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
         this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
 
-        this._element = document.createElement("div");
-        this._element.classList.add("timeline-overview", identifier);
-        this._element.addEventListener("wheel", this._handleWheelEvent.bind(this));
-        this._element.addEventListener("gesturestart", this._handleGestureStart.bind(this));
-        this._element.addEventListener("gesturechange", this._handleGestureChange.bind(this));
-        this._element.addEventListener("gestureend", this._handleGestureEnd.bind(this));
+        this.element.classList.add("timeline-overview", identifier);
+        this.element.addEventListener("wheel", this._handleWheelEvent.bind(this));
+        this.element.addEventListener("gesturestart", this._handleGestureStart.bind(this));
+        this.element.addEventListener("gesturechange", this._handleGestureChange.bind(this));
+        this.element.addEventListener("gestureend", this._handleGestureEnd.bind(this));
 
         this._graphsContainerElement = document.createElement("div");
         this._graphsContainerElement.classList.add("graphs-container");
-        this._element.appendChild(this._graphsContainerElement);
+        this.element.appendChild(this._graphsContainerElement);
 
         this._timelineOverviewGraphsMap = new Map;
 
@@ -56,7 +55,7 @@
         this._timelineRuler.element.addEventListener("mousedown", this._timelineRulerMouseDown.bind(this));
         this._timelineRuler.element.addEventListener("click", this._timelineRulerMouseClicked.bind(this));
         this._timelineRuler.addEventListener(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
-        this._element.appendChild(this._timelineRuler.element);
+        this.addSubview(this._timelineRuler);
 
         this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
         this._timelineRuler.addMarker(this._currentTimeMarker);
@@ -64,7 +63,7 @@
         this._scrollContainerElement = document.createElement("div");
         this._scrollContainerElement.classList.add("scroll-container");
         this._scrollContainerElement.addEventListener("scroll", this._handleScrollEvent.bind(this));
-        this._element.appendChild(this._scrollContainerElement);
+        this.element.appendChild(this._scrollContainerElement);
 
         this._scrollWidthSizer = document.createElement("div");
         this._scrollWidthSizer.classList.add("scroll-width-sizer");
@@ -100,11 +99,6 @@
 
     // Public
 
-    get element()
-    {
-        return this._element;
-    }
-
     get startTime()
     {
         return this._startTime;
@@ -117,7 +111,7 @@
 
         this._startTime = x || 0;
 
-        this._needsLayout();
+        this.needsLayout();
     }
 
     get currentTime()
@@ -133,7 +127,7 @@
         this._currentTime = x || 0;
         this._revealCurrentTime = true;
 
-        this._needsLayout();
+        this.needsLayout();
     }
 
     get secondsPerPixel()
@@ -157,7 +151,7 @@
         this._durationPerPixel = x;
         this._durationPerPixelSetting.value = x;
 
-        this._needsLayout();
+        this.needsLayout();
     }
 
     get pixelAlignDuration()
@@ -188,7 +182,7 @@
 
         this._endTime = x || 0;
 
-        this._needsLayout();
+        this.needsLayout();
     }
 
     get scrollStartTime()
@@ -203,7 +197,7 @@
 
         this._scrollStartTime = x || 0;
 
-        this._needsLayout();
+        this.needsLayout();
     }
 
     get visibleDuration()
@@ -311,16 +305,37 @@
         this.updateLayout();
     }
 
-    updateLayout()
+    updateLayoutIfNeeded()
     {
-        if (this._scheduledLayoutUpdateIdentifier) {
-            cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
-            this._scheduledLayoutUpdateIdentifier = undefined;
+        if (this.layoutPending) {
+            super.updateLayoutIfNeeded();
+            return;
         }
 
+        this._timelineRuler.updateLayoutIfNeeded();
+
+        for (let timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
+            timelineOverviewGraph.updateLayoutIfNeeded();
+    }
+
+    // Protected
+
+    get timelineRuler()
+    {
+        return this._timelineRuler;
+    }
+
+    canShowTimeline(timeline)
+    {
+        // Implemented by subclasses.
+        console.error("Needs to be implemented by a subclass.");
+    }
+
+    layout()
+    {
         // Calculate the required width based on the duration and seconds per pixel.
-        var duration = this._endTime - this._startTime;
-        var newWidth = Math.ceil(duration / this._durationPerPixel);
+        let duration = this._endTime - this._startTime;
+        let newWidth = Math.ceil(duration / this._durationPerPixel);
 
         // Update all relevant elements to the new required width.
         this._updateElementWidth(this._scrollWidthSizer, newWidth);
@@ -335,7 +350,7 @@
         const visibleDuration = this.visibleDuration;
 
         // Clamp the scroll start time to match what the scroll bar would allow.
-        var scrollStartTime = Math.min(this._scrollStartTime, this._endTime - visibleDuration);
+        let scrollStartTime = Math.min(this._scrollStartTime, this._endTime - visibleDuration);
         scrollStartTime = Math.max(this._startTime, scrollStartTime);
 
         this._timelineRuler.zeroTime = this._startTime;
@@ -347,9 +362,7 @@
             this._scrollContainerElement.scrollLeft = Math.ceil((scrollStartTime - this._startTime) / this._durationPerPixel);
         }
 
-        this._timelineRuler.updateLayout();
-
-        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values()) {
+        for (let timelineOverviewGraph of this._timelineOverviewGraphsMap.values()) {
             timelineOverviewGraph.zeroTime = this._startTime;
             timelineOverviewGraph.startTime = scrollStartTime;
             timelineOverviewGraph.currentTime = this._currentTime;
@@ -358,32 +371,6 @@
         }
     }
 
-    updateLayoutIfNeeded()
-    {
-        if (this._scheduledLayoutUpdateIdentifier) {
-            this.updateLayout();
-            return;
-        }
-
-        this._timelineRuler.updateLayoutIfNeeded();
-
-        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
-            timelineOverviewGraph.updateLayoutIfNeeded();
-    }
-
-    // Protected
-
-    get timelineRuler()
-    {
-        return this._timelineRuler;
-    }
-
-    canShowTimeline(timeline)
-    {
-        // Implemented by subclasses.
-        console.error("Needs to be implemented by a subclass.");
-    }
-
     // Private
 
     _updateElementWidth(element, newWidth)
@@ -436,7 +423,7 @@
         // cases of inadvertent zooming for slightly diagonal scrolls.
         if (Math.abs(event.deltaX) >= Math.abs(event.deltaY) * 0.5) {
             // Clone the event to dispatch it on the scroll container. Mark it as cloned so we don't get into a loop.
-            var newWheelEvent = new event.constructor(event.type, event);
+            let newWheelEvent = new event.constructor(event.type, event);
             newWheelEvent.__cloned = true;
 
             this._scrollContainerElement.dispatchEvent(newWheelEvent);
@@ -444,16 +431,16 @@
         }
 
         // Remember the mouse position in time.
-        var mouseOffset = event.pageX - this._element.totalOffsetLeft;
-        var mousePositionTime = this._scrollStartTime + (mouseOffset * this._durationPerPixel);
-        var deviceDirection = event.webkitDirectionInvertedFromDevice ? 1 : -1;
-        var delta = event.deltaY * (this._durationPerPixel / WebInspector.TimelineOverview.ScrollDeltaDenominator) * deviceDirection;
+        let mouseOffset = event.pageX - this.element.totalOffsetLeft;
+        let mousePositionTime = this._scrollStartTime + (mouseOffset * this._durationPerPixel);
+        let deviceDirection = event.webkitDirectionInvertedFromDevice ? 1 : -1;
+        let delta = event.deltaY * (this._durationPerPixel / 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;
 
-        var previousDurationPerPixel = this._durationPerPixel;
+        let previousDurationPerPixel = this._durationPerPixel;
         this._mouseWheelDelta += delta;
         this.secondsPerPixel += this._mouseWheelDelta;
 
@@ -476,7 +463,7 @@
             return;
         }
 
-        let mouseOffset = event.pageX - this._element.totalOffsetLeft;
+        let mouseOffset = event.pageX - this.element.totalOffsetLeft;
         let mousePositionTime = this._scrollStartTime + (mouseOffset * this._durationPerPixel);
 
         this._handlingGesture = true;
@@ -492,7 +479,7 @@
         // Cap zooming out at 5x.
         let scale = Math.max(1/5, event.scale);
 
-        let mouseOffset = event.pageX - this._element.totalOffsetLeft;
+        let mouseOffset = event.pageX - this.element.totalOffsetLeft;
         let newSecondsPerPixel = this._gestureStartDurationPerPixel / scale;
 
         this.secondsPerPixel = newSecondsPerPixel;
@@ -523,21 +510,23 @@
         var overviewGraph = WebInspector.TimelineOverviewGraph.createForTimeline(timeline, this);
         overviewGraph.addEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
         this._timelineOverviewGraphsMap.set(timeline, overviewGraph);
+
+        // FIXME: use View.prototype.addSubview(overviewGraph) once <https://webkit.org/b/150982> is fixed.
         this._graphsContainerElement.appendChild(overviewGraph.element);
     }
 
     _timelineRemoved(event)
     {
-        var timeline = event.data.timeline;
+        let timeline = event.data.timeline;
         console.assert(timeline instanceof WebInspector.Timeline, timeline);
         if (!this.canShowTimeline(timeline))
             return;
 
         console.assert(this._timelineOverviewGraphsMap.has(timeline), timeline);
 
-        var overviewGraph = this._timelineOverviewGraphsMap.take(timeline);
+        let overviewGraph = this._timelineOverviewGraphsMap.take(timeline);
         overviewGraph.removeEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
-        this._graphsContainerElement.removeChild(overviewGraph.element);
+        overviewGraph.element.remove();
     }
 
     _markerAdded(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -23,13 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineOverviewGraph = class TimelineOverviewGraph extends WebInspector.Object
+WebInspector.TimelineOverviewGraph = class TimelineOverviewGraph extends WebInspector.View
 {
     constructor(timelineOverview)
     {
         super();
 
-        this.element = document.createElement("div");
         this.element.classList.add("timeline-overview-graph");
 
         this._zeroTime = 0;
@@ -39,8 +38,7 @@
         this._timelineOverview = timelineOverview;
         this._selectedRecord = null;
         this._selectedRecordChanged = false;
-        this._scheduledLayoutUpdateIdentifier = 0;
-        this._scheduledSelectedRecordLayoutUpdateIdentifier = 0;
+        this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
     }
 
     // Public
@@ -176,36 +174,17 @@
         // Implemented by sub-classes if needed.
     }
 
-    updateLayout()
-    {
-        if (this._scheduledLayoutUpdateIdentifier) {
-            cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
-            this._scheduledLayoutUpdateIdentifier = 0;
-        }
-
-        // Implemented by sub-classes if needed.
-    }
-
-    updateLayoutIfNeeded()
-    {
-        if (!this._scheduledLayoutUpdateIdentifier)
-            return;
-        this.updateLayout();
-    }
-
-    // Protected
-
     needsLayout()
     {
+        // FIXME: needsLayout can be removed once <https://webkit.org/b/150741> is fixed.
         if (!this._visible)
             return;
 
-        if (this._scheduledLayoutUpdateIdentifier)
-            return;
-
-        this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
+        super.needsLayout();
     }
 
+    // Protected
+
     dispatchSelectedRecordChangedEvent()
     {
         if (!this._selectedRecordChanged)
@@ -226,20 +205,16 @@
     _needsSelectedRecordLayout()
     {
         // If layout is scheduled, abort since the selected record will be updated when layout happens.
-        if (this._scheduledLayoutUpdateIdentifier)
+        if (this.layoutPending)
             return;
 
         if (this._scheduledSelectedRecordLayoutUpdateIdentifier)
             return;
 
-        function update()
-        {
-            this._scheduledSelectedRecordLayoutUpdateIdentifier = 0;
-
+        this._scheduledSelectedRecordLayoutUpdateIdentifier = requestAnimationFrame(() => {
+            this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
             this.updateSelectedRecord();
-        }
-
-        this._scheduledSelectedRecordLayoutUpdateIdentifier = requestAnimationFrame(update.bind(this));
+        });
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (192615 => 192616)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-11-19 06:30:38 UTC (rev 192615)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-11-19 08:05:01 UTC (rev 192616)
@@ -47,8 +47,7 @@
 
         this._currentTimelineOverview = this._linearTimelineOverview;
 
-        // FIXME: use View.prototype.addSubview once <https://webkit.org/b/149190> is fixed.
-        this.element.appendChild(this._currentTimelineOverview.element);
+        this.addSubview(this._currentTimelineOverview);
 
         this._contentViewContainer = new WebInspector.ContentViewContainer;
         this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
@@ -341,9 +340,7 @@
         if (newTimelineOverview !== this._currentTimelineOverview) {
             this._currentTimelineOverview.hidden();
 
-            // FIXME: use View.prototype.replaceSubview once <https://webkit.org/b/149190> is fixed.
-            this.element.insertBefore(newTimelineOverview.element, this._currentTimelineOverview.element);
-            this.element.removeChild(this._currentTimelineOverview.element);
+            this.replaceSubview(this._currentTimelineOverview, newTimelineOverview);
 
             this._currentTimelineOverview = newTimelineOverview;
             this._currentTimelineOverview.shown();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to