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

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

Issue 2647803002: [Devtools] Fixed network to sort items as they are received. (Closed)
Patch Set: changes Created 3 years, 11 months 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 | « no previous file | third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js
diff --git a/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js b/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js
index 43ebc1ab31586fdf0875fb524151995fc298c4f2..200c37a2bf07434eacc3a478873adcd3bb768e23 100644
--- a/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js
+++ b/third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js
@@ -40,6 +40,7 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid {
this._atBottom = true;
/** @type {number} */
this._lastScrollTop = 0;
+ this._firstVisibleIsStriped = false;
this.setRootNode(new DataGrid.ViewportDataGridNode());
}
@@ -203,11 +204,21 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid {
previousElement = this._hiddenWheelTarget;
var tBody = this.dataTableBody;
var offset = viewportState.offset;
+
+ if (visibleNodes.length) {
+ var nodes = this.rootNode().flatChildren();
+ var index = nodes.indexOf(visibleNodes[0]);
+ if (index !== -1 && !!(index % 2) !== this._firstVisibleIsStriped)
+ offset += 1;
+ }
+
+ this._firstVisibleIsStriped = !!(offset % 2);
+
for (var i = 0; i < visibleNodes.length; ++i) {
var node = visibleNodes[i];
var element = node.element();
node.willAttach();
- element.classList.toggle('odd', (offset + i) % 2 === 0);
+ node.setStriped((offset + i) % 2 === 0);
tBody.insertBefore(element, previousElement.nextSibling);
node.revealed = true;
previousElement = element;
@@ -272,6 +283,7 @@ DataGrid.ViewportDataGridNode = class extends DataGrid.DataGridNode {
this._stale = false;
/** @type {?Array<!DataGrid.ViewportDataGridNode>} */
this._flatNodes = null;
+ this._isStriped = false;
}
/**
@@ -288,6 +300,21 @@ DataGrid.ViewportDataGridNode = class extends DataGrid.DataGridNode {
return element;
}
+ /**
+ * @param {boolean} isStriped
+ */
+ setStriped(isStriped) {
+ this._isStriped = isStriped;
+ this.element().classList.toggle('odd', isStriped);
+ }
+
+ /**
+ * @return {boolean}
+ */
+ isStriped() {
+ return this._isStriped;
+ }
+
_clearFlatNodes() {
this._flatNodes = null;
var parent = /** @type {!DataGrid.ViewportDataGridNode} */ (this.parent);
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698