<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192616] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192616">192616</a></dd>
<dt>Author</dt> <dd>mattbaker@apple.com</dd>
<dt>Date</dt> <dd>2015-11-19 00:05:01 -0800 (Thu, 19 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLayoutTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNetworkTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsRenderingFrameTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsScriptTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineOverviewjs">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordingContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,69 @@
</span><ins>+2015-11-19 Matt Baker <mattbaker@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.
+
</ins><span class="cx"> 2015-11-18 Brian Burg <bburg@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Storage tab shouldn't hide cookies for .example.com when inspected page is foo.bar.example.com
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLayoutTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -58,10 +58,10 @@
</span><span class="cx"> this._timelinePaintRecordRow = createRecordRow.call(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout()
</del><ins>+ // Protected
+
+ layout()
</ins><span class="cx"> {
</span><del>- super.updateLayout();
-
</del><span class="cx"> this._updateRowLayout(this._timelinePaintRecordRow);
</span><span class="cx"> this._updateRowLayout(this._timelineLayoutRecordRow);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNetworkTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineOverviewGraph.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -61,17 +61,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout()
</del><ins>+ // Protected
+
+ layout()
</ins><span class="cx"> {
</span><del>- super.updateLayout();
</del><ins>+ let secondsPerPixel = this.timelineOverview.secondsPerPixel;
+ let recordBarIndex = 0;
</ins><span class="cx">
</span><del>- var secondsPerPixel = this.timelineOverview.secondsPerPixel;
-
- var recordBarIndex = 0;
-
</del><span class="cx"> function createBar(rowElement, rowRecordBars, records, renderMode)
</span><span class="cx"> {
</span><del>- var timelineRecordBar = rowRecordBars[recordBarIndex];
</del><ins>+ let timelineRecordBar = rowRecordBars[recordBarIndex];
</ins><span class="cx"> if (!timelineRecordBar)
</span><span class="cx"> timelineRecordBar = rowRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
</span><span class="cx"> else {
</span><span class="lines">@@ -84,9 +83,9 @@
</span><span class="cx"> ++recordBarIndex;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (var rowRecords of this._timelineRecordGridRows) {
- var rowElement = rowRecords.__element;
- var rowRecordBars = rowRecords.__recordBars;
</del><ins>+ for (let rowRecords of this._timelineRecordGridRows) {
+ let rowElement = rowRecords.__element;
+ let rowRecordBars = rowRecords.__recordBars;
</ins><span class="cx">
</span><span class="cx"> recordBarIndex = 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsRenderingFrameTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineOverviewGraph.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -93,21 +93,21 @@
</span><span class="cx"> this._timelineRecordFrames[frameIndex].filtered = filtered;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout()
- {
- super.updateLayout();
</del><ins>+ // Protected
</ins><span class="cx">
</span><ins>+ layout()
+ {
</ins><span class="cx"> if (!this._renderingFrameTimeline.records.length)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- 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;
</del><ins>+ 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;
</ins><span class="cx">
</span><del>- for (var i = startIndex; i <= endIndex; ++i) {
- var record = records[i];
- var timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex];
</del><ins>+ for (let i = startIndex; i <= endIndex; ++i) {
+ let record = records[i];
+ let timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex];
</ins><span class="cx"> if (!timelineRecordFrame)
</span><span class="cx"> timelineRecordFrame = this._timelineRecordFrames[recordFrameIndex] = new WebInspector.TimelineRecordFrame(this, record);
</span><span class="cx"> else
</span><span class="lines">@@ -131,8 +131,6 @@
</span><span class="cx"> this._updateFrameMarker();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Protected
-
</del><span class="cx"> updateSelectedRecord()
</span><span class="cx"> {
</span><span class="cx"> if (!this.selectedRecord) {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsScriptTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineOverviewGraph.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -50,17 +50,16 @@
</span><span class="cx"> this.element.removeChildren();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout()
</del><ins>+ // Protected
+
+ layout()
</ins><span class="cx"> {
</span><del>- super.updateLayout();
</del><ins>+ let secondsPerPixel = this.timelineOverview.secondsPerPixel;
+ let recordBarIndex = 0;
</ins><span class="cx">
</span><del>- var secondsPerPixel = this.timelineOverview.secondsPerPixel;
-
- var recordBarIndex = 0;
-
</del><span class="cx"> function createBar(records, renderMode)
</span><span class="cx"> {
</span><del>- var timelineRecordBar = this._timelineRecordBars[recordBarIndex];
</del><ins>+ let timelineRecordBar = this._timelineRecordBars[recordBarIndex];
</ins><span class="cx"> if (!timelineRecordBar)
</span><span class="cx"> timelineRecordBar = this._timelineRecordBars[recordBarIndex] = new WebInspector.TimelineRecordBar(records, renderMode);
</span><span class="cx"> else {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineOverviewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.TimelineOverview = class TimelineOverview extends WebInspector.Object
</del><ins>+WebInspector.TimelineOverview = class TimelineOverview extends WebInspector.View
</ins><span class="cx"> {
</span><span class="cx"> constructor(identifier, timelineRecording, minimumDurationPerPixel, maximumDurationPerPixel, defaultSettingsValues)
</span><span class="cx"> {
</span><span class="lines">@@ -37,16 +37,15 @@
</span><span class="cx"> this._recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded, this._markerAdded, this);
</span><span class="cx"> this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
</span><span class="cx">
</span><del>- 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));
</del><ins>+ 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));
</ins><span class="cx">
</span><span class="cx"> this._graphsContainerElement = document.createElement("div");
</span><span class="cx"> this._graphsContainerElement.classList.add("graphs-container");
</span><del>- this._element.appendChild(this._graphsContainerElement);
</del><ins>+ this.element.appendChild(this._graphsContainerElement);
</ins><span class="cx">
</span><span class="cx"> this._timelineOverviewGraphsMap = new Map;
</span><span class="cx">
</span><span class="lines">@@ -56,7 +55,7 @@
</span><span class="cx"> this._timelineRuler.element.addEventListener("mousedown", this._timelineRulerMouseDown.bind(this));
</span><span class="cx"> this._timelineRuler.element.addEventListener("click", this._timelineRulerMouseClicked.bind(this));
</span><span class="cx"> this._timelineRuler.addEventListener(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
</span><del>- this._element.appendChild(this._timelineRuler.element);
</del><ins>+ this.addSubview(this._timelineRuler);
</ins><span class="cx">
</span><span class="cx"> this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
</span><span class="cx"> this._timelineRuler.addMarker(this._currentTimeMarker);
</span><span class="lines">@@ -64,7 +63,7 @@
</span><span class="cx"> this._scrollContainerElement = document.createElement("div");
</span><span class="cx"> this._scrollContainerElement.classList.add("scroll-container");
</span><span class="cx"> this._scrollContainerElement.addEventListener("scroll", this._handleScrollEvent.bind(this));
</span><del>- this._element.appendChild(this._scrollContainerElement);
</del><ins>+ this.element.appendChild(this._scrollContainerElement);
</ins><span class="cx">
</span><span class="cx"> this._scrollWidthSizer = document.createElement("div");
</span><span class="cx"> this._scrollWidthSizer.classList.add("scroll-width-sizer");
</span><span class="lines">@@ -100,11 +99,6 @@
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><del>- get element()
- {
- return this._element;
- }
-
</del><span class="cx"> get startTime()
</span><span class="cx"> {
</span><span class="cx"> return this._startTime;
</span><span class="lines">@@ -117,7 +111,7 @@
</span><span class="cx">
</span><span class="cx"> this._startTime = x || 0;
</span><span class="cx">
</span><del>- this._needsLayout();
</del><ins>+ this.needsLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get currentTime()
</span><span class="lines">@@ -133,7 +127,7 @@
</span><span class="cx"> this._currentTime = x || 0;
</span><span class="cx"> this._revealCurrentTime = true;
</span><span class="cx">
</span><del>- this._needsLayout();
</del><ins>+ this.needsLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get secondsPerPixel()
</span><span class="lines">@@ -157,7 +151,7 @@
</span><span class="cx"> this._durationPerPixel = x;
</span><span class="cx"> this._durationPerPixelSetting.value = x;
</span><span class="cx">
</span><del>- this._needsLayout();
</del><ins>+ this.needsLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get pixelAlignDuration()
</span><span class="lines">@@ -188,7 +182,7 @@
</span><span class="cx">
</span><span class="cx"> this._endTime = x || 0;
</span><span class="cx">
</span><del>- this._needsLayout();
</del><ins>+ this.needsLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get scrollStartTime()
</span><span class="lines">@@ -203,7 +197,7 @@
</span><span class="cx">
</span><span class="cx"> this._scrollStartTime = x || 0;
</span><span class="cx">
</span><del>- this._needsLayout();
</del><ins>+ this.needsLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get visibleDuration()
</span><span class="lines">@@ -311,16 +305,37 @@
</span><span class="cx"> this.updateLayout();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout()
</del><ins>+ updateLayoutIfNeeded()
</ins><span class="cx"> {
</span><del>- if (this._scheduledLayoutUpdateIdentifier) {
- cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
- this._scheduledLayoutUpdateIdentifier = undefined;
</del><ins>+ if (this.layoutPending) {
+ super.updateLayoutIfNeeded();
+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ 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()
+ {
</ins><span class="cx"> // Calculate the required width based on the duration and seconds per pixel.
</span><del>- var duration = this._endTime - this._startTime;
- var newWidth = Math.ceil(duration / this._durationPerPixel);
</del><ins>+ let duration = this._endTime - this._startTime;
+ let newWidth = Math.ceil(duration / this._durationPerPixel);
</ins><span class="cx">
</span><span class="cx"> // Update all relevant elements to the new required width.
</span><span class="cx"> this._updateElementWidth(this._scrollWidthSizer, newWidth);
</span><span class="lines">@@ -335,7 +350,7 @@
</span><span class="cx"> const visibleDuration = this.visibleDuration;
</span><span class="cx">
</span><span class="cx"> // Clamp the scroll start time to match what the scroll bar would allow.
</span><del>- var scrollStartTime = Math.min(this._scrollStartTime, this._endTime - visibleDuration);
</del><ins>+ let scrollStartTime = Math.min(this._scrollStartTime, this._endTime - visibleDuration);
</ins><span class="cx"> scrollStartTime = Math.max(this._startTime, scrollStartTime);
</span><span class="cx">
</span><span class="cx"> this._timelineRuler.zeroTime = this._startTime;
</span><span class="lines">@@ -347,9 +362,7 @@
</span><span class="cx"> this._scrollContainerElement.scrollLeft = Math.ceil((scrollStartTime - this._startTime) / this._durationPerPixel);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- this._timelineRuler.updateLayout();
-
- for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values()) {
</del><ins>+ for (let timelineOverviewGraph of this._timelineOverviewGraphsMap.values()) {
</ins><span class="cx"> timelineOverviewGraph.zeroTime = this._startTime;
</span><span class="cx"> timelineOverviewGraph.startTime = scrollStartTime;
</span><span class="cx"> timelineOverviewGraph.currentTime = this._currentTime;
</span><span class="lines">@@ -358,32 +371,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- 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.");
- }
-
</del><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _updateElementWidth(element, newWidth)
</span><span class="lines">@@ -436,7 +423,7 @@
</span><span class="cx"> // cases of inadvertent zooming for slightly diagonal scrolls.
</span><span class="cx"> if (Math.abs(event.deltaX) >= Math.abs(event.deltaY) * 0.5) {
</span><span class="cx"> // Clone the event to dispatch it on the scroll container. Mark it as cloned so we don't get into a loop.
</span><del>- var newWheelEvent = new event.constructor(event.type, event);
</del><ins>+ let newWheelEvent = new event.constructor(event.type, event);
</ins><span class="cx"> newWheelEvent.__cloned = true;
</span><span class="cx">
</span><span class="cx"> this._scrollContainerElement.dispatchEvent(newWheelEvent);
</span><span class="lines">@@ -444,16 +431,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Remember the mouse position in time.
</span><del>- 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;
</del><ins>+ 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;
</ins><span class="cx">
</span><span class="cx"> // Reset accumulated wheel delta when direction changes.
</span><span class="cx"> if (this._pixelAlignDuration && (delta < 0 && this._mouseWheelDelta >= 0 || delta >= 0 && this._mouseWheelDelta < 0))
</span><span class="cx"> this._mouseWheelDelta = 0;
</span><span class="cx">
</span><del>- var previousDurationPerPixel = this._durationPerPixel;
</del><ins>+ let previousDurationPerPixel = this._durationPerPixel;
</ins><span class="cx"> this._mouseWheelDelta += delta;
</span><span class="cx"> this.secondsPerPixel += this._mouseWheelDelta;
</span><span class="cx">
</span><span class="lines">@@ -476,7 +463,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- let mouseOffset = event.pageX - this._element.totalOffsetLeft;
</del><ins>+ let mouseOffset = event.pageX - this.element.totalOffsetLeft;
</ins><span class="cx"> let mousePositionTime = this._scrollStartTime + (mouseOffset * this._durationPerPixel);
</span><span class="cx">
</span><span class="cx"> this._handlingGesture = true;
</span><span class="lines">@@ -492,7 +479,7 @@
</span><span class="cx"> // Cap zooming out at 5x.
</span><span class="cx"> let scale = Math.max(1/5, event.scale);
</span><span class="cx">
</span><del>- let mouseOffset = event.pageX - this._element.totalOffsetLeft;
</del><ins>+ let mouseOffset = event.pageX - this.element.totalOffsetLeft;
</ins><span class="cx"> let newSecondsPerPixel = this._gestureStartDurationPerPixel / scale;
</span><span class="cx">
</span><span class="cx"> this.secondsPerPixel = newSecondsPerPixel;
</span><span class="lines">@@ -523,21 +510,23 @@
</span><span class="cx"> var overviewGraph = WebInspector.TimelineOverviewGraph.createForTimeline(timeline, this);
</span><span class="cx"> overviewGraph.addEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
</span><span class="cx"> this._timelineOverviewGraphsMap.set(timeline, overviewGraph);
</span><ins>+
+ // FIXME: use View.prototype.addSubview(overviewGraph) once <https://webkit.org/b/150982> is fixed.
</ins><span class="cx"> this._graphsContainerElement.appendChild(overviewGraph.element);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _timelineRemoved(event)
</span><span class="cx"> {
</span><del>- var timeline = event.data.timeline;
</del><ins>+ let timeline = event.data.timeline;
</ins><span class="cx"> console.assert(timeline instanceof WebInspector.Timeline, timeline);
</span><span class="cx"> if (!this.canShowTimeline(timeline))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> console.assert(this._timelineOverviewGraphsMap.has(timeline), timeline);
</span><span class="cx">
</span><del>- var overviewGraph = this._timelineOverviewGraphsMap.take(timeline);
</del><ins>+ let overviewGraph = this._timelineOverviewGraphsMap.take(timeline);
</ins><span class="cx"> overviewGraph.removeEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected, this._recordSelected, this);
</span><del>- this._graphsContainerElement.removeChild(overviewGraph.element);
</del><ins>+ overviewGraph.element.remove();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _markerAdded(event)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -23,13 +23,12 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.TimelineOverviewGraph = class TimelineOverviewGraph extends WebInspector.Object
</del><ins>+WebInspector.TimelineOverviewGraph = class TimelineOverviewGraph extends WebInspector.View
</ins><span class="cx"> {
</span><span class="cx"> constructor(timelineOverview)
</span><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx">
</span><del>- this.element = document.createElement("div");
</del><span class="cx"> this.element.classList.add("timeline-overview-graph");
</span><span class="cx">
</span><span class="cx"> this._zeroTime = 0;
</span><span class="lines">@@ -39,8 +38,7 @@
</span><span class="cx"> this._timelineOverview = timelineOverview;
</span><span class="cx"> this._selectedRecord = null;
</span><span class="cx"> this._selectedRecordChanged = false;
</span><del>- this._scheduledLayoutUpdateIdentifier = 0;
- this._scheduledSelectedRecordLayoutUpdateIdentifier = 0;
</del><ins>+ this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="lines">@@ -176,36 +174,17 @@
</span><span class="cx"> // Implemented by sub-classes if needed.
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout()
- {
- if (this._scheduledLayoutUpdateIdentifier) {
- cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
- this._scheduledLayoutUpdateIdentifier = 0;
- }
-
- // Implemented by sub-classes if needed.
- }
-
- updateLayoutIfNeeded()
- {
- if (!this._scheduledLayoutUpdateIdentifier)
- return;
- this.updateLayout();
- }
-
- // Protected
-
</del><span class="cx"> needsLayout()
</span><span class="cx"> {
</span><ins>+ // FIXME: needsLayout can be removed once <https://webkit.org/b/150741> is fixed.
</ins><span class="cx"> if (!this._visible)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (this._scheduledLayoutUpdateIdentifier)
- return;
-
- this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
</del><ins>+ super.needsLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Protected
+
</ins><span class="cx"> dispatchSelectedRecordChangedEvent()
</span><span class="cx"> {
</span><span class="cx"> if (!this._selectedRecordChanged)
</span><span class="lines">@@ -226,20 +205,16 @@
</span><span class="cx"> _needsSelectedRecordLayout()
</span><span class="cx"> {
</span><span class="cx"> // If layout is scheduled, abort since the selected record will be updated when layout happens.
</span><del>- if (this._scheduledLayoutUpdateIdentifier)
</del><ins>+ if (this.layoutPending)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (this._scheduledSelectedRecordLayoutUpdateIdentifier)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- function update()
- {
- this._scheduledSelectedRecordLayoutUpdateIdentifier = 0;
-
</del><ins>+ this._scheduledSelectedRecordLayoutUpdateIdentifier = requestAnimationFrame(() => {
+ this._scheduledSelectedRecordLayoutUpdateIdentifier = undefined;
</ins><span class="cx"> this.updateSelectedRecord();
</span><del>- }
-
- this._scheduledSelectedRecordLayoutUpdateIdentifier = requestAnimationFrame(update.bind(this));
</del><ins>+ });
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordingContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (192615 => 192616)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -47,8 +47,7 @@
</span><span class="cx">
</span><span class="cx"> this._currentTimelineOverview = this._linearTimelineOverview;
</span><span class="cx">
</span><del>- // FIXME: use View.prototype.addSubview once <https://webkit.org/b/149190> is fixed.
- this.element.appendChild(this._currentTimelineOverview.element);
</del><ins>+ this.addSubview(this._currentTimelineOverview);
</ins><span class="cx">
</span><span class="cx"> this._contentViewContainer = new WebInspector.ContentViewContainer;
</span><span class="cx"> this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
</span><span class="lines">@@ -341,9 +340,7 @@
</span><span class="cx"> if (newTimelineOverview !== this._currentTimelineOverview) {
</span><span class="cx"> this._currentTimelineOverview.hidden();
</span><span class="cx">
</span><del>- // 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);
</del><ins>+ this.replaceSubview(this._currentTimelineOverview, newTimelineOverview);
</ins><span class="cx">
</span><span class="cx"> this._currentTimelineOverview = newTimelineOverview;
</span><span class="cx"> this._currentTimelineOverview.shown();
</span></span></pre>
</div>
</div>
</body>
</html>