<!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>[162411] 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/162411">162411</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2014-01-20 18:55:21 -0800 (Mon, 20 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update the current WebInspector.TimelineView when time range changes.
https://bugs.webkit.org/show_bug.cgi?id=126667
Reviewed by Joseph Pecoraro.
* UserInterface/TimelineContentView.js:
(WebInspector.TimelineContentView.prototype._showTimelineView):
(WebInspector.TimelineContentView.prototype._update):
(WebInspector.TimelineContentView.prototype._startUpdatingCurrentTime):
(WebInspector.TimelineContentView.prototype._stopUpdatingCurrentTime):
(WebInspector.TimelineContentView.prototype._recordingStarted):
(WebInspector.TimelineContentView.prototype._recordingStopped):
(WebInspector.TimelineContentView.prototype._recordingReset):
(WebInspector.TimelineContentView.prototype._timeRangeSelectionChanged):
* UserInterface/TimelineOverview.js:
(WebInspector.TimelineOverview):
(WebInspector.TimelineOverview.prototype.updateLayout):
(WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
(WebInspector.TimelineOverview.prototype._updateElementWidth):
(WebInspector.TimelineOverview.prototype._handleWheelEvent):
(WebInspector.TimelineOverview.prototype._timeRangeSelectionChanged):
* UserInterface/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.updateLayoutIfNeeded):
* UserInterface/TimelineView.js:
(WebInspector.TimelineView):
(WebInspector.TimelineView.prototype.get zeroTime):
(WebInspector.TimelineView.prototype.set zeroTime):
(WebInspector.TimelineView.prototype.get startTime):
(WebInspector.TimelineView.prototype.set startTime):
(WebInspector.TimelineView.prototype.get endTime):
(WebInspector.TimelineView.prototype.set endTime):
(WebInspector.TimelineView.prototype.get currentTime):
(WebInspector.TimelineView.prototype.set currentTime.checkIfLayoutIsNeeded):
(WebInspector.TimelineView.prototype.set currentTime):
(WebInspector.TimelineView.prototype.updateLayout):
(WebInspector.TimelineView.prototype.updateLayoutIfNeeded):
(WebInspector.TimelineView.prototype.needsLayout):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewjs">trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineContentViewjs">trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineOverviewjs">trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRulerjs">trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineViewjs">trunk/Source/WebInspectorUI/UserInterface/TimelineView.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (162410 => 162411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:55:14 UTC (rev 162410)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:55:21 UTC (rev 162411)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-01-08 Timothy Hatcher <timothy@apple.com>
+
+ Update the current WebInspector.TimelineView when time range changes.
+
+ https://bugs.webkit.org/show_bug.cgi?id=126667
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/TimelineContentView.js:
+ (WebInspector.TimelineContentView.prototype._showTimelineView):
+ (WebInspector.TimelineContentView.prototype._update):
+ (WebInspector.TimelineContentView.prototype._startUpdatingCurrentTime):
+ (WebInspector.TimelineContentView.prototype._stopUpdatingCurrentTime):
+ (WebInspector.TimelineContentView.prototype._recordingStarted):
+ (WebInspector.TimelineContentView.prototype._recordingStopped):
+ (WebInspector.TimelineContentView.prototype._recordingReset):
+ (WebInspector.TimelineContentView.prototype._timeRangeSelectionChanged):
+ * UserInterface/TimelineOverview.js:
+ (WebInspector.TimelineOverview):
+ (WebInspector.TimelineOverview.prototype.updateLayout):
+ (WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
+ (WebInspector.TimelineOverview.prototype._updateElementWidth):
+ (WebInspector.TimelineOverview.prototype._handleWheelEvent):
+ (WebInspector.TimelineOverview.prototype._timeRangeSelectionChanged):
+ * UserInterface/TimelineRuler.js:
+ (WebInspector.TimelineRuler.prototype.updateLayoutIfNeeded):
+ * UserInterface/TimelineView.js:
+ (WebInspector.TimelineView):
+ (WebInspector.TimelineView.prototype.get zeroTime):
+ (WebInspector.TimelineView.prototype.set zeroTime):
+ (WebInspector.TimelineView.prototype.get startTime):
+ (WebInspector.TimelineView.prototype.set startTime):
+ (WebInspector.TimelineView.prototype.get endTime):
+ (WebInspector.TimelineView.prototype.set endTime):
+ (WebInspector.TimelineView.prototype.get currentTime):
+ (WebInspector.TimelineView.prototype.set currentTime.checkIfLayoutIsNeeded):
+ (WebInspector.TimelineView.prototype.set currentTime):
+ (WebInspector.TimelineView.prototype.updateLayout):
+ (WebInspector.TimelineView.prototype.updateLayoutIfNeeded):
+ (WebInspector.TimelineView.prototype.needsLayout):
+
</ins><span class="cx"> 2013-12-19 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><span class="cx"> Implement time range selection for TimelineOverview and TimelineRuler.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js (162410 => 162411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js        2014-01-21 02:55:14 UTC (rev 162410)
+++ trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js        2014-01-21 02:55:21 UTC (rev 162411)
</span><span class="lines">@@ -35,8 +35,12 @@
</span><span class="cx"> this._treeOutlineDataGridSynchronizer = new WebInspector.TreeOutlineDataGridSynchronizer(this._contentTreeOutline, this._dataGrid);
</span><span class="cx">
</span><span class="cx"> this._timelineRuler = new WebInspector.TimelineRuler;
</span><ins>+ this._timelineRuler.allowsClippedLabels = true;
</ins><span class="cx"> this.element.appendChild(this._timelineRuler.element);
</span><span class="cx">
</span><ins>+ this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
+ this._timelineRuler.addMarker(this._currentTimeMarker);
+
</ins><span class="cx"> this.element.classList.add(WebInspector.OverviewTimelineView.StyleClassName);
</span><span class="cx"> this.element.appendChild(this._dataGrid.element);
</span><span class="cx">
</span><span class="lines">@@ -73,6 +77,13 @@
</span><span class="cx">
</span><span class="cx"> updateLayout: function()
</span><span class="cx"> {
</span><ins>+ WebInspector.TimelineView.prototype.updateLayout.call(this);
+
+ this._timelineRuler.zeroTime = this.zeroTime;
+ this._timelineRuler.startTime = this.startTime;
+ this._timelineRuler.endTime = this.endTime;
+ this._currentTimeMarker.time = this.currentTime;
+
</ins><span class="cx"> this._timelineRuler.updateLayout();
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js (162410 => 162411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js        2014-01-21 02:55:14 UTC (rev 162410)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js        2014-01-21 02:55:21 UTC (rev 162411)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> this.element.classList.add(WebInspector.TimelineContentView.StyleClassName);
</span><span class="cx">
</span><span class="cx"> this._timelineOverview = new WebInspector.TimelineOverview;
</span><ins>+ this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
</ins><span class="cx"> this.element.appendChild(this._timelineOverview.element);
</span><span class="cx">
</span><span class="cx"> this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
</span><span class="lines">@@ -175,7 +176,14 @@
</span><span class="cx">
</span><span class="cx"> if (this._currentTimelineView) {
</span><span class="cx"> this._viewContainer.appendChild(this._currentTimelineView.element);
</span><ins>+
+ this._currentTimelineView.zeroTime = this._timelineOverview.startTime;
+ this._currentTimelineView.startTime = this._timelineOverview.selectionStartTime;
+ this._currentTimelineView.endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
+ this._currentTimelineView.currentTime = this._currentTimeMarker.time;
+
</ins><span class="cx"> this._currentTimelineView.shown();
</span><ins>+ this._currentTimelineView.updateLayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
</span><span class="lines">@@ -190,8 +198,6 @@
</span><span class="cx">
</span><span class="cx"> currentTime += timespanSinceLastUpdate;
</span><span class="cx">
</span><del>- this._currentTimeMarker.time = currentTime;
-
</del><span class="cx"> if (this._startTimeNeedsReset && !isNaN(startTime)) {
</span><span class="cx"> var selectionOffset = this._timelineOverview.selectionStartTime - this._timelineOverview.startTime;
</span><span class="cx"> this._timelineOverview.startTime = startTime;
</span><span class="lines">@@ -201,8 +207,12 @@
</span><span class="cx">
</span><span class="cx"> this._timelineOverview.endTime = Math.max(endTime, currentTime);
</span><span class="cx">
</span><ins>+ this._currentTimeMarker.time = currentTime;
+ this._currentTimelineView.currentTime = currentTime;
+
</ins><span class="cx"> // Force a layout now since we are already in an animation frame and don't need to delay it until the next.
</span><del>- this._timelineOverview.updateLayout();
</del><ins>+ this._timelineOverview.updateLayoutIfNeeded();
+ this._currentTimelineView.updateLayoutIfNeeded();
</ins><span class="cx">
</span><span class="cx"> this._timelineOverview.revealMarker(this._currentTimeMarker);
</span><span class="cx">
</span><span class="lines">@@ -217,7 +227,7 @@
</span><span class="cx"> requestAnimationFrame(this._updateCallback);
</span><span class="cx"> },
</span><span class="cx">
</span><del>- _recordingStarted: function(event)
</del><ins>+ _startUpdatingCurrentTime: function()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(!this._updating);
</span><span class="cx"> if (this._updating)
</span><span class="lines">@@ -231,12 +241,22 @@
</span><span class="cx"> requestAnimationFrame(this._updateCallback);
</span><span class="cx"> },
</span><span class="cx">
</span><del>- _recordingStopped: function(event)
</del><ins>+ _stopUpdatingCurrentTime: function()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._updating);
</span><span class="cx"> this._updating = false;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _recordingStarted: function(event)
+ {
+ this._startUpdatingCurrentTime();
+ },
+
+ _recordingStopped: function(event)
+ {
+ this._stopUpdatingCurrentTime();
+ },
+
</ins><span class="cx"> _recordingReset: function(event)
</span><span class="cx"> {
</span><span class="cx"> this._startTimeNeedsReset = true;
</span><span class="lines">@@ -246,5 +266,12 @@
</span><span class="cx">
</span><span class="cx"> for (var identifier in this._discreteTimelineViewMap)
</span><span class="cx"> this._discreteTimelineViewMap[identifier].reset();
</span><ins>+ },
+
+ _timeRangeSelectionChanged: function(event)
+ {
+ this._currentTimelineView.zeroTime = this._timelineOverview.startTime;
+ this._currentTimelineView.startTime = this._timelineOverview.selectionStartTime;
+ this._currentTimelineView.endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
</ins><span class="cx"> }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineOverviewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js (162410 => 162411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js        2014-01-21 02:55:14 UTC (rev 162410)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js        2014-01-21 02:55:21 UTC (rev 162411)
</span><span class="lines">@@ -39,13 +39,14 @@
</span><span class="cx"> this._timelineRuler = new WebInspector.TimelineRuler;
</span><span class="cx"> this._timelineRuler.allowsClippedLabels = true;
</span><span class="cx"> this._timelineRuler.allowsTimeRangeSelection = true;
</span><ins>+ this._timelineRuler.addEventListener(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged, this._timeRangeSelectionChanged, this);
</ins><span class="cx"> this._scrollContainer.appendChild(this._timelineRuler.element);
</span><span class="cx">
</span><span class="cx"> this._endTime = 0;
</span><span class="cx">
</span><span class="cx"> this.startTime = 0;
</span><span class="cx"> this.secondsPerPixel = 0.0025;
</span><del>- this.selectionDuration = 5;
</del><ins>+ this.selectionDuration = 3;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.TimelineOverview.StyleClassName = "timeline-overview";
</span><span class="lines">@@ -53,6 +54,10 @@
</span><span class="cx"> WebInspector.TimelineOverview.MinimumSecondsPerPixel = 0.001;
</span><span class="cx"> WebInspector.TimelineOverview.ScrollDeltaDenominator = 500;
</span><span class="cx">
</span><ins>+WebInspector.TimelineOverview.Event = {
+ TimeRangeSelectionChanged: "timeline-overview-time-range-selection-changed"
+};
+
</ins><span class="cx"> WebInspector.TimelineOverview.prototype = {
</span><span class="cx"> constructor: WebInspector.TimelineOverview,
</span><span class="cx"> __proto__: WebInspector.Object.prototype,
</span><span class="lines">@@ -166,11 +171,20 @@
</span><span class="cx"> this._timelineRuler.updateLayout();
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ updateLayoutIfNeeded: function()
+ {
+ this._timelineRuler.updateLayoutIfNeeded();
+
+ if (!this._scheduledLayoutUpdateIdentifier)
+ return;
+ this.updateLayout();
+ },
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _updateElementWidth: function(element, newWidth)
</span><span class="cx"> {
</span><del>- var currentWidth = parseFloat(element.style.width).toFixed(0);
</del><ins>+ var currentWidth = parseInt(element.style.width);
</ins><span class="cx"> if (currentWidth !== newWidth)
</span><span class="cx"> element.style.width = newWidth + "px";
</span><span class="cx"> },
</span><span class="lines">@@ -198,12 +212,17 @@
</span><span class="cx"> this.secondsPerPixel += event.deltaY * (this._secondsPerPixel / WebInspector.TimelineOverview.ScrollDeltaDenominator) * deviceDirection;
</span><span class="cx">
</span><span class="cx"> // Force layout so we can update the scroll position synchronously.
</span><del>- this.updateLayout();
</del><ins>+ this.updateLayoutIfNeeded();
</ins><span class="cx">
</span><span class="cx"> // Center the zoom around the mouse based on the remembered mouse position time.
</span><span class="cx"> this._scrollContainer.scrollLeft = Math.max(0, Math.round((mousePositionTime / this.secondsPerPixel) - mouseOffset));
</span><span class="cx">
</span><span class="cx"> event.preventDefault();
</span><span class="cx"> event.stopPropagation();
</span><ins>+ },
+
+ _timeRangeSelectionChanged: function(event)
+ {
+ this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged);
</ins><span class="cx"> }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRulerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js (162410 => 162411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js        2014-01-21 02:55:14 UTC (rev 162410)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js        2014-01-21 02:55:21 UTC (rev 162411)
</span><span class="lines">@@ -410,6 +410,26 @@
</span><span class="cx"> this._updateSelection(visibleWidth, duration);
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ updateLayoutIfNeeded: function()
+ {
+ // If there is a main layout scheduled we can just update layout and return, since that
+ // will update markers and the selection at the same time.
+ if (this._scheduledLayoutUpdateIdentifier) {
+ this.updateLayout();
+ return;
+ }
+
+ var visibleWidth = this._element.clientWidth;
+ if (visibleWidth <= 0)
+ return;
+
+ if (this._scheduledMarkerLayoutUpdateIdentifier)
+ this._updateMarkers(visibleWidth, this.duration);
+
+ if (this._scheduledSelectionLayoutUpdateIdentifier)
+ this._updateSelection(visibleWidth, this.duration);
+ },
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _needsLayout: function()
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineView.js (162410 => 162411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineView.js        2014-01-21 02:55:14 UTC (rev 162410)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineView.js        2014-01-21 02:55:21 UTC (rev 162411)
</span><span class="lines">@@ -31,6 +31,11 @@
</span><span class="cx">
</span><span class="cx"> this.element = document.createElement("div");
</span><span class="cx"> this.element.classList.add(WebInspector.TimelineView.StyleClassName);
</span><ins>+
+ this._zeroTime = 0;
+ this._startTime = 0;
+ this._endTime = 5;
+ this._currentTime = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.TimelineView.StyleClassName = "timeline-view";
</span><span class="lines">@@ -52,6 +57,81 @@
</span><span class="cx"> return null;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ get zeroTime()
+ {
+ return this._zeroTime;
+ },
+
+ set zeroTime(x)
+ {
+ if (this._zeroTime === x)
+ return;
+
+ this._zeroTime = x || 0;
+
+ this.needsLayout();
+ },
+
+ get startTime()
+ {
+ return this._startTime;
+ },
+
+ set startTime(x)
+ {
+ if (this._startTime === x)
+ return;
+
+ this._startTime = x || 0;
+
+ this.needsLayout();
+ },
+
+ get endTime()
+ {
+ return this._endTime;
+ },
+
+ set endTime(x)
+ {
+ if (this._endTime === x)
+ return;
+
+ this._endTime = x || 0;
+
+ this.needsLayout();
+ },
+
+ get currentTime()
+ {
+ return this._currentTime;
+ },
+
+ set currentTime(x)
+ {
+ if (this._currentTime === x)
+ return;
+
+ var oldCurrentTime = this._currentTime;
+
+ this._currentTime = x || 0;
+
+ function checkIfLayoutIsNeeded(currentTime)
+ {
+ // Include some wiggle room since the current time markers can be clipped off the ends a bit and still partially visible.
+ const wiggleTime = 0.05; // 50ms
+ return this._startTime - wiggleTime <= currentTime && currentTime <= this._endTime + wiggleTime;
+ }
+
+ if (checkIfLayoutIsNeeded.call(this, oldCurrentTime) || checkIfLayoutIsNeeded.call(this, this._currentTime))
+ this.needsLayout();
+ },
+
+ get visible()
+ {
+ return this._visible;
+ },
+
</ins><span class="cx"> reset: function()
</span><span class="cx"> {
</span><span class="cx"> this._contentTreeOutline.removeChildren();
</span><span class="lines">@@ -59,16 +139,45 @@
</span><span class="cx">
</span><span class="cx"> shown: function()
</span><span class="cx"> {
</span><ins>+ this._visible = true;
+
</ins><span class="cx"> // Implemented by sub-classes if needed.
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> hidden: function()
</span><span class="cx"> {
</span><span class="cx"> // Implemented by sub-classes if needed.
</span><ins>+
+ this._visible = false;
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> updateLayout: function()
</span><span class="cx"> {
</span><ins>+ if (this._scheduledLayoutUpdateIdentifier) {
+ cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
+ delete this._scheduledLayoutUpdateIdentifier;
+ }
+
</ins><span class="cx"> // Implemented by sub-classes if needed.
</span><ins>+ },
+
+ updateLayoutIfNeeded: function()
+ {
+ if (!this._scheduledLayoutUpdateIdentifier)
+ return;
+ this.updateLayout();
+ },
+
+ // Protected
+
+ needsLayout: function()
+ {
+ if (!this._visible)
+ return;
+
+ if (this._scheduledLayoutUpdateIdentifier)
+ return;
+
+ this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
</ins><span class="cx"> }
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>