Skip to content
Permalink
Browse files
Web Inspector: Error when selecting a bar in the Frames timeline
https://bugs.webkit.org/show_bug.cgi?id=156960
<rdar://problem/25897955>

Reviewed by Timothy Hatcher.

Fixes timeline grid node selection when record selected in the overview.
Adds general purpose `findNode` method to DataGrid.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.findNode):
Basic find function for locating a grid node in linear time.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype._recordSelected):
Remove tree outline references, call generic select method.

* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView.prototype.selectRecord):
If a data grid was set, deselect current selection and select the node
associated with the timeline record.


Canonical link: https://commits.webkit.org/175074@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199972 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
LuckyKobold committed Apr 25, 2016
1 parent 2bf5f3d commit a99bb492e9feb07acfdc33ac3d17a95c63f2d61a
@@ -1,3 +1,27 @@
2016-04-24 Matt Baker <mattbaker@apple.com>

Web Inspector: Error when selecting a bar in the Frames timeline
https://bugs.webkit.org/show_bug.cgi?id=156960
<rdar://problem/25897955>

Reviewed by Timothy Hatcher.

Fixes timeline grid node selection when record selected in the overview.
Adds general purpose `findNode` method to DataGrid.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.findNode):
Basic find function for locating a grid node in linear time.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype._recordSelected):
Remove tree outline references, call generic select method.

* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView.prototype.selectRecord):
If a data grid was set, deselect current selection and select the node
associated with the timeline record.

2016-04-24 Matt Baker <mattbaker@apple.com>

Web Inspector: Events in JavaScript & Events timeline have no profile children
@@ -1042,6 +1042,23 @@ WebInspector.DataGrid = class DataGrid extends WebInspector.View
this.children = [];
}

findNode(comparator, skipHidden, stayWithin, dontPopulate)
{
console.assert(typeof comparator === "function");

let currentNode = this._rows[0];
while (currentNode && !currentNode.root) {
if (!currentNode.isPlaceholderNode && !(skipHidden && currentNode.hidden)) {
if (comparator(currentNode))
return currentNode;
}

currentNode = currentNode.traverseNextNode(skipHidden, stayWithin, dontPopulate);
}

return null;
}

sortNodes(comparator)
{
if (this._sortNodesRequestId)
@@ -715,28 +715,12 @@ WebInspector.TimelineRecordingContentView = class TimelineRecordingContentView e

_recordSelected(event)
{
var timelineView = this._timelineViewMap.get(event.data.timeline);
let timelineView = this._timelineViewMap.get(event.data.timeline);
console.assert(timelineView === this.currentTimelineView, timelineView);
if (timelineView !== this.currentTimelineView)
return;

var selectedTreeElement = this.currentTimelineView.navigationSidebarTreeOutline.selectedTreeElement;
if (!event.data.record) {
if (selectedTreeElement)
selectedTreeElement.deselect();
return;
}

var treeElement = this.currentTimelineView.navigationSidebarTreeOutline.findTreeElement(event.data.record);
console.assert(treeElement, "Timeline view has no tree element for record selected in timeline overview.", timelineView, event.data.record);
if (!treeElement || treeElement.selected)
return;

// Don't select the record's tree element if one of it's children is already selected.
if (selectedTreeElement && selectedTreeElement.hasAncestor(treeElement))
return;

treeElement.revealAndSelect(false, false, false, true);
timelineView.selectRecord(event.data.record);
}

_timelineSelected()
@@ -142,6 +142,30 @@ WebInspector.TimelineView = class TimelineView extends WebInspector.ContentView
// Implemented by sub-classes if needed.
}

selectRecord(record)
{
if (!this._timelineDataGrid)
return;

let selectedDataGridNode = this._timelineDataGrid.selectedNode;
if (!record) {
if (selectedDataGridNode)
selectedDataGridNode.deselect();
return;
}

let dataGridNode = this._timelineDataGrid.findNode((node) => node.record === record);
console.assert(dataGridNode, "Timeline view has no grid node for record selected in timeline overview.", this, record);
if (!dataGridNode || dataGridNode.selected)
return;

// Don't select the record's grid node if one of it's children is already selected.
if (selectedDataGridNode && selectedDataGridNode.hasAncestor(dataGridNode))
return;

dataGridNode.revealAndSelect();
}

matchTreeElementAgainstCustomFilters(treeElement)
{
// Implemented by sub-classes if needed.

0 comments on commit a99bb49

Please sign in to comment.