<!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>[162408] 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/162408">162408</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2014-01-20 18:55:03 -0800 (Mon, 20 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add the start of the TimelineOverview class.
TimelineOverview currently has a time ruler and tracks the current recording time.
https://bugs.webkit.org/show_bug.cgi?id=125878
Reviewed by Joseph Pecoraro.
* UserInterface/Main.html:
* UserInterface/TimelineContentView.css:
(.content-view.timeline > .timeline-overview):
* UserInterface/TimelineContentView.js:
(WebInspector.TimelineContentView):
(WebInspector.TimelineContentView.prototype.updateLayout):
(WebInspector.TimelineContentView.prototype._update):
(WebInspector.TimelineContentView.prototype._recordingStarted):
(WebInspector.TimelineContentView.prototype._recordingStopped):
(WebInspector.TimelineContentView.prototype._recordingReset):
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
(WebInspector.TimelineManager.prototype.eventRecorded):
* UserInterface/TimelineMarker.js: Renamed from Source/WebInspectorUI/UserInterface/TimelineEventMarker.js.
(WebInspector.TimelineMarker):
(WebInspector.TimelineMarker.prototype.get time):
(WebInspector.TimelineMarker.prototype.set time):
(WebInspector.TimelineMarker.prototype.get type):
* UserInterface/TimelineOverview.css: Added.
(.timeline-overview > .scroll-container):
(.timeline-overview > .scroll-container > .timeline-ruler):
* UserInterface/TimelineOverview.js: Added.
(WebInspector.TimelineOverview):
(WebInspector.TimelineOverview.prototype.get element):
(WebInspector.TimelineOverview.prototype.get startTime):
(WebInspector.TimelineOverview.prototype.set startTime):
(WebInspector.TimelineOverview.prototype.get secondsPerPixel):
(WebInspector.TimelineOverview.prototype.set secondsPerPixel):
(WebInspector.TimelineOverview.prototype.get endTime):
(WebInspector.TimelineOverview.prototype.set endTime):
(WebInspector.TimelineOverview.prototype.addMarker):
(WebInspector.TimelineOverview.prototype.revealMarker):
(WebInspector.TimelineOverview.prototype.updateLayout):
(WebInspector.TimelineOverview.prototype._updateElementWidth):
(WebInspector.TimelineOverview.prototype._needsLayout):
* UserInterface/TimelineRecording.js:
(WebInspector.TimelineRecording.prototype.get startTime):
(WebInspector.TimelineRecording.prototype.get endTime):
(WebInspector.TimelineRecording.prototype.reset):
* UserInterface/TimelineRuler.css:
(.timeline-ruler > .markers):
(.timeline-ruler > .markers > .marker):
(.timeline-ruler > .markers > .marker.current-time):
(.timeline-ruler > .markers > .marker.current-time::before):
(.timeline-ruler > .markers > .marker.load-event):
(.timeline-ruler > .markers > .marker.dom-content-event):
(.timeline-ruler > .markers > .marker.timestamp):
* UserInterface/TimelineRuler.js:
(WebInspector.TimelineRuler):
(WebInspector.TimelineRuler.prototype.updateLayout):
(WebInspector.TimelineRuler.prototype._needsLayout):
(WebInspector.TimelineRuler.prototype._needsMarkerLayout.update):
(WebInspector.TimelineRuler.prototype._needsMarkerLayout):
(WebInspector.TimelineRuler.prototype._recalculate):
(WebInspector.TimelineRuler.prototype._updateLeftPositionOfElement):
(WebInspector.TimelineRuler.prototype._updateMarkers):
(WebInspector.TimelineRuler.prototype._timelineMarkerTimeChanged):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineContentViewcss">trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineContentViewjs">trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineManagerjs">trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRecordingjs">trunk/Source/WebInspectorUI/UserInterface/TimelineRecording.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRulercss">trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRulerjs">trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineMarkerjs">trunk/Source/WebInspectorUI/UserInterface/TimelineMarker.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineOverviewcss">trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineOverviewjs">trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineEventMarkerjs">trunk/Source/WebInspectorUI/UserInterface/TimelineEventMarker.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -1,3 +1,71 @@
</span><ins>+2013-12-17 Timothy Hatcher <timothy@apple.com>
+
+ Add the start of the TimelineOverview class.
+
+ TimelineOverview currently has a time ruler and tracks the current recording time.
+
+ https://bugs.webkit.org/show_bug.cgi?id=125878
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Main.html:
+ * UserInterface/TimelineContentView.css:
+ (.content-view.timeline > .timeline-overview):
+ * UserInterface/TimelineContentView.js:
+ (WebInspector.TimelineContentView):
+ (WebInspector.TimelineContentView.prototype.updateLayout):
+ (WebInspector.TimelineContentView.prototype._update):
+ (WebInspector.TimelineContentView.prototype._recordingStarted):
+ (WebInspector.TimelineContentView.prototype._recordingStopped):
+ (WebInspector.TimelineContentView.prototype._recordingReset):
+ * UserInterface/TimelineManager.js:
+ (WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
+ (WebInspector.TimelineManager.prototype.eventRecorded):
+ * UserInterface/TimelineMarker.js: Renamed from Source/WebInspectorUI/UserInterface/TimelineEventMarker.js.
+ (WebInspector.TimelineMarker):
+ (WebInspector.TimelineMarker.prototype.get time):
+ (WebInspector.TimelineMarker.prototype.set time):
+ (WebInspector.TimelineMarker.prototype.get type):
+ * UserInterface/TimelineOverview.css: Added.
+ (.timeline-overview > .scroll-container):
+ (.timeline-overview > .scroll-container > .timeline-ruler):
+ * UserInterface/TimelineOverview.js: Added.
+ (WebInspector.TimelineOverview):
+ (WebInspector.TimelineOverview.prototype.get element):
+ (WebInspector.TimelineOverview.prototype.get startTime):
+ (WebInspector.TimelineOverview.prototype.set startTime):
+ (WebInspector.TimelineOverview.prototype.get secondsPerPixel):
+ (WebInspector.TimelineOverview.prototype.set secondsPerPixel):
+ (WebInspector.TimelineOverview.prototype.get endTime):
+ (WebInspector.TimelineOverview.prototype.set endTime):
+ (WebInspector.TimelineOverview.prototype.addMarker):
+ (WebInspector.TimelineOverview.prototype.revealMarker):
+ (WebInspector.TimelineOverview.prototype.updateLayout):
+ (WebInspector.TimelineOverview.prototype._updateElementWidth):
+ (WebInspector.TimelineOverview.prototype._needsLayout):
+ * UserInterface/TimelineRecording.js:
+ (WebInspector.TimelineRecording.prototype.get startTime):
+ (WebInspector.TimelineRecording.prototype.get endTime):
+ (WebInspector.TimelineRecording.prototype.reset):
+ * UserInterface/TimelineRuler.css:
+ (.timeline-ruler > .markers):
+ (.timeline-ruler > .markers > .marker):
+ (.timeline-ruler > .markers > .marker.current-time):
+ (.timeline-ruler > .markers > .marker.current-time::before):
+ (.timeline-ruler > .markers > .marker.load-event):
+ (.timeline-ruler > .markers > .marker.dom-content-event):
+ (.timeline-ruler > .markers > .marker.timestamp):
+ * UserInterface/TimelineRuler.js:
+ (WebInspector.TimelineRuler):
+ (WebInspector.TimelineRuler.prototype.updateLayout):
+ (WebInspector.TimelineRuler.prototype._needsLayout):
+ (WebInspector.TimelineRuler.prototype._needsMarkerLayout.update):
+ (WebInspector.TimelineRuler.prototype._needsMarkerLayout):
+ (WebInspector.TimelineRuler.prototype._recalculate):
+ (WebInspector.TimelineRuler.prototype._updateLeftPositionOfElement):
+ (WebInspector.TimelineRuler.prototype._updateMarkers):
+ (WebInspector.TimelineRuler.prototype._timelineMarkerTimeChanged):
+
</ins><span class="cx"> 2013-12-13 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><span class="cx"> Clean up and refactor TimelineDecorations into TimelineRuler.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -194,6 +194,7 @@
</span><span class="cx"> <script src="SourceCodeTimeline.js"></script>
</span><span class="cx"> <script src="TimelineRecord.js"></script>
</span><span class="cx"> <script src="TimelineEventMarker.js"></script>
</span><ins>+ <script src="TimelineMarker.js"></script>
</ins><span class="cx"> <script src="ResourceTimelineRecord.js"></script>
</span><span class="cx"> <script src="FrameResourceManager.js"></script>
</span><span class="cx"> <script src="IssueManager.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineContentViewcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.css (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.css        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.css        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -23,6 +23,14 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+.content-view.timeline > .timeline-overview {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 130px;
+}
+
</ins><span class="cx"> .content-view.timeline > .view-container {
</span><span class="cx"> position: absolute;
</span><span class="cx"> top: 130px;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -29,6 +29,12 @@
</span><span class="cx">
</span><span class="cx"> this.element.classList.add(WebInspector.TimelineContentView.StyleClassName);
</span><span class="cx">
</span><ins>+ this._timelineOverview = new WebInspector.TimelineOverview;
+ this.element.appendChild(this._timelineOverview.element);
+
+ this._currentTimeMarker = new WebInspector.TimelineMarker(0, WebInspector.TimelineMarker.Type.CurrentTime);
+ this._timelineOverview.addMarker(this._currentTimeMarker);
+
</ins><span class="cx"> this._viewContainer = document.createElement("div");
</span><span class="cx"> this._viewContainer.classList.add(WebInspector.TimelineContentView.ViewContainerStyleClassName);
</span><span class="cx"> this.element.appendChild(this._viewContainer);
</span><span class="lines">@@ -65,7 +71,12 @@
</span><span class="cx"> this._currentTimelineView = null;
</span><span class="cx"> this._currentTimelineViewIdentifier = null;
</span><span class="cx">
</span><ins>+ this._updating = false;
+ this._lastUpdateTimestamp = NaN;
+
</ins><span class="cx"> WebInspector.timelineManager.recording.addEventListener(WebInspector.TimelineRecording.Event.Reset, this._recordingReset, this);
</span><ins>+ WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingStarted, this._recordingStarted, this);
+ WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingStopped, this._recordingStopped, this);
</ins><span class="cx">
</span><span class="cx"> this.showOverviewTimelineView();
</span><span class="cx"> };
</span><span class="lines">@@ -129,6 +140,8 @@
</span><span class="cx">
</span><span class="cx"> updateLayout: function()
</span><span class="cx"> {
</span><ins>+ this._timelineOverview.updateLayout();
+
</ins><span class="cx"> if (!this._currentTimelineView)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -168,8 +181,60 @@
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _update: function(timestamp)
+ {
+ var startTime = WebInspector.timelineManager.recording.startTime;
+ var currentTime = this._currentTimeMarker.time || startTime;
+ var endTime = WebInspector.timelineManager.recording.endTime;
+ var timespanSinceLastUpdate = (timestamp - this._lastUpdateTimestamp) / 1000 || 0;
+
+ currentTime += timespanSinceLastUpdate;
+
+ this._currentTimeMarker.time = currentTime;
+
+ this._timelineOverview.startTime = startTime;
+ this._timelineOverview.endTime = Math.max(endTime, currentTime);
+
+ // Force a layout now since we are already in an animation frame and don't need to delay it until the next.
+ this._timelineOverview.updateLayout();
+
+ this._timelineOverview.revealMarker(this._currentTimeMarker);
+
+ // Only stop updating if the current time is greater than the end time.
+ if (!this._updating && currentTime >= endTime) {
+ this._lastUpdateTimestamp = NaN;
+ return;
+ }
+
+ this._lastUpdateTimestamp = timestamp;
+
+ requestAnimationFrame(this._updateCallback);
+ },
+
+ _recordingStarted: function(event)
+ {
+ console.assert(!this._updating);
+ if (this._updating)
+ return;
+
+ this._updating = true;
+
+ if (!this._updateCallback)
+ this._updateCallback = this._update.bind(this);
+
+ requestAnimationFrame(this._updateCallback);
+ },
+
+ _recordingStopped: function(event)
+ {
+ console.assert(this._updating);
+ this._updating = false;
+ },
+
</ins><span class="cx"> _recordingReset: function(event)
</span><span class="cx"> {
</span><ins>+ this._currentTimeMarker.time = 0;
+
</ins><span class="cx"> this._overviewTimelineView.reset();
</span><span class="cx">
</span><span class="cx"> for (var identifier in this._discreteTimelineViewMap)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineEventMarkerjs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebInspectorUI/UserInterface/TimelineEventMarker.js (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineEventMarker.js        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineEventMarker.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -1,59 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.TimelineEventMarker = function(timestamp, type)
-{
- WebInspector.Object.call(this);
-
- console.assert(timestamp);
- console.assert(type);
-
- this._timestamp = timestamp;
- this._type = type;
-};
-
-WebInspector.TimelineEventMarker.Type = {
- LoadEvent: "load-event",
- DOMContentEvent: "dom-content-event",
- TimeStamp: "timestamp"
-};
-
-WebInspector.TimelineEventMarker.prototype = {
- constructor: WebInspector.TimelineEventMarker,
-
- // Public
-
- get timestamp()
- {
- return this._timestamp;
- },
-
- get type()
- {
- return this._type;
- }
-};
-
-WebInspector.TimelineEventMarker.prototype.__proto__ = WebInspector.Object.prototype;
</del></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx"> if (!frame.isMainFrame())
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- var eventMarker = new WebInspector.TimelineEventMarker(startTime, WebInspector.TimelineEventMarker.Type.LoadEvent);
</del><ins>+ var eventMarker = new WebInspector.TimelineMarker(startTime, WebInspector.TimelineMarker.Type.LoadEvent);
</ins><span class="cx"> this._recording.addEventMarker(eventMarker);
</span><span class="cx">
</span><span class="cx"> this._stopAutoRecordingSoon();
</span><span class="lines">@@ -154,7 +154,7 @@
</span><span class="cx"> if (!frame.isMainFrame())
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- var eventMarker = new WebInspector.TimelineEventMarker(startTime, WebInspector.TimelineEventMarker.Type.DOMContentEvent);
</del><ins>+ var eventMarker = new WebInspector.TimelineMarker(startTime, WebInspector.TimelineMarker.Type.DOMContentEvent);
</ins><span class="cx"> this._recording.addEventMarker(eventMarker);
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -219,7 +219,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.TimeStamp:
</span><del>- var eventMarker = new WebInspector.TimelineEventMarker(startTime, WebInspector.TimelineEventMarker.Type.TimeStamp);
</del><ins>+ var eventMarker = new WebInspector.TimelineMarker(startTime, WebInspector.TimelineMarker.Type.TimeStamp);
</ins><span class="cx"> this._recording.addEventMarker(eventMarker);
</span><span class="cx"> break;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineMarkerjsfromrev162407trunkSourceWebInspectorUIUserInterfaceTimelineEventMarkerjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/TimelineMarker.js (from rev 162407, trunk/Source/WebInspectorUI/UserInterface/TimelineEventMarker.js) (0 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineMarker.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineMarker.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.TimelineMarker = function(time, type)
+{
+ WebInspector.Object.call(this);
+
+ console.assert(type);
+
+ this._time = time || 0;
+ this._type = type;
+};
+
+WebInspector.TimelineMarker.Event = {
+ TimeChanged: "timeline-marker-time-changed"
+};
+
+WebInspector.TimelineMarker.Type = {
+ CurrentTime: "current-time",
+ LoadEvent: "load-event",
+ DOMContentEvent: "dom-content-event",
+ TimeStamp: "timestamp"
+};
+
+WebInspector.TimelineMarker.prototype = {
+ constructor: WebInspector.TimelineMarker,
+ __proto__: WebInspector.Object.prototype,
+
+ // Public
+
+ get time()
+ {
+ return this._time;
+ },
+
+ set time(x)
+ {
+ if (this._time === x)
+ return;
+
+ this._time = x || 0;
+
+ this.dispatchEventToListeners(WebInspector.TimelineMarker.Event.TimeChanged);
+ },
+
+ get type()
+ {
+ return this._type;
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineOverviewcssfromrev162407trunkSourceWebInspectorUIUserInterfaceTimelineContentViewcss"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.css (from rev 162407, trunk/Source/WebInspectorUI/UserInterface/TimelineContentView.css) (0 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.css         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.css        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.timeline-overview > .scroll-container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ overflow-x: auto;
+ overflow-y: hidden;
+}
+
+.timeline-overview > .scroll-container > .timeline-ruler {
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ min-width: 100%;
+ overflow: hidden;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineOverviewjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js (0 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineOverview.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -0,0 +1,153 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.TimelineOverview = function()
+{
+ WebInspector.Object.call(this);
+
+ this._element = document.createElement("div");
+ this._element.className = WebInspector.TimelineOverview.StyleClassName;
+
+ this._scrollContainer = document.createElement("div");
+ this._scrollContainer.className = WebInspector.TimelineOverview.ScrollContainerStyleClassName;
+ this._element.appendChild(this._scrollContainer);
+
+ this._timelineRuler = new WebInspector.TimelineRuler;
+ this._timelineRuler.allowsClippedLabels = true;
+ this._scrollContainer.appendChild(this._timelineRuler.element);
+
+ this._endTime = 0;
+
+ this.startTime = 0;
+ this.secondsPerPixel = 0.0025;
+};
+
+WebInspector.TimelineOverview.StyleClassName = "timeline-overview";
+WebInspector.TimelineOverview.ScrollContainerStyleClassName = "scroll-container";
+
+WebInspector.TimelineOverview.prototype = {
+ constructor: WebInspector.TimelineOverview,
+ __proto__: WebInspector.Object.prototype,
+
+ // Public
+
+ get element()
+ {
+ return this._element;
+ },
+
+ get startTime()
+ {
+ return this._timelineRuler.startTime;
+ },
+
+ set startTime(x)
+ {
+ if (this._timelineRuler.startTime === x)
+ return;
+
+ this._timelineRuler.zeroTime = x;
+ this._timelineRuler.startTime = x;
+
+ this._needsLayout();
+ },
+
+ get secondsPerPixel()
+ {
+ return this._timelineRuler.secondsPerPixel;
+ },
+
+ set secondsPerPixel(x)
+ {
+ if (this._timelineRuler.secondsPerPixel === x)
+ return;
+
+ this._timelineRuler.secondsPerPixel = x;
+
+ this._needsLayout();
+ },
+
+ get endTime()
+ {
+ return this._endTime;
+ },
+
+ set endTime(x)
+ {
+ if (this._endTime === x)
+ return;
+
+ this._endTime = x || 0;
+
+ this._needsLayout();
+ },
+
+ addMarker: function(marker)
+ {
+ this._timelineRuler.addMarker(marker);
+ },
+
+ revealMarker: function(marker)
+ {
+ var markerElement = this._timelineRuler.elementForMarker(marker);
+ if (!markerElement)
+ return;
+ markerElement.scrollIntoViewIfNeeded(true);
+ },
+
+ updateLayout: function()
+ {
+ if (this._scheduledLayoutUpdateIdentifier) {
+ cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);
+ delete this._scheduledLayoutUpdateIdentifier;
+ }
+
+ // Calculate the required width based on the duration and seconds per pixel.
+ var duration = this.endTime - this.startTime;
+ var newWidth = Math.ceil(duration / this.secondsPerPixel);
+
+ // Update all relevant elements to the new required width.
+ this._updateElementWidth(this._timelineRuler.element, newWidth);
+
+ // Update the time ruler layout now that its width has changed.
+ this._timelineRuler.updateLayout();
+ },
+
+ // Private
+
+ _updateElementWidth: function(element, newWidth)
+ {
+ var currentWidth = parseFloat(element.style.width).toFixed(0);
+ if (currentWidth !== newWidth)
+ element.style.width = newWidth + "px";
+ },
+
+ _needsLayout: function()
+ {
+ if (this._scheduledLayoutUpdateIdentifier)
+ return;
+ this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRecordingjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineRecording.js (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRecording.js        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRecording.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -47,6 +47,16 @@
</span><span class="cx"> return this._timelines;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ get startTime()
+ {
+ return this._startTime;
+ },
+
+ get endTime()
+ {
+ return this._endTime;
+ },
+
</ins><span class="cx"> reset: function(newObject)
</span><span class="cx"> {
</span><span class="cx"> if (this._timelines) {
</span><span class="lines">@@ -66,6 +76,8 @@
</span><span class="cx">
</span><span class="cx"> this._sourceCodeTimelinesMap = new Map;
</span><span class="cx"> this._eventMarkers = [];
</span><ins>+ this._startTime = NaN;
+ this._endTime = NaN;
</ins><span class="cx">
</span><span class="cx"> if (!newObject)
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Reset);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRulercss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.css (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.css        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.css        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -55,44 +55,63 @@
</span><span class="cx"> white-space: nowrap;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.timeline-ruler > .event-markers {
</del><ins>+.timeline-ruler > .markers {
</ins><span class="cx"> position: absolute;
</span><span class="cx"> top: 22px;
</span><span class="cx"> left: 0;
</span><span class="cx"> right: 0;
</span><span class="cx"> bottom: 0;
</span><ins>+ z-index: 1;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.timeline-ruler > .event-markers > .event-marker-tooltip {
</del><ins>+.timeline-ruler > .markers > .divider {
</ins><span class="cx"> position: absolute;
</span><del>- top: 0;
</del><ins>+ width: 1px;
+ top: 1px;
</ins><span class="cx"> bottom: 0;
</span><del>-
- width: 9px;
-
- pointer-events: auto;
</del><ins>+ -webkit-transform: translateX(-1px);
+ background-color: rgba(0, 0, 0, 0.05);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.timeline-ruler > .event-markers > .event-marker {
</del><ins>+.timeline-ruler > .markers > .marker {
</ins><span class="cx"> position: absolute;
</span><span class="cx"> top: 0;
</span><span class="cx"> bottom: 0;
</span><span class="cx">
</span><del>- margin-left: 4px;
</del><ins>+ -webkit-transform: translateX(-1px);
</ins><span class="cx">
</span><span class="cx"> border-left-width: 1px;
</span><span class="cx"> border-left-style: dashed;
</span><span class="cx"> border-left-color: rgba(128, 128, 128, 0.5);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.timeline-ruler > .event-markers > .event-marker.load-event {
</del><ins>+.timeline-ruler > .markers > .marker.current-time {
+ border-left-color: red;
+ border-left-style: solid;
+}
+
+.timeline-ruler > .markers > .marker.current-time::before {
+ position: absolute;
+ top: -5px;
+ left: -5px;
+
+ width: 9px;
+ height: 9px;
+ border-radius: 5px;
+
+ background-color: red;
+
+ content: "";
+}
+
+.timeline-ruler > .markers > .marker.load-event {
</ins><span class="cx"> border-left-color: rgba(255, 0, 0, 0.5);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.timeline-ruler > .event-markers > .event-marker.dom-content-event {
</del><ins>+.timeline-ruler > .markers > .marker.dom-content-event {
</ins><span class="cx"> border-left-color: rgba(0, 0, 255, 0.5);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.timeline-ruler > .event-markers > .event-marker.timestamp {
</del><ins>+.timeline-ruler > .markers > .marker.timestamp {
</ins><span class="cx"> border-left-color: rgba(0, 110, 0, 0.5);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRulerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js (162407 => 162408)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js        2014-01-21 02:54:54 UTC (rev 162407)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRuler.js        2014-01-21 02:55:03 UTC (rev 162408)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> this._element.appendChild(this._headerElement);
</span><span class="cx">
</span><span class="cx"> this._markersElement = document.createElement("div");
</span><del>- this._markersElement.className = WebInspector.TimelineRuler.EventMarkersElementStyleClassName;
</del><ins>+ this._markersElement.className = WebInspector.TimelineRuler.MarkersElementStyleClassName;
</ins><span class="cx"> this._element.appendChild(this._markersElement);
</span><span class="cx">
</span><span class="cx"> this._zeroTime = 0;
</span><span class="lines">@@ -45,6 +45,8 @@
</span><span class="cx"> this._secondsPerPixel = 0;
</span><span class="cx"> this._endTimePinned = false;
</span><span class="cx"> this._allowsClippedLabels = false;
</span><ins>+
+ this._markerElementMap = new Map;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebInspector.TimelineRuler.MinimumLeftDividerSpacing = 48;
</span><span class="lines">@@ -55,9 +57,8 @@
</span><span class="cx"> WebInspector.TimelineRuler.DividerElementStyleClassName = "divider";
</span><span class="cx"> WebInspector.TimelineRuler.DividerLabelElementStyleClassName = "label";
</span><span class="cx">
</span><del>-WebInspector.TimelineRuler.EventMarkersElementStyleClassName = "event-markers";
-WebInspector.TimelineRuler.EventMarkerTooltipElementStyleClassName = "event-marker-tooltip";
-WebInspector.TimelineRuler.BaseEventMarkerElementStyleClassName = "event-marker";
</del><ins>+WebInspector.TimelineRuler.MarkersElementStyleClassName = "markers";
+WebInspector.TimelineRuler.BaseMarkerElementStyleClassName = "marker";
</ins><span class="cx">
</span><span class="cx"> WebInspector.TimelineRuler.prototype = {
</span><span class="cx"> constructor: WebInspector.TimelineRuler,
</span><span class="lines">@@ -182,6 +183,29 @@
</span><span class="cx"> this._needsLayout();
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ addMarker: function(marker)
+ {
+ console.assert(marker instanceof WebInspector.TimelineMarker);
+
+ if (this._markerElementMap.has(marker))
+ return;
+
+ marker.addEventListener(WebInspector.TimelineMarker.Event.TimeChanged, this._timelineMarkerTimeChanged, this);
+
+ var markerElement = document.createElement("div");
+ markerElement.classList.add(WebInspector.TimelineRuler.BaseMarkerElementStyleClassName);
+ markerElement.classList.add(marker.type);
+
+ this._markerElementMap.set(marker, markerElement);
+
+ this._needsMarkerLayout();
+ },
+
+ elementForMarker: function(marker)
+ {
+ return this._markerElementMap.get(marker) || null;
+ },
+
</ins><span class="cx"> updateLayout: function()
</span><span class="cx"> {
</span><span class="cx"> if (this._scheduledLayoutUpdateIdentifier) {
</span><span class="lines">@@ -227,6 +251,8 @@
</span><span class="cx"> if (!this._endTimePinned)
</span><span class="cx"> ++dividerCount;
</span><span class="cx">
</span><ins>+ var markerDividers = this._markersElement.querySelectorAll("." + WebInspector.TimelineRuler.DividerElementStyleClassName);
+
</ins><span class="cx"> var dividerElement = this._headerElement.firstChild;
</span><span class="cx">
</span><span class="cx"> for (var i = 0; i <= dividerCount; ++i) {
</span><span class="lines">@@ -241,6 +267,13 @@
</span><span class="cx"> dividerElement.appendChild(labelElement);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ var markerDividerElement = markerDividers[i];
+ if (!markerDividerElement) {
+ markerDividerElement = document.createElement("div");
+ markerDividerElement.className = WebInspector.TimelineRuler.DividerElementStyleClassName;
+ this._markersElement.appendChild(markerDividerElement);
+ }
+
</ins><span class="cx"> var dividerTime = firstDividerTime + (sliceTime * i);
</span><span class="cx">
</span><span class="cx"> var newLeftPosition = (dividerTime - this._startTime) / duration;
</span><span class="lines">@@ -259,18 +292,10 @@
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (this._endTimePinned)
- newLeftPosition *= 100;
- else
- newLeftPosition *= visibleWidth;
</del><ins>+ this._updateLeftPositionOfElement(dividerElement, newLeftPosition, visibleWidth);
+ this._updateLeftPositionOfElement(markerDividerElement, newLeftPosition, visibleWidth);
</ins><span class="cx">
</span><del>- newLeftPosition = newLeftPosition.toFixed(2);
-
- var currentLeftPosition = parseFloat(dividerElement.style.left).toFixed(2);
- if (currentLeftPosition !== newLeftPosition)
- dividerElement.style.left = newLeftPosition + (this._endTimePinned ? "%" : "px");
-
- dividerElement._labelElement.textContent = isNaN(dividerTime) ? "" : Number.secondsToString(dividerTime, true);
</del><ins>+ dividerElement._labelElement.textContent = isNaN(dividerTime) ? "" : Number.secondsToString(dividerTime - this._zeroTime, true);
</ins><span class="cx"> dividerElement = dividerElement.nextSibling;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -280,6 +305,11 @@
</span><span class="cx"> dividerElement.remove();
</span><span class="cx"> dividerElement = nextDividerElement;
</span><span class="cx"> }
</span><ins>+
+ for (; i < markerDividers.length; ++i)
+ markerDividers[i].remove();
+
+ this._updateMarkers(visibleWidth, duration);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> // Private
</span><span class="lines">@@ -288,9 +318,38 @@
</span><span class="cx"> {
</span><span class="cx"> if (this._scheduledLayoutUpdateIdentifier)
</span><span class="cx"> return;
</span><ins>+
+ if (this._scheduledMarkerLayoutUpdateIdentifier) {
+ cancelAnimationFrame(this._scheduledMarkerLayoutUpdateIdentifier);
+ delete this._scheduledMarkerLayoutUpdateIdentifier;
+ }
+
</ins><span class="cx"> this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _needsMarkerLayout: function()
+ {
+ // If layout is scheduled, abort since markers will be updated when layout happens.
+ if (this._scheduledLayoutUpdateIdentifier)
+ return;
+
+ if (this._scheduledMarkerLayoutUpdateIdentifier)
+ return;
+
+ function update()
+ {
+ delete this._scheduledMarkerLayoutUpdateIdentifier;
+
+ var visibleWidth = this._headerElement.clientWidth;
+ if (visibleWidth <= 0)
+ return;
+
+ this._updateMarkers(visibleWidth, this.duration);
+ }
+
+ this._scheduledMarkerLayoutUpdateIdentifier = requestAnimationFrame(update.bind(this));
+ },
+
</ins><span class="cx"> _recalculate: function()
</span><span class="cx"> {
</span><span class="cx"> var visibleWidth = this._headerElement.clientWidth;
</span><span class="lines">@@ -308,6 +367,33 @@
</span><span class="cx"> this._endTime = this._startTime + (visibleWidth * this._secondsPerPixel);
</span><span class="cx">
</span><span class="cx"> return visibleWidth;
</span><ins>+ },
+
+ _updateLeftPositionOfElement: function(element, newLeftPosition, visibleWidth)
+ {
+ newLeftPosition *= this._endTimePinned ? 100 : visibleWidth;
+ newLeftPosition = newLeftPosition.toFixed(2);
+
+ var currentLeftPosition = parseFloat(element.style.left).toFixed(2);
+ if (currentLeftPosition !== newLeftPosition)
+ element.style.left = newLeftPosition + (this._endTimePinned ? "%" : "px");
+ },
+
+ _updateMarkers: function(visibleWidth, duration)
+ {
+ this._markerElementMap.forEach(function(markerElement, marker) {
+ var newLeftPosition = (marker.time - this._startTime) / duration;
+
+ this._updateLeftPositionOfElement(markerElement, newLeftPosition, visibleWidth);
+
+ if (!markerElement.parentNode)
+ this._markersElement.appendChild(markerElement);
+ }, this);
+ },
+
+ _timelineMarkerTimeChanged: function()
+ {
+ this._needsMarkerLayout();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>