<!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>[162412] 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/162412">162412</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2014-01-20 18:55:30 -0800 (Mon, 20 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement bar graph rendering for WebInspector.OverviewTimelineView.
https://bugs.webkit.org/show_bug.cgi?id=126831
Reviewed by Joseph Pecoraro.
* UserInterface/Main.html: Added new files.
* UserInterface/OverviewTimelineView.css:
(.timeline-view.overview > .data-grid td.graph-column):
(.timeline-view.overview > .data-grid td.graph-column > div):
(.timeline-view.overview > .data-grid td.graph-column .timeline-record-bar):
Position the bars in the DataGrid cells.
* UserInterface/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype.updateLayout):
(WebInspector.OverviewTimelineView.prototype._addResourceToTreeIfNeeded):
(WebInspector.OverviewTimelineView.prototype._sourceCodeTimelineAdded):
Create the proper DataGridNodes for resources and source code timelines.
* UserInterface/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode):
(WebInspector.ResourceTimelineDataGridNode.prototype.get records):
(WebInspector.ResourceTimelineDataGridNode.prototype.get resource):
(WebInspector.ResourceTimelineDataGridNode.prototype.get data):
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ResourceTimelineDataGridNode.prototype.refresh):
(WebInspector.ResourceTimelineDataGridNode.prototype._needsRefresh):
(WebInspector.ResourceTimelineDataGridNode.prototype._goToResource):
Simplify by deferring the graph logic to the new TimelineDataGridNode base class.
* UserInterface/SourceCodeTimelineTimelineDataGridNode.js: Added.
(WebInspector.SourceCodeTimelineTimelineDataGridNode):
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.get records):
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.get sourceCodeTimeline):
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.get data):
* UserInterface/TimelineDataGridNode.js: Added.
(WebInspector.TimelineDataGridNode):
(WebInspector.TimelineDataGridNode.prototype.get records):
(WebInspector.TimelineDataGridNode.prototype.get data):
(WebInspector.TimelineDataGridNode.prototype.createCellContent):
(WebInspector.TimelineDataGridNode.prototype.refresh):
(WebInspector.TimelineDataGridNode.prototype.refreshGraph):
(WebInspector.TimelineDataGridNode.prototype.needsGraphRefresh):
Handles the graph column and manages the records and their bars.
* UserInterface/TimelineRecordBar.css: Added.
(.timeline-record-bar):
(.timeline-record-bar > .segment):
(.timeline-record-bar:not(.has-inactive-segment) > .segment):
(.timeline-record-bar.unfinished > .segment):
(.timeline-record-bar > .segment.inactive + .segment):
(:focus .selected .timeline-record-bar > .segment):
(.timeline-record-bar > .segment.inactive):
(.timeline-record-bar.timeline-record-type-network > .segment):
(.timeline-record-bar.timeline-record-type-layout > .segment):
(.timeline-record-bar.timeline-record-type-script > .segment):
* UserInterface/TimelineRecordBar.js: Added.
(WebInspector.TimelineRecordBar):
(WebInspector.TimelineRecordBar.prototype.get element):
(WebInspector.TimelineRecordBar.prototype.refresh):
(WebInspector.TimelineRecordBar.prototype._updateElementPosition):</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="#trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewcss">trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewjs">trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceResourceTimelineDataGridNodejs">trunk/Source/WebInspectorUI/UserInterface/ResourceTimelineDataGridNode.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceSourceCodeTimelineTimelineDataGridNodejs">trunk/Source/WebInspectorUI/UserInterface/SourceCodeTimelineTimelineDataGridNode.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineDataGridNodejs">trunk/Source/WebInspectorUI/UserInterface/TimelineDataGridNode.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRecordBarcss">trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRecordBarjs">trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (162411 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:55:21 UTC (rev 162411)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -1,3 +1,70 @@
</span><ins>+2014-01-11 Timothy Hatcher <timothy@apple.com>
+
+ Implement bar graph rendering for WebInspector.OverviewTimelineView.
+
+ https://bugs.webkit.org/show_bug.cgi?id=126831
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Main.html: Added new files.
+
+ * UserInterface/OverviewTimelineView.css:
+ (.timeline-view.overview > .data-grid td.graph-column):
+ (.timeline-view.overview > .data-grid td.graph-column > div):
+ (.timeline-view.overview > .data-grid td.graph-column .timeline-record-bar):
+ Position the bars in the DataGrid cells.
+
+ * UserInterface/OverviewTimelineView.js:
+ (WebInspector.OverviewTimelineView.prototype.updateLayout):
+ (WebInspector.OverviewTimelineView.prototype._addResourceToTreeIfNeeded):
+ (WebInspector.OverviewTimelineView.prototype._sourceCodeTimelineAdded):
+ Create the proper DataGridNodes for resources and source code timelines.
+
+ * UserInterface/ResourceTimelineDataGridNode.js:
+ (WebInspector.ResourceTimelineDataGridNode):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.get records):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.get resource):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.get data):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.refresh):
+ (WebInspector.ResourceTimelineDataGridNode.prototype._needsRefresh):
+ (WebInspector.ResourceTimelineDataGridNode.prototype._goToResource):
+ Simplify by deferring the graph logic to the new TimelineDataGridNode base class.
+
+ * UserInterface/SourceCodeTimelineTimelineDataGridNode.js: Added.
+ (WebInspector.SourceCodeTimelineTimelineDataGridNode):
+ (WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.get records):
+ (WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.get sourceCodeTimeline):
+ (WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.get data):
+
+ * UserInterface/TimelineDataGridNode.js: Added.
+ (WebInspector.TimelineDataGridNode):
+ (WebInspector.TimelineDataGridNode.prototype.get records):
+ (WebInspector.TimelineDataGridNode.prototype.get data):
+ (WebInspector.TimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.TimelineDataGridNode.prototype.refresh):
+ (WebInspector.TimelineDataGridNode.prototype.refreshGraph):
+ (WebInspector.TimelineDataGridNode.prototype.needsGraphRefresh):
+ Handles the graph column and manages the records and their bars.
+
+ * UserInterface/TimelineRecordBar.css: Added.
+ (.timeline-record-bar):
+ (.timeline-record-bar > .segment):
+ (.timeline-record-bar:not(.has-inactive-segment) > .segment):
+ (.timeline-record-bar.unfinished > .segment):
+ (.timeline-record-bar > .segment.inactive + .segment):
+ (:focus .selected .timeline-record-bar > .segment):
+ (.timeline-record-bar > .segment.inactive):
+ (.timeline-record-bar.timeline-record-type-network > .segment):
+ (.timeline-record-bar.timeline-record-type-layout > .segment):
+ (.timeline-record-bar.timeline-record-type-script > .segment):
+
+ * UserInterface/TimelineRecordBar.js: Added.
+ (WebInspector.TimelineRecordBar):
+ (WebInspector.TimelineRecordBar.prototype.get element):
+ (WebInspector.TimelineRecordBar.prototype.refresh):
+ (WebInspector.TimelineRecordBar.prototype._updateElementPosition):
+
</ins><span class="cx"> 2014-01-08 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><span class="cx"> Update the current WebInspector.TimelineView when time range changes.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (162411 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2014-01-21 02:55:21 UTC (rev 162411)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> <link rel="stylesheet" href="TimelineIcons.css">
</span><span class="cx"> <link rel="stylesheet" href="TimelineRuler.css">
</span><span class="cx"> <link rel="stylesheet" href="TimelineDataGrid.css">
</span><ins>+ <link rel="stylesheet" href="TimelineRecordBar.css">
</ins><span class="cx"> <link rel="stylesheet" href="TimelineOverview.css">
</span><span class="cx"> <link rel="stylesheet" href="ProfileView.css">
</span><span class="cx"> <link rel="stylesheet" href="JavaScriptProfileView.css">
</span><span class="lines">@@ -348,12 +349,15 @@
</span><span class="cx"> <script src="TimelineDataGrid.js"></script>
</span><span class="cx"> <script src="LayoutTimelineDataGrid.js"></script>
</span><span class="cx"> <script src="ScriptTimelineDataGrid.js"></script>
</span><ins>+ <script src="TimelineRecordBar.js"></script>
+ <script src="TimelineDataGridNode.js"></script>
</ins><span class="cx"> <script src="ResourceTimelineDataGridNode.js"></script>
</span><span class="cx"> <script src="ResourceTimelineDataGridNodePathComponent.js"></script>
</span><span class="cx"> <script src="LayoutTimelineRecord.js"></script>
</span><span class="cx"> <script src="LayoutTimelineDataGridNode.js"></script>
</span><span class="cx"> <script src="ScriptTimelineRecord.js"></script>
</span><span class="cx"> <script src="ScriptTimelineDataGridNode.js"></script>
</span><ins>+ <script src="SourceCodeTimelineTimelineDataGridNode.js"></script>
</ins><span class="cx"> <script src="TreeOutlineDataGridSynchronizer.js"></script>
</span><span class="cx"> <script src="TimelineOverview.js"></script>
</span><span class="cx"> <script src="ProfileManager.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.css (162411 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.css        2014-01-21 02:55:21 UTC (rev 162411)
+++ trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.css        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -56,3 +56,16 @@
</span><span class="cx"> .timeline-view.overview > .data-grid .data-container {
</span><span class="cx"> top: 0;
</span><span class="cx"> }
</span><ins>+
+.timeline-view.overview > .data-grid td.graph-column {
+ padding: 2px 0;
+}
+
+.timeline-view.overview > .data-grid td.graph-column > div {
+ position: relative;
+ height: 16px;
+}
+
+.timeline-view.overview > .data-grid td.graph-column .timeline-record-bar {
+ top: 2px;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js (162411 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js        2014-01-21 02:55:21 UTC (rev 162411)
+++ trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.js        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -44,6 +44,8 @@
</span><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><ins>+ this._pendingRepresentedObjects = [];
+
</ins><span class="cx"> WebInspector.timelineManager.recording.addEventListener(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded, this._sourceCodeTimelineAdded, this);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -72,6 +74,8 @@
</span><span class="cx">
</span><span class="cx"> shown: function()
</span><span class="cx"> {
</span><ins>+ WebInspector.TimelineView.prototype.shown.call(this);
+
</ins><span class="cx"> this._treeOutlineDataGridSynchronizer.synchronize();
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -79,12 +83,29 @@
</span><span class="cx"> {
</span><span class="cx"> WebInspector.TimelineView.prototype.updateLayout.call(this);
</span><span class="cx">
</span><ins>+ var oldZeroTime = this._timelineRuler.zeroTime;
+ var oldStartTime = this._timelineRuler.startTime;
+ var oldEndTime = this._timelineRuler.endTime;
+ var oldCurrentTime = this._currentTimeMarker.time;
+
</ins><span class="cx"> this._timelineRuler.zeroTime = this.zeroTime;
</span><span class="cx"> this._timelineRuler.startTime = this.startTime;
</span><span class="cx"> this._timelineRuler.endTime = this.endTime;
</span><span class="cx"> this._currentTimeMarker.time = this.currentTime;
</span><span class="cx">
</span><ins>+ // The TimelineDataGridNode graphs are positioned with percentages, so they auto resize with the view.
+ // We only need to refresh the graphs when the any of the times change.
+ if (this.zeroTime !== oldZeroTime || this.startTime !== oldStartTime || this.endTime !== oldEndTime || this.currentTime !== oldCurrentTime) {
+ var item = this._dataGrid.children[0];
+ while (item) {
+ item.refreshGraph();
+ item = item.traverseNextNode(false, null, true);
+ }
+ }
+
</ins><span class="cx"> this._timelineRuler.updateLayout();
</span><ins>+
+ this._processPendingRepresentedObjects();
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> // Private
</span><span class="lines">@@ -171,8 +192,11 @@
</span><span class="cx"> var resourceTreeElement = new WebInspector.ResourceTreeElement(resource);
</span><span class="cx"> resourceTreeElement.expand();
</span><span class="cx">
</span><del>- // FIXME: This is just a placeholder DataGridNode.
- var resourceDataGridNode = new WebInspector.DataGridNode;
</del><ins>+ var resourceTimelineRecord = this._networkTimeline ? this._networkTimeline.recordForResource(resource) : null;
+ if (!resourceTimelineRecord)
+ resourceTimelineRecord = new WebInspector.ResourceTimelineRecord(resource);
+
+ var resourceDataGridNode = new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord, true, this);
</ins><span class="cx"> this._treeOutlineDataGridSynchronizer.associate(resourceTreeElement, resourceDataGridNode);
</span><span class="cx">
</span><span class="cx"> var parentTreeElement = this.navigationSidebarTreeOutline;
</span><span class="lines">@@ -191,13 +215,46 @@
</span><span class="cx"> return resourceTreeElement;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _addSourceCodeTimeline: function(sourceCodeTimeline)
+ {
+ var parentTreeElement = sourceCodeTimeline.sourceCodeLocation ? this._addResourceToTreeIfNeeded(sourceCodeTimeline.sourceCode) : this.navigationSidebarTreeOutline;
+ console.assert(parentTreeElement);
+ if (!parentTreeElement)
+ return;
+
+ var sourceCodeTimelineTreeElement = new WebInspector.SourceCodeTimelineTreeElement(sourceCodeTimeline);
+ var sourceCodeTimelineDataGridNode = new WebInspector.SourceCodeTimelineTimelineDataGridNode(sourceCodeTimeline, this);
+
+ this._treeOutlineDataGridSynchronizer.associate(sourceCodeTimelineTreeElement, sourceCodeTimelineDataGridNode);
+ this._insertTreeElement(sourceCodeTimelineTreeElement, parentTreeElement);
+ },
+
+ _processPendingRepresentedObjects: function()
+ {
+ if (!this._pendingRepresentedObjects || !this._pendingRepresentedObjects.length)
+ return;
+
+ for (var representedObject of this._pendingRepresentedObjects) {
+ if (representedObject instanceof WebInspector.Resource)
+ this._addResourceToTreeIfNeeded(representedObject);
+ else if (representedObject instanceof WebInspector.SourceCodeTimeline)
+ this._addSourceCodeTimeline(representedObject);
+ else
+ console.error("Unknown represented object");
+ }
+
+ this._pendingRepresentedObjects = [];
+ },
+
</ins><span class="cx"> _networkTimelineRecordAdded: function(event)
</span><span class="cx"> {
</span><span class="cx"> var resourceTimelineRecord = event.data.record;
</span><span class="cx"> console.assert(resourceTimelineRecord instanceof WebInspector.ResourceTimelineRecord);
</span><span class="cx">
</span><del>- this._addResourceToTreeIfNeeded(resourceTimelineRecord.resource);
</del><ins>+ this._pendingRepresentedObjects.push(resourceTimelineRecord.resource);
</ins><span class="cx">
</span><ins>+ this.needsLayout();
+
</ins><span class="cx"> // We don't expect to have any source code timelines yet. Those should be added with _sourceCodeTimelineAdded.
</span><span class="cx"> console.assert(!WebInspector.timelineManager.recording.sourceCodeTimelinesForSourceCode(resourceTimelineRecord.resource).length);
</span><span class="cx"> },
</span><span class="lines">@@ -209,18 +266,9 @@
</span><span class="cx"> if (!sourceCodeTimeline)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- var parentTreeElement = sourceCodeTimeline.sourceCodeLocation ? this._addResourceToTreeIfNeeded(sourceCodeTimeline.sourceCode) : this.navigationSidebarTreeOutline;
- console.assert(parentTreeElement);
- if (!parentTreeElement)
- return;
</del><ins>+ this._pendingRepresentedObjects.push(sourceCodeTimeline);
</ins><span class="cx">
</span><del>- var sourceCodeTimelineTreeElement = new WebInspector.SourceCodeTimelineTreeElement(sourceCodeTimeline);
-
- // FIXME: This is just a placeholder DataGridNode.
- var sourceCodeTimelineDataGridNode = new WebInspector.DataGridNode;
- this._treeOutlineDataGridSynchronizer.associate(sourceCodeTimelineTreeElement, sourceCodeTimelineDataGridNode);
-
- this._insertTreeElement(sourceCodeTimelineTreeElement, parentTreeElement);
</del><ins>+ this.needsLayout();
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> _treeElementSelected: function(treeElement, selectedByUser)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceResourceTimelineDataGridNodejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/ResourceTimelineDataGridNode.js (162411 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/ResourceTimelineDataGridNode.js        2014-01-21 02:55:21 UTC (rev 162411)
+++ trunk/Source/WebInspectorUI/UserInterface/ResourceTimelineDataGridNode.js        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -23,19 +23,23 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.ResourceTimelineDataGridNode = function(resourceTimelineRecord)
</del><ins>+WebInspector.ResourceTimelineDataGridNode = function(resourceTimelineRecord, graphOnly, graphDataSource)
</ins><span class="cx"> {
</span><del>- WebInspector.DataGridNode.call(this, {});
</del><ins>+ WebInspector.TimelineDataGridNode.call(this, graphOnly, graphDataSource);
</ins><span class="cx">
</span><ins>+ this._resource = resourceTimelineRecord.resource;
</ins><span class="cx"> this._record = resourceTimelineRecord;
</span><span class="cx">
</span><del>- this._record.addEventListener(WebInspector.TimelineRecord.Event.Updated, this._needsRefresh, this);
- this._record.resource.addEventListener(WebInspector.Resource.Event.URLDidChange, this._needsRefresh, this);
- this._record.resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._needsRefresh, this);
- this._record.resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, this._needsRefresh, this);
- this._record.resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail, this._needsRefresh, this);
- this._record.resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._needsRefresh, this);
- this._record.resource.addEventListener(WebInspector.Resource.Event.TransferSizeDidChange, this._needsRefresh, this);
</del><ins>+ this._record.addEventListener(WebInspector.TimelineRecord.Event.Updated, graphOnly ? this.needsGraphRefresh : this._needsRefresh, this);
+
+ if (!graphOnly) {
+ this._resource.addEventListener(WebInspector.Resource.Event.URLDidChange, this._needsRefresh, this);
+ this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange, this._needsRefresh, this);
+ this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, this._needsRefresh, this);
+ this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail, this._needsRefresh, this);
+ this._resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._needsRefresh, this);
+ this._resource.addEventListener(WebInspector.Resource.Event.TransferSizeDidChange, this._needsRefresh, this);
+ }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.Object.addConstructorFunctions(WebInspector.ResourceTimelineDataGridNode);
</span><span class="lines">@@ -43,46 +47,56 @@
</span><span class="cx"> WebInspector.ResourceTimelineDataGridNode.IconStyleClassName = "icon";
</span><span class="cx"> WebInspector.ResourceTimelineDataGridNode.ErrorStyleClassName = "error";
</span><span class="cx">
</span><del>-WebInspector.ResourceTimelineDataGridNode.Event = {
- NeedsRefresh: "resource-timeline-data-grid-node-needs-refresh"
-};
-
</del><span class="cx"> WebInspector.ResourceTimelineDataGridNode.prototype = {
</span><span class="cx"> constructor: WebInspector.ResourceTimelineDataGridNode,
</span><ins>+ __proto__: WebInspector.TimelineDataGridNode.prototype,
</ins><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><del>- get record()
</del><ins>+ get records()
</ins><span class="cx"> {
</span><del>- return this._record;
</del><ins>+ return [this._record];
</ins><span class="cx"> },
</span><span class="cx">
</span><ins>+ get resource()
+ {
+ return this._resource;
+ },
+
</ins><span class="cx"> get data()
</span><span class="cx"> {
</span><span class="cx"> if (this._cachedData)
</span><span class="cx"> return this._cachedData;
</span><span class="cx">
</span><del>- var resource = this._record.resource;
-
</del><ins>+ var resource = this._resource;
</ins><span class="cx"> var data = {};
</span><del>- data.name = WebInspector.displayNameForURL(resource.url, resource.urlComponents);
- data.domain = WebInspector.displayNameForHost(resource.urlComponents.host);
- data.type = resource.type;
- data.statusCode = resource.statusCode;
- data.cached = resource.cached;
- data.size = resource.size;
- data.transferSize = resource.transferSize;
- data.duration = resource.receiveDuration;
- data.latency = resource.latency;
- data.timeline = resource.responseReceivedTimestamp || resource.requestSentTimestamp;
</del><span class="cx">
</span><ins>+ if (!this._graphOnly) {
+ var zeroTime = this.graphDataSource ? this.graphDataSource.zeroTime : 0;
+
+ data.name = WebInspector.displayNameForURL(resource.url, resource.urlComponents);
+ data.domain = WebInspector.displayNameForHost(resource.urlComponents.host);
+ data.scheme = resource.urlComponents.scheme ? resource.urlComponents.scheme.toUpperCase() : "";
+ data.method = resource.requestMethod;
+ data.type = resource.type;
+ data.statusCode = resource.statusCode;
+ data.cached = resource.cached;
+ data.size = resource.size;
+ data.transferSize = resource.transferSize;
+ data.requestSent = resource.requestSentTimestamp - zeroTime;
+ data.duration = resource.receiveDuration;
+ data.latency = resource.latency;
+ }
+
+ data.graph = this._record.startTime;
+
</ins><span class="cx"> this._cachedData = data;
</span><span class="cx"> return data;
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> createCellContent: function(columnIdentifier, cell)
</span><span class="cx"> {
</span><del>- var resource = this._record.resource;
</del><ins>+ var resource = this._resource;
</ins><span class="cx">
</span><span class="cx"> if (resource.failed || resource.canceled || resource.statusCode >= 400)
</span><span class="cx"> cell.classList.add(WebInspector.ResourceTimelineDataGridNode.ErrorStyleClassName);
</span><span class="lines">@@ -97,9 +111,9 @@
</span><span class="cx">
</span><span class="cx"> var fragment = document.createDocumentFragment();
</span><span class="cx">
</span><del>- var gotToButton = WebInspector.createGoToArrowButton();
- gotToButton.addEventListener("click", this._goToResource.bind(this));
- fragment.appendChild(gotToButton);
</del><ins>+ var goToButton = WebInspector.createGoToArrowButton();
+ goToButton.addEventListener("click", this._goToResource.bind(this));
+ fragment.appendChild(goToButton);
</ins><span class="cx">
</span><span class="cx"> var icon = document.createElement("div");
</span><span class="cx"> icon.className = WebInspector.ResourceTimelineDataGridNode.IconStyleClassName;
</span><span class="lines">@@ -129,181 +143,39 @@
</span><span class="cx"> case "transferSize":
</span><span class="cx"> return isNaN(value) ? emptyValuePlaceholderString : Number.bytesToString(value);
</span><span class="cx">
</span><ins>+ case "requestSent":
</ins><span class="cx"> case "latency":
</span><span class="cx"> case "duration":
</span><span class="cx"> return isNaN(value) ? emptyValuePlaceholderString : Number.secondsToString(value);
</span><del>-
- case "timeline":
- return this._createGraphElement();
</del><span class="cx"> }
</span><span class="cx">
</span><del>- return WebInspector.DataGridNode.prototype.createCellContent.call(this, columnIdentifier);
</del><ins>+ return WebInspector.TimelineDataGridNode.prototype.createCellContent.call(this, columnIdentifier, cell);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> refresh: function()
</span><span class="cx"> {
</span><ins>+ if (this._scheduledRefreshIdentifier) {
+ cancelAnimationFrame(this._scheduledRefreshIdentifier);
+ delete this._scheduledRefreshIdentifier;
+ }
+
</ins><span class="cx"> delete this._cachedData;
</span><span class="cx">
</span><del>- WebInspector.DataGridNode.prototype.refresh.call(this);
</del><ins>+ WebInspector.TimelineDataGridNode.prototype.refresh.call(this);
</ins><span class="cx"> },
</span><span class="cx">
</span><del>- updateLayout: function()
- {
- this._refreshLabelPositions();
- },
-
- select: function(supressSelectedEvent)
- {
- if (this.element.classList.contains(WebInspector.TimelinesContentView.OffscreenDataGridRowStyleClassName))
- this.element.classList.remove(WebInspector.TimelinesContentView.OffscreenDataGridRowStyleClassName);
-
- WebInspector.DataGridNode.prototype.select.call(this, supressSelectedEvent);
-
- this._refreshLabelPositions();
- },
-
</del><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _needsRefresh: function()
</span><span class="cx"> {
</span><del>- this.dispatchEventToListeners(WebInspector.ResourceTimelineDataGridNode.Event.NeedsRefresh);
</del><ins>+ if (this._scheduledRefreshIdentifier)
+ return;
+
+ this._scheduledRefreshIdentifier = requestAnimationFrame(this.refresh.bind(this));
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> _goToResource: function(event)
</span><span class="cx"> {
</span><del>- WebInspector.resourceSidebarPanel.showSourceCode(this._record.resource);
- },
-
- _createGraphElement: function(cell)
- {
- if (!this._graphElement) {
- this._graphElement = document.createElement("div");
- this._graphElement.className = "network-graph-side";
-
- this._barAreaElement = document.createElement("div");
- this._barAreaElement.className = "network-graph-bar-area";
- this._barAreaElement.resource = this._record.resource;
- this._graphElement.appendChild(this._barAreaElement);
-
- this._barLeftElement = document.createElement("div");
- this._barLeftElement.className = "network-graph-bar waiting";
- this._barAreaElement.appendChild(this._barLeftElement);
-
- this._barRightElement = document.createElement("div");
- this._barRightElement.className = "network-graph-bar";
- this._barAreaElement.appendChild(this._barRightElement);
-
- this._labelLeftElement = document.createElement("div");
- this._labelLeftElement.className = "network-graph-label waiting";
- this._barAreaElement.appendChild(this._labelLeftElement);
-
- this._labelRightElement = document.createElement("div");
- this._labelRightElement.className = "network-graph-label";
- this._barAreaElement.appendChild(this._labelRightElement);
-
- this._graphElement.addEventListener("mouseover", this._refreshLabelPositions.bind(this));
- }
-
- this._refreshGraph();
-
- return this._graphElement;
- },
-
- _refreshGraph: function(c)
- {
- var resource = this._record.resource;
- if (resource.cached)
- this._graphElement.classList.add("resource-cached");
-
- var calculator = this.dataGrid.currentCalculator;
- var percentages = calculator.computeBarGraphPercentages(resource);
- this._percentages = percentages;
-
- if (!this._graphElement.classList.contains("network-" + resource.type)) {
- this._graphElement.removeMatchingStyleClasses("network-resource-type-\\w+");
- this._graphElement.classList.add("network-" + resource.type);
- }
-
- this._barLeftElement.style.setProperty("left", percentages.start + "%");
- this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%");
-
- this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%");
- this._barRightElement.style.setProperty("left", percentages.middle + "%");
-
- var labels = calculator.computeBarGraphLabels(resource);
- this._labelLeftElement.textContent = labels.left;
- this._labelRightElement.textContent = labels.right;
-
- var tooltip = (labels.tooltip || "");
- this._barLeftElement.title = tooltip;
- this._labelLeftElement.title = tooltip;
- this._labelRightElement.title = tooltip;
- this._barRightElement.title = tooltip;
- },
-
- _refreshLabelPositions: function()
- {
- if (!this._percentages)
- return;
-
- this._labelLeftElement.style.removeProperty("left");
- this._labelLeftElement.style.removeProperty("right");
- this._labelLeftElement.classList.remove("before");
- this._labelLeftElement.classList.remove("hidden");
-
- this._labelRightElement.style.removeProperty("left");
- this._labelRightElement.style.removeProperty("right");
- this._labelRightElement.classList.remove("after");
- this._labelRightElement.classList.remove("hidden");
-
- const labelPadding = 10;
- const leftLabelWidth = this._labelLeftElement.offsetWidth + labelPadding;
- const rightLabelWidth = this._labelRightElement.offsetWidth + labelPadding;
-
- const barRightElementOffsetWidth = this._barRightElement.offsetWidth;
- const barLeftElementOffsetWidth = this._barLeftElement.offsetWidth;
-
- const leftBarWidth = barLeftElementOffsetWidth - barRightElementOffsetWidth;
- const rightBarWidth = barRightElementOffsetWidth;
-
- const leftCallout = (leftLabelWidth > leftBarWidth);
- const rightCallout = (rightLabelWidth > rightBarWidth);
-
- // Hide the left or right callout if there is not enough space.
- const graphElementOffsetWidth = this._graphElement.offsetWidth;
- if (leftCallout && (graphElementOffsetWidth * (this._percentages.start / 100)) < leftLabelWidth)
- var leftHidden = true;
- if (rightCallout && (graphElementOffsetWidth * ((100 - this._percentages.end) / 100)) < rightLabelWidth)
- var rightHidden = true;
-
- // The left/right label data are the same, so a before/after label can be replaced by a single on-bar label.
- if (barLeftElementOffsetWidth == barRightElementOffsetWidth) {
- if (leftCallout && !rightCallout)
- leftHidden = true;
- else if (rightCallout && !leftCallout)
- rightHidden = true;
- }
-
- if (leftCallout) {
- if (leftHidden)
- this._labelLeftElement.classList.add("hidden");
- this._labelLeftElement.style.setProperty("right", (100 - this._percentages.start) + "%");
- this._labelLeftElement.classList.add("before");
- } else {
- this._labelLeftElement.style.setProperty("left", this._percentages.start + "%");
- this._labelLeftElement.style.setProperty("right", (100 - this._percentages.middle) + "%");
- }
-
- if (rightCallout) {
- if (rightHidden)
- this._labelRightElement.classList.add("hidden");
- this._labelRightElement.style.setProperty("left", this._percentages.end + "%");
- this._labelRightElement.classList.add("after");
- } else {
- this._labelRightElement.style.setProperty("left", this._percentages.middle + "%");
- this._labelRightElement.style.setProperty("right", (100 - this._percentages.end) + "%");
- }
</del><ins>+ WebInspector.resourceSidebarPanel.showSourceCode(this._resource);
</ins><span class="cx"> }
</span><del>-}
-
-WebInspector.ResourceTimelineDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
</del><ins>+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceSourceCodeTimelineTimelineDataGridNodejsfromrev162411trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewcss"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/SourceCodeTimelineTimelineDataGridNode.js (from rev 162411, trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.css) (0 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/SourceCodeTimelineTimelineDataGridNode.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/SourceCodeTimelineTimelineDataGridNode.js        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.SourceCodeTimelineTimelineDataGridNode = function(sourceCodeTimeline, graphDataSource)
+{
+ WebInspector.TimelineDataGridNode.call(this, true, graphDataSource);
+
+ this._sourceCodeTimeline = sourceCodeTimeline;
+ this._sourceCodeTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this.needsGraphRefresh, this);
+};
+
+WebInspector.Object.addConstructorFunctions(WebInspector.SourceCodeTimelineTimelineDataGridNode);
+
+WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype = {
+ constructor: WebInspector.SourceCodeTimelineTimelineDataGridNode,
+ __proto__: WebInspector.TimelineDataGridNode.prototype,
+
+ // Public
+
+ get records()
+ {
+ return this._sourceCodeTimeline.records;
+ },
+
+ get sourceCodeTimeline()
+ {
+ return this._sourceCodeTimeline;
+ },
+
+ get data()
+ {
+ return {graph: this._sourceCodeTimeline.startTime};
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineDataGridNodejs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/TimelineDataGridNode.js (0 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineDataGridNode.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineDataGridNode.js        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.TimelineDataGridNode = function(graphOnly, graphDataSource)
+{
+ WebInspector.DataGridNode.call(this, {});
+
+ this._graphOnly = graphOnly || false;
+ this._graphDataSource = graphDataSource || null;
+
+ if (graphDataSource) {
+ this._graphContainerElement = document.createElement("div");
+ this._timelineRecordBarMap = new Map;
+ }
+};
+
+WebInspector.Object.addConstructorFunctions(WebInspector.TimelineDataGridNode);
+
+WebInspector.TimelineDataGridNode.prototype = {
+ constructor: WebInspector.TimelineDataGridNode,
+ __proto__: WebInspector.DataGridNode.prototype,
+
+ // Public
+
+ get records()
+ {
+ // Implemented by subclasses.
+ return [];
+ },
+
+ get graphDataSource()
+ {
+ return this._graphDataSource;
+ },
+
+ get data()
+ {
+ var records = this.records || [];
+ return {graph: records.length ? records[0].startTime : 0};
+ },
+
+ createCellContent: function(columnIdentifier, cell)
+ {
+ if (columnIdentifier === "graph") {
+ this.refreshGraph();
+ return this._graphContainerElement;
+ }
+
+ return WebInspector.DataGridNode.prototype.createCellContent.call(this, columnIdentifier, cell);
+ },
+
+ refresh: function()
+ {
+ if (this._graphOnly) {
+ this.refreshGraph();
+ return;
+ }
+
+ WebInspector.DataGridNode.prototype.refresh.call(this);
+ },
+
+ refreshGraph: function()
+ {
+ if (this._scheduledGraphRefreshIdentifier) {
+ cancelAnimationFrame(this._scheduledGraphRefreshIdentifier);
+ delete this._scheduledGraphRefreshIdentifier;
+ }
+
+ var records = this.records || [];
+ for (var record of records) {
+ var timelineRecordBar = this._timelineRecordBarMap.get(record);
+ if (!timelineRecordBar) {
+ timelineRecordBar = new WebInspector.TimelineRecordBar(record);
+ this._timelineRecordBarMap.set(record, timelineRecordBar);
+ }
+
+ if (timelineRecordBar.refresh(this._graphDataSource)) {
+ if (!timelineRecordBar.element.parentNode)
+ this._graphContainerElement.appendChild(timelineRecordBar.element);
+ } else {
+ timelineRecordBar.element.remove();
+ }
+ }
+ },
+
+ needsGraphRefresh: function()
+ {
+ if (this._scheduledGraphRefreshIdentifier)
+ return;
+
+ this._scheduledGraphRefreshIdentifier = requestAnimationFrame(this.refreshGraph.bind(this));
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRecordBarcssfromrev162411trunkSourceWebInspectorUIUserInterfaceOverviewTimelineViewcss"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.css (from rev 162411, trunk/Source/WebInspectorUI/UserInterface/OverviewTimelineView.css) (0 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.css         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.css        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (C) 2014 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-record-bar {
+ position: absolute;
+ height: 12px;
+}
+
+.timeline-record-bar > .segment {
+ position: absolute;
+ height: 12px;
+ background-color: rgb(225, 225, 225);
+ border: 1px solid rgb(200, 200, 200);
+ border-radius: 3px;
+ min-width: 4px;
+}
+
+.timeline-record-bar:not(.has-inactive-segment) > .segment {
+ left: 0;
+ width: 100%;
+}
+
+.timeline-record-bar > .segment.inactive,
+.timeline-record-bar.unfinished > .segment {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ border-right: none;
+}
+
+.timeline-record-bar > .segment.inactive + .segment {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+}
+
+:focus .selected .timeline-record-bar > .segment {
+ background-color: white !important;
+ border-color: white !important;
+}
+
+.timeline-record-bar > .segment.inactive {
+ opacity: 0.5;
+}
+
+.timeline-record-bar.timeline-record-type-network > .segment {
+ background-color: rgb(120, 176, 225);
+ border-color: rgb(61, 147, 200);
+}
+
+.timeline-record-bar.timeline-record-type-layout > .segment {
+ background-color: rgb(234, 153, 153);
+ border-color: rgb(212, 108, 108);
+}
+
+.timeline-record-bar.timeline-record-type-script > .segment {
+ background-color: rgb(190, 148, 233);
+ border-color: rgb(153, 113, 185);
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRecordBarjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.js (0 => 162412)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRecordBar.js        2014-01-21 02:55:30 UTC (rev 162412)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.TimelineRecordBar = function(record)
+{
+ WebInspector.Object.call(this);
+
+ console.assert(record);
+
+ this._record = record;
+
+ this._element = document.createElement("div");
+ this._element.classList.add(WebInspector.TimelineRecordBar.StyleClassName);
+ this._element.classList.add(record.type);
+
+ if (record.usesActiveStartTime) {
+ this._inactiveBarElement = document.createElement("div");
+ this._inactiveBarElement.classList.add(WebInspector.TimelineRecordBar.BarSegmentStyleClassName);
+ this._inactiveBarElement.classList.add(WebInspector.TimelineRecordBar.InactiveStyleClassName);
+ this._element.classList.add(WebInspector.TimelineRecordBar.HasInactiveSegmentStyleClassName);
+ }
+
+ this._activeBarElement = document.createElement("div");
+ this._activeBarElement.classList.add(WebInspector.TimelineRecordBar.BarSegmentStyleClassName);
+
+ if (this._inactiveBarElement)
+ this._element.appendChild(this._inactiveBarElement);
+ this._element.appendChild(this._activeBarElement);
+};
+
+WebInspector.Object.addConstructorFunctions(WebInspector.TimelineRecordBar);
+
+WebInspector.TimelineRecordBar.StyleClassName = "timeline-record-bar";
+WebInspector.TimelineRecordBar.BarSegmentStyleClassName = "segment";
+WebInspector.TimelineRecordBar.InactiveStyleClassName = "inactive";
+WebInspector.TimelineRecordBar.UnfinishedStyleClassName = "unfinished";
+WebInspector.TimelineRecordBar.HasInactiveSegmentStyleClassName = "has-inactive-segment";
+
+WebInspector.TimelineRecordBar.prototype = {
+ constructor: WebInspector.TimelineRecordBar,
+ __proto__: WebInspector.Object.prototype,
+
+ // Public
+
+ get element()
+ {
+ return this._element;
+ },
+
+ refresh: function(graphDataSource)
+ {
+ var barStartTime = this._record.startTime;
+
+ // If this bar has no time info, return early.
+ if (isNaN(barStartTime))
+ return false;
+
+ var graphStartTime = graphDataSource.startTime;
+ var graphEndTime = graphDataSource.endTime;
+ var graphCurrentTime = graphDataSource.currentTime;
+
+ var barEndTime = this._record.endTime;
+
+ // If this bar is completly after the current time, return early.
+ if (barStartTime > graphCurrentTime)
+ return false;
+
+ // If this bar is completly before or after the bounds of the graph, return early.
+ if (barEndTime < graphStartTime || barStartTime > graphEndTime)
+ return false;
+
+ var barUnfinished = isNaN(barEndTime) || barEndTime >= graphCurrentTime;
+ if (barUnfinished)
+ barEndTime = graphCurrentTime;
+
+ var graphDuration = graphEndTime - graphStartTime;
+
+ this._element.classList.toggle(WebInspector.TimelineRecordBar.UnfinishedStyleClassName, barUnfinished);
+
+ var newBarLeftPosition = (barStartTime - graphStartTime) / graphDuration;
+ this._updateElementPosition(this._element, newBarLeftPosition, "left");
+
+ var newBarWidth = ((barEndTime - graphStartTime) / graphDuration) - newBarLeftPosition;
+ this._updateElementPosition(this._element, newBarWidth, "width");
+
+ if (!this._record.usesActiveStartTime)
+ return true;
+
+ var barActiveStartTime = Math.max(barStartTime, Math.min(this._record.activeStartTime, barEndTime));
+ var barDuration = barEndTime - barStartTime;
+
+ var inactiveUnfinished = isNaN(barActiveStartTime) || barActiveStartTime >= graphCurrentTime;
+ this._element.classList.toggle(WebInspector.TimelineRecordBar.UnfinishedStyleClassName, inactiveUnfinished);
+
+ if (inactiveUnfinished)
+ barActiveStartTime = graphCurrentTime;
+
+ var middlePercentage = (barActiveStartTime - barStartTime) / barDuration;
+
+ this._updateElementPosition(this._inactiveBarElement, 1 - middlePercentage, "right");
+ this._updateElementPosition(this._inactiveBarElement, middlePercentage, "width");
+
+ if (!inactiveUnfinished) {
+ if (!this._activeBarElement.parentNode)
+ this._element.appendChild(this._activeBarElement);
+
+ this._updateElementPosition(this._activeBarElement, middlePercentage, "left");
+ this._updateElementPosition(this._activeBarElement, 1 - middlePercentage, "width");
+ } else
+ this._activeBarElement.remove();
+
+ return true;
+ },
+
+ // Private
+
+ _updateElementPosition: function(element, newPosition, property)
+ {
+ newPosition *= 100;
+ newPosition = newPosition.toFixed(2);
+
+ var currentPosition = parseFloat(element.style[property]).toFixed(2);
+ if (currentPosition !== newPosition)
+ element.style[property] = newPosition + "%";
+ }
+};
</ins></span></pre>
</div>
</div>
</body>
</html>