Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (197908 => 197909)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-03-10 01:38:03 UTC (rev 197909)
@@ -1,5 +1,125 @@
2016-03-09 Matt Baker <[email protected]>
+ Web Inspector: Timelines UI redesign: use DataGridNode for TimelineView selection path components
+ https://bugs.webkit.org/show_bug.cgi?id=154954
+ <rdar://problem/24947939>
+
+ Reviewed by Timothy Hatcher.
+
+ This patch adds a new path component, TimelineDataGridNodePathComponent,
+ for creating a path component from the current grid selection. This is
+ needed since TimelineViews will no longer have an associated content tree
+ outline once the navigation sidebar is removed.
+
+ TimelineDataGridNode has new protected methods, "displayName" and
+ "iconClassNames", which are used to populate hierarchical path components,
+ create grid node data, and create cell content.
+
+ TimelineView subclasses share a certain amount of boilerplate code for
+ getting selection path components and handling path component selection.
+ In the future we may be able to reduce this code by introducing a new
+ DataGridTimelineView base class.
+
+ * UserInterface/Main.html:
+ Added/removed files.
+
+ * UserInterface/Views/LayoutTimelineDataGridNode.js:
+ (WebInspector.LayoutTimelineDataGridNode.prototype.get data):
+ (WebInspector.LayoutTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.LayoutTimelineDataGridNode):
+ (WebInspector.LayoutTimelineDataGridNode.prototype.get record): Deleted.
+ Moved to base class.
+
+ * UserInterface/Views/LayoutTimelineView.js:
+ (WebInspector.LayoutTimelineView.prototype.get selectionPathComponents):
+ (WebInspector.LayoutTimelineView.prototype.dataGridNodePathComponentSelected):
+ (WebInspector.LayoutTimelineView.prototype.treeElementPathComponentSelected): Deleted.
+ TimelineView tree outlines are going away.
+
+ * UserInterface/Views/MemoryTimelineView.js:
+ (WebInspector.MemoryTimelineView.prototype.treeElementPathComponentSelected): Deleted.
+ TimelineView tree outlines are going away.
+
+ * UserInterface/Views/NetworkTimelineView.js:
+ (WebInspector.NetworkTimelineView.prototype.get selectionPathComponents):
+ (WebInspector.NetworkTimelineView.prototype.dataGridNodePathComponentSelected):
+ (WebInspector.NetworkTimelineView.prototype.treeElementPathComponentSelected): Deleted.
+ TimelineView tree outlines are going away.
+
+ * UserInterface/Views/ProfileNodeDataGridNode.js:
+ (WebInspector.ProfileNodeDataGridNode.prototype.get data):
+ (WebInspector.ProfileNodeDataGridNode.prototype.createCellContent):
+ (WebInspector.ProfileNodeDataGridNode.prototype.displayName):
+ (WebInspector.ProfileNodeDataGridNode.prototype.iconClassNames):
+ (WebInspector.ProfileNodeDataGridNode):
+ (WebInspector.ProfileNodeDataGridNode.prototype._iconClassNameForProfileNode): Deleted.
+ (WebInspector.ProfileNodeDataGridNode.prototype._titleForProfileNode): Deleted.
+ Re-implemented as overrides of the base class methods "iconClassNames"
+ and "displayName".
+
+ * UserInterface/Views/RenderingFrameTimelineDataGridNode.js:
+ (WebInspector.RenderingFrameTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.RenderingFrameTimelineDataGridNode):
+ (WebInspector.RenderingFrameTimelineDataGridNode.prototype.get record): Deleted.
+ Moved to base class.
+
+ * UserInterface/Views/ResourceTimelineDataGridNode.js:
+ (WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.displayName):
+ (WebInspector.ResourceTimelineDataGridNode.prototype.iconClassNames):
+ Override base class methods, making it possible to remove ResourceTimelineDataGridNodePathComponent,
+ and treat all TimelineDataGridNodes in a uniform manner.
+
+ (WebInspector.ResourceTimelineDataGridNode.prototype._createNameCellDocumentFragment):
+ Replace duplicated code with call to "displayName".
+
+ * UserInterface/Views/ResourceTimelineDataGridNodePathComponent.js: Removed.
+ Replaced by more generic solution, TimelineDataGridNodePathComponent.
+
+ * UserInterface/Views/ScriptDetailsTimelineView.js:
+ (WebInspector.ScriptDetailsTimelineView.prototype.get selectionPathComponents):
+ (WebInspector.ScriptDetailsTimelineView.prototype.dataGridNodePathComponentSelected):
+ (WebInspector.ScriptDetailsTimelineView.prototype.treeElementPathComponentSelected): Deleted.
+ TimelineView tree outlines are going away.
+
+ * UserInterface/Views/ScriptTimelineDataGridNode.js:
+ (WebInspector.ScriptTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.ScriptTimelineDataGridNode.prototype._createNameCellDocumentFragment):
+ Replace duplicated code with call to "displayName".
+
+ (WebInspector.ScriptTimelineDataGridNode):
+ (WebInspector.ScriptTimelineDataGridNode.prototype.get record): Deleted.
+ Moved to base class.
+
+ * UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js:
+ (WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype._createNameCellContent):
+ Replace duplicated code with call to "displayName".
+
+ * UserInterface/Views/TimelineDataGridNode.js:
+ (WebInspector.TimelineDataGridNode.prototype.get record):
+ Implemented in terms of the "records" getter, since all subclasses simply returned the
+ node's first (or only) record.
+
+ (WebInspector.TimelineDataGridNode.prototype.displayName):
+ (WebInspector.TimelineDataGridNode.prototype.iconClassNames):
+ Base class implementations, using utility methods in TimelineTabContentView
+ to get display data based on the node's timeline record. Can be overridden
+ by nodes that either don't have a timeline record (ProfileNodeDataGridNode)
+
+ * UserInterface/Views/TimelineDataGridNodePathComponent.js:
+ (WebInspector.TimelineDataGridNodePathComponent):
+ (WebInspector.TimelineDataGridNodePathComponent.prototype.get timelineDataGridNode):
+ (WebInspector.TimelineDataGridNodePathComponent.prototype.get previousSibling):
+ (WebInspector.TimelineDataGridNodePathComponent.prototype.get nextSibling):
+
+ * UserInterface/Views/TimelineView.js:
+ (WebInspector.TimelineView):
+ (WebInspector.TimelineView.prototype.get selectionPathComponents):
+ Must be implemented by subclasses since not all TimelineViews use a DataGrid.
+
+2016-03-09 Matt Baker <[email protected]>
+
Web Inspector: Nodes in Computed Styles > Container Regions formatted incorrectly.
https://bugs.webkit.org/show_bug.cgi?id=155277
<rdar://problem/25072711>
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2016-03-10 01:38:03 UTC (rev 197909)
@@ -567,7 +567,6 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
<script src=""
<script src=""
@@ -596,6 +595,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -35,11 +35,6 @@
// Public
- get record()
- {
- return this._record;
- }
-
get records()
{
return [this._record];
@@ -49,7 +44,7 @@
{
if (!this._cachedData) {
this._cachedData = {
- name: WebInspector.LayoutTimelineRecord.displayNameForEventType(this._record.eventType),
+ name: this.displayName(),
width: this._record.width,
height: this._record.height,
area: this._record.width * this._record.height,
@@ -68,7 +63,7 @@
switch (columnIdentifier) {
case "name":
- cell.classList.add(WebInspector.TimelineTabContentView.iconClassNameForRecord(this._record));
+ cell.classList.add(...this.iconClassNames());
return value;
case "width":
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -102,6 +102,19 @@
return WebInspector.UIString("Records");
}
+ get selectionPathComponents()
+ {
+ if (!this._dataGrid.selectedNode || this._dataGrid.selectedNode.hidden)
+ return null;
+
+ let timelineDataGridNode = this._dataGrid.selectedNode;
+ console.assert(timelineDataGridNode instanceof WebInspector.TimelineDataGridNode);
+
+ let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(timelineDataGridNode);
+ pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+ return [pathComponent];
+ }
+
shown()
{
super.shown();
@@ -153,11 +166,11 @@
// Protected
- treeElementPathComponentSelected(event)
+ dataGridNodePathComponentSelected(event)
{
- var dataGridNode = this._dataGrid.dataGridNodeForTreeElement(event.data.pathComponent.generalTreeElement);
- if (!dataGridNode)
- return;
+ let dataGridNode = event.data.pathComponent.timelineDataGridNode;
+ console.assert(dataGridNode.dataGrid === this._dataGrid);
+
dataGridNode.revealAndSelect();
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -154,11 +154,6 @@
// Protected
- treeElementPathComponentSelected(event)
- {
- // Nothing. The sidebar will soon be removed.
- }
-
layout()
{
// Always update timeline ruler.
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -111,6 +111,18 @@
return WebInspector.UIString("Resources");
}
+ get selectionPathComponents()
+ {
+ if (!this._dataGrid.selectedNode || this._dataGrid.selectedNode.hidden)
+ return null;
+
+ console.assert(this._dataGrid.selectedNode instanceof WebInspector.ResourceTimelineDataGridNode);
+
+ let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(this._dataGrid.selectedNode, this._dataGrid.selectedNode.resource);
+ pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
+ return [pathComponent];
+ }
+
shown()
{
super.shown();
@@ -166,11 +178,14 @@
console.error("Unknown tree element selected.", treeElement);
}
- treeElementPathComponentSelected(event)
+ dataGridNodePathComponentSelected(event)
{
- var dataGridNode = this._dataGrid.dataGridNodeForTreeElement(event.data.pathComponent.generalTreeElement);
- if (!dataGridNode)
- return;
+ let pathComponent = event.data.pathComponent;
+ console.assert(pathComponent instanceof WebInspector.TimelineDataGridNodePathComponent);
+
+ let dataGridNode = pathComponent.timelineDataGridNode;
+ console.assert(dataGridNode.dataGrid === this._dataGrid);
+
dataGridNode.revealAndSelect();
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -70,7 +70,7 @@
{
if (!this._cachedData) {
this._cachedData = this._profileNode.computeCallInfoForTimeRange(this._rangeStartTime, this._rangeEndTime);
- this._cachedData.name = this._titleForProfileNode();
+ this._cachedData.name = this.displayName();
this._cachedData.location = this._profileNode.sourceCodeLocation;
}
@@ -114,7 +114,7 @@
switch (columnIdentifier) {
case "name":
- cell.classList.add(this._iconClassNameForProfileNode());
+ cell.classList.add(...this.iconClassNames());
return value;
case "startTime":
@@ -129,9 +129,27 @@
return super.createCellContent(columnIdentifier, cell);
}
- // Private
+ displayName()
+ {
+ let title = this._profileNode.functionName;
+ if (!title) {
+ switch (this._profileNode.type) {
+ case WebInspector.ProfileNode.Type.Function:
+ title = WebInspector.UIString("(anonymous function)");
+ break;
+ case WebInspector.ProfileNode.Type.Program:
+ title = WebInspector.UIString("(program)");
+ break;
+ default:
+ title = WebInspector.UIString("(anonymous function)");
+ console.error("Unknown ProfileNode type: " + this._profileNode.type);
+ }
+ }
- _iconClassNameForProfileNode()
+ return title;
+ }
+
+ iconClassNames()
{
let className;
switch (this._profileNode.type) {
@@ -152,26 +170,6 @@
if (this._profileNode.functionName && this._profileNode.functionName.startsWith("on") && this._profileNode.functionName.length >= 5)
className = WebInspector.CallFrameView.EventListenerIconStyleClassName;
- return className;
+ return [className];
}
-
- _titleForProfileNode()
- {
- let title = this._profileNode.functionName;
- if (!name) {
- switch (this._profileNode.type) {
- case WebInspector.ProfileNode.Type.Function:
- title = WebInspector.UIString("(anonymous function)");
- break;
- case WebInspector.ProfileNode.Type.Program:
- title = WebInspector.UIString("(program)");
- break;
- default:
- title = WebInspector.UIString("(anonymous function)");
- console.error("Unknown ProfileNode type: " + this._profileNode.type);
- }
- }
-
- return title;
- }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -35,11 +35,6 @@
// Public
- get record()
- {
- return this._record;
- }
-
get records()
{
return [this._record];
@@ -73,7 +68,7 @@
switch (columnIdentifier) {
case "name":
- cell.classList.add(WebInspector.TimelineTabContentView.iconClassNameForRecord(this._record));
+ cell.classList.add(...this.iconClassNames());
return value;
case "startTime":
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -98,7 +98,7 @@
switch (columnIdentifier) {
case "name":
- cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName, resource.type);
+ cell.classList.add(...this.iconClassNames());
cell.title = resource.displayURL;
this._updateStatus(cell);
return this._createNameCellDocumentFragment();
@@ -141,12 +141,17 @@
super.refresh();
}
+ iconClassNames()
+ {
+ return [WebInspector.ResourceTreeElement.ResourceIconStyleClassName, this.resource.type];
+ }
+
// Private
_createNameCellDocumentFragment()
{
let fragment = document.createDocumentFragment();
- let mainTitle = WebInspector.TimelineTabContentView.displayNameForRecord(this._record);
+ let mainTitle = this.displayName();
fragment.append(mainTitle);
// Show the host as the subtitle if it is different from the main resource or if this is the main frame's main resource.
Deleted: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNodePathComponent.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNodePathComponent.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNodePathComponent.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2013, 2015 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.ResourceTimelineDataGridNodePathComponent = class ResourceTimelineDataGridNodePathComponent extends WebInspector.HierarchicalPathComponent
-{
- constructor(resourceTimelineDataGridNode)
- {
- var resource = resourceTimelineDataGridNode.record.resource;
- var classNames = [WebInspector.ResourceTreeElement.ResourceIconStyleClassName, resource.type];
-
- super(resourceTimelineDataGridNode.data.name, classNames, resource);
-
- this._resourceTimelineDataGridNode = resourceTimelineDataGridNode;
- }
-
- // Public
-
- get resourceTimelineDataGridNode()
- {
- return this._resourceTimelineDataGridNode;
- }
-
- get previousSibling()
- {
- if (!this._resourceTimelineDataGridNode.previousSibling)
- return null;
- return new WebInspector.ResourceTimelineDataGridNodePathComponent(this._resourceTimelineDataGridNode.previousSibling);
- }
-
- get nextSibling()
- {
- if (!this._resourceTimelineDataGridNode.nextSibling)
- return null;
- return new WebInspector.ResourceTimelineDataGridNodePathComponent(this._resourceTimelineDataGridNode.nextSibling);
- }
-};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptDetailsTimelineView.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -126,16 +126,16 @@
var pathComponents = [];
while (dataGridNode && !dataGridNode.root) {
- var treeElement = this._dataGrid.treeElementForDataGridNode(dataGridNode);
- console.assert(treeElement);
- if (!treeElement)
- break;
-
- if (treeElement.hidden)
+ console.assert(dataGridNode instanceof WebInspector.TimelineDataGridNode);
+ if (dataGridNode.hidden)
return null;
- var pathComponent = new WebInspector.GeneralTreeElementPathComponent(treeElement);
- pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.treeElementPathComponentSelected, this);
+ let representedObject = null;
+ if (dataGridNode instanceof WebInspector.ProfileNodeDataGridNode)
+ representedObject = dataGridNode.profileNode;
+
+ let pathComponent = new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);
+ pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.dataGridNodePathComponentSelected, this);
pathComponents.unshift(pathComponent);
dataGridNode = dataGridNode.parent;
}
@@ -172,11 +172,11 @@
super.showContentViewForTreeElement(treeElement);
}
- treeElementPathComponentSelected(event)
+ dataGridNodePathComponentSelected(event)
{
- var dataGridNode = this._dataGrid.dataGridNodeForTreeElement(event.data.pathComponent.generalTreeElement);
- if (!dataGridNode)
- return;
+ let dataGridNode = event.data.pathComponent.timelineDataGridNode;
+ console.assert(dataGridNode.dataGrid === this._dataGrid);
+
dataGridNode.revealAndSelect();
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -37,11 +37,6 @@
// Public
- get record()
- {
- return this._record;
- }
-
get records()
{
return [this._record];
@@ -125,7 +120,7 @@
switch (columnIdentifier) {
case "name":
- cell.classList.add(WebInspector.TimelineTabContentView.iconClassNameForRecord(this._record));
+ cell.classList.add(...this.iconClassNames());
return this._createNameCellDocumentFragment();
case "startTime":
@@ -148,8 +143,7 @@
_createNameCellDocumentFragment(cellElement)
{
let fragment = document.createDocumentFragment();
- let mainTitle = WebInspector.TimelineTabContentView.displayNameForRecord(this._record);
- fragment.append(mainTitle);
+ fragment.append(this.displayName());
if (this._record.eventType === WebInspector.ScriptTimelineRecord.EventType.TimerInstalled) {
let subtitleElement = document.createElement("span");
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -53,7 +53,7 @@
createCellContent(columnIdentifier, cell)
{
if (columnIdentifier === "name" && this.records.length) {
- cell.classList.add(WebInspector.TimelineTabContentView.iconClassNameForRecord(this.records[0]));
+ cell.classList.add(...this.iconClassNames());
return this._createNameCellContent(cell);
}
@@ -68,7 +68,7 @@
return null;
let fragment = document.createDocumentFragment();
- let mainTitle = WebInspector.TimelineTabContentView.displayNameForRecord(this.records[0]);
+ let mainTitle = this.displayName();
fragment.append(mainTitle);
let sourceCodeLocation = this._sourceCodeTimeline.sourceCodeLocation;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -42,6 +42,11 @@
// Public
+ get record()
+ {
+ return this.records && this.records.length ? this.records[0] : null;;
+ }
+
get records()
{
// Implemented by subclasses.
@@ -308,6 +313,18 @@
this._scheduledGraphRefreshIdentifier = requestAnimationFrame(this.refreshGraph.bind(this));
}
+ displayName()
+ {
+ // Can be overridden by subclasses.
+ return WebInspector.TimelineTabContentView.displayNameForRecord(this.record);
+ }
+
+ iconClassNames()
+ {
+ // Can be overridden by subclasses.
+ return [WebInspector.TimelineTabContentView.iconClassNameForRecord(this.record)];
+ }
+
// Protected
createGoToArrowButton(cellElement, callback)
Copied: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js (from rev 197908, trunk/Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNodePathComponent.js) (0 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNodePathComponent.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 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.TimelineDataGridNodePathComponent = class TimelineDataGridNodePathComponent extends WebInspector.HierarchicalPathComponent
+{
+ constructor(timelineDataGridNode, representedObject)
+ {
+ super(timelineDataGridNode.displayName(), timelineDataGridNode.iconClassNames(), representedObject || timelineDataGridNode.record);
+
+ this._timelineDataGridNode = timelineDataGridNode;
+ }
+
+ // Public
+
+ get timelineDataGridNode()
+ {
+ return this._timelineDataGridNode;
+ }
+
+ get previousSibling()
+ {
+ let previousSibling = this._timelineDataGridNode.previousSibling;
+ while (previousSibling && previousSibling.hidden)
+ previousSibling = previousSibling.previousSibling;
+
+ if (!previousSibling)
+ return null;
+
+ return new WebInspector.TimelineDataGridNodePathComponent(previousSibling, this.representedObject);
+ }
+
+ get nextSibling()
+ {
+ let nextSibling = this._timelineDataGridNode.nextSibling;
+ while (nextSibling && nextSibling.hidden)
+ nextSibling = nextSibling.nextSibling;
+
+ if (!nextSibling)
+ return null;
+
+ return new WebInspector.TimelineDataGridNodePathComponent(nextSibling, this.representedObject);
+ }
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js (197908 => 197909)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js 2016-03-10 01:37:35 UTC (rev 197908)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineView.js 2016-03-10 01:38:03 UTC (rev 197909)
@@ -80,12 +80,8 @@
get selectionPathComponents()
{
- if (!this._contentTreeOutline.selectedTreeElement || this._contentTreeOutline.selectedTreeElement.hidden)
- return null;
-
- var pathComponent = new WebInspector.GeneralTreeElementPathComponent(this._contentTreeOutline.selectedTreeElement);
- pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this.treeElementPathComponentSelected, this);
- return [pathComponent];
+ // Implemented by sub-classes if needed.
+ return null;
}
get zeroTime()