Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui_lazy/ViewportDataGrid.js

Issue 2523633003: [Devtools] Prepare network log view for grouping support (Closed)
Patch Set: fixed request === null and possible filter out issue Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui_lazy/ViewportDataGrid.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/ViewportDataGrid.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/ViewportDataGrid.js
index d75c69b911fb04057c98b33f68d675f086410e68..ec3b5c89214bef6384252fd81fe4f539eed4ac08 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/ViewportDataGrid.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/ViewportDataGrid.js
@@ -122,7 +122,7 @@ UI.ViewportDataGrid = class extends UI.DataGrid {
* @return {{topPadding: number, bottomPadding: number, contentHeight: number, visibleNodes: !Array.<!UI.ViewportDataGridNode>, offset: number}}
*/
_calculateVisibleNodes(clientHeight, scrollTop) {
- var nodes = this.rootNode().flattenChildren();
+ var nodes = (/** @type {!UI.ViewportDataGridNode} */ (this.rootNode())).flattenChildren();
if (this._inline)
return {topPadding: 0, bottomPadding: 0, contentHeight: 0, visibleNodes: nodes, offset: 0};
@@ -156,7 +156,7 @@ UI.ViewportDataGrid = class extends UI.DataGrid {
* @return {number}
*/
_contentHeight() {
- var nodes = this.rootNode().flattenChildren();
+ var nodes = (/** @type {!UI.ViewportDataGridNode} */ (this.rootNode())).flattenChildren();
var result = 0;
for (var i = 0, size = nodes.length; i < size; ++i)
result += nodes[i].nodeSelfHeight();
@@ -232,7 +232,7 @@ UI.ViewportDataGrid = class extends UI.DataGrid {
* @param {!UI.ViewportDataGridNode} node
*/
_revealViewportNode(node) {
- var nodes = this.rootNode().flattenChildren();
+ var nodes = (/** @type {!UI.ViewportDataGridNode} */ (this.rootNode())).flattenChildren();
var index = nodes.indexOf(node);
if (index === -1)
return;
@@ -270,6 +270,8 @@ UI.ViewportDataGridNode = class extends UI.DataGridNode {
this._stale = false;
/** @type {?Array<!UI.ViewportDataGridNode>} */
this._flatNodes = null;
+ /** @type {?Array<!UI.ViewportDataGridNode>} */
+ this._flatVisibleNodes = null;
}
/**
@@ -292,6 +294,7 @@ UI.ViewportDataGridNode = class extends UI.DataGridNode {
}
_clearFlatNodes() {
+ this._flatVisibleNodes = null;
this._flatNodes = null;
var parent = /** @type {!UI.ViewportDataGridNode} */ (this.parent);
if (parent)
@@ -299,12 +302,15 @@ UI.ViewportDataGridNode = class extends UI.DataGridNode {
}
/**
+ * @param {boolean=} includeCollapsed
* @return {!Array<!UI.ViewportDataGridNode>}
*/
- flattenChildren() {
- if (this._flatNodes)
+ flattenChildren(includeCollapsed) {
+ if (!includeCollapsed && this._flatVisibleNodes)
+ return this._flatVisibleNodes;
+ if (includeCollapsed && this._flatNodes)
return this._flatNodes;
- var flatNodes = [];
+ var nodesList = [];
var children = [this.children];
var counters = [0];
var depth = 0;
@@ -314,17 +320,19 @@ UI.ViewportDataGridNode = class extends UI.DataGridNode {
depth--;
continue;
}
- flatNodes.push(node);
+ nodesList.push(node);
node.setDepth(depth);
- if (node._expanded && node.children.length) {
+ if ((includeCollapsed || node._expanded) && node.children.length) {
depth++;
children[depth] = node.children;
counters[depth] = 0;
}
}
-
- this._flatNodes = flatNodes;
- return flatNodes;
+ if (includeCollapsed)
+ this._flatNodes = nodesList;
+ else
+ this._flatVisibleNodes = nodesList;
+ return nodesList;
}
/**
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698