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

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

Issue 2894083002: [DevTools] Set row background instead of the table (Closed)
Patch Set: Fixed a comment Created 3 years, 7 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
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 f6c76505aabecdc7a887e78c322976a75c3580f4..f55ea6c45297ae574c206499b9a0e02d09759bd3 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
@@ -27,11 +27,34 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid {
this._updateIsFromUser = false;
this._lastScrollTop = 0;
this._firstVisibleIsStriped = false;
+ this._isStriped = false;
this.setRootNode(new DataGrid.ViewportDataGridNode());
}
/**
+ * @param {boolean} striped
+ * @override
+ */
+ setStriped(striped) {
+ this._isStriped = striped;
+ var startsWithOdd = true;
+ if (this._visibleNodes.length) {
+ var allChildren = this.rootNode().flatChildren();
+ startsWithOdd = !!(allChildren.indexOf(this._visibleNodes[0]));
+ }
+ this._updateStripesClass(startsWithOdd);
+ }
+
+ /**
+ * @param {boolean} startsWithOdd
+ */
+ _updateStripesClass(startsWithOdd) {
+ this.element.classList.toggle('striped-data-grid', !startsWithOdd && this._isStriped);
+ this.element.classList.toggle('striped-data-grid-starts-with-odd', startsWithOdd && this._isStriped);
+ }
+
+ /**
* @param {!Element} scrollContainer
*/
setScrollContainer(scrollContainer) {
@@ -182,6 +205,7 @@ DataGrid.ViewportDataGrid = class extends DataGrid.DataGrid {
if (visibleNodes.length) {
var nodes = this.rootNode().flatChildren();
var index = nodes.indexOf(visibleNodes[0]);
+ this._updateStripesClass(!!(index % 2));
if (index !== -1 && !!(index % 2) !== this._firstVisibleIsStriped)
offset += 1;
}

Powered by Google App Engine
This is Rietveld 408576698