Index: Source/devtools/front_end/ui/ViewportDataGrid.js |
diff --git a/Source/devtools/front_end/ui/ViewportDataGrid.js b/Source/devtools/front_end/ui/ViewportDataGrid.js |
index 593ac15693060187624526837a90ab4270f285d6..09018bb759f3682af12eb175190ac0adb093f296 100644 |
--- a/Source/devtools/front_end/ui/ViewportDataGrid.js |
+++ b/Source/devtools/front_end/ui/ViewportDataGrid.js |
@@ -44,7 +44,8 @@ WebInspector.ViewportDataGrid.prototype = { |
/** |
* @protected |
*/ |
- scheduleUpdate: function() { |
+ scheduleUpdate: function() |
+ { |
if (this._updateScheduled) |
return; |
this._updateScheduled = true; |
@@ -120,6 +121,28 @@ WebInspector.ViewportDataGrid.prototype = { |
this._visibleNodes = visibleNodes; |
}, |
+ /** |
+ * @param {!WebInspector.ViewportDataGridNode} node |
+ */ |
+ _revealViewportNode: function(node) |
+ { |
+ var nodes = this._rootNode.children; |
+ var index = nodes.indexOf(node); |
+ if (index === -1) |
+ return; |
+ var fromY = 0; |
+ for (var i = 0; i < index; ++i) |
+ fromY += nodes[i].nodeSelfHeight(); |
+ var toY = fromY + node.nodeSelfHeight(); |
+ |
+ var scrollTop = this._scrollContainer.scrollTop; |
+ if (scrollTop > fromY) |
lushnikov
2014/08/13 19:50:25
if (this._visibleNodes.indexOf(node) !== -1)
ret
|
+ scrollTop = fromY; |
+ else if (scrollTop + this._scrollContainer.offsetHeight < toY) |
+ scrollTop = toY - this._scrollContainer.offsetHeight; |
+ this._scrollContainer.scrollTop = scrollTop; |
+ }, |
+ |
__proto__: WebInspector.DataGrid.prototype |
} |
@@ -163,6 +186,7 @@ WebInspector.ViewportDataGridNode.prototype = { |
*/ |
insertChild: function(child, index) |
{ |
+ child.parent = this; |
child.dataGrid = this.dataGrid; |
this.children.splice(index, 0, child); |
child.recalculateSiblings(index); |
@@ -218,5 +242,11 @@ WebInspector.ViewportDataGridNode.prototype = { |
} |
}, |
+ reveal: function() |
+ { |
+ this.dataGrid._revealViewportNode(this); |
+ WebInspector.DataGridNode.prototype.reveal.call(this); |
+ }, |
+ |
__proto__: WebInspector.DataGridNode.prototype |
} |