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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js

Issue 2716993002: [Devtools] Change logic of DataGrid's padding-left for grouping (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 /** @type {?DataGrid.DataGrid} */ 1257 /** @type {?DataGrid.DataGrid} */
1258 this.dataGrid = null; 1258 this.dataGrid = null;
1259 /** @type {?NODE_TYPE} */ 1259 /** @type {?NODE_TYPE} */
1260 this._parent = null; 1260 this._parent = null;
1261 /** @type {?NODE_TYPE} */ 1261 /** @type {?NODE_TYPE} */
1262 this.previousSibling = null; 1262 this.previousSibling = null;
1263 /** @type {?NODE_TYPE} */ 1263 /** @type {?NODE_TYPE} */
1264 this.nextSibling = null; 1264 this.nextSibling = null;
1265 /** @type {number} */ 1265 /** @type {number} */
1266 this.disclosureToggleWidth = 10; 1266 this.disclosureToggleWidth = 10;
1267 /** @type {?Element} */
1268 this._disclosureCell = null;
1267 1269
1268 /** @type {boolean} */ 1270 /** @type {boolean} */
1269 this.selectable = true; 1271 this.selectable = true;
1270 1272
1271 /** @type {boolean} */ 1273 /** @type {boolean} */
1272 this._isRoot = false; 1274 this._isRoot = false;
1273 } 1275 }
1274 1276
1275 /** 1277 /**
1276 * @return {!Element} 1278 * @return {!Element}
1277 */ 1279 */
1278 element() { 1280 element() {
1279 if (!this._element) { 1281 if (!this._element) {
1280 var element = this.createElement(); 1282 var element = this.createElement();
1281 this.createCells(element); 1283 this.createCells(element);
1282 } 1284 }
1283 return /** @type {!Element} */ (this._element); 1285 return /** @type {!Element} */ (this._element);
1284 } 1286 }
1285 1287
1286 /** 1288 /**
1289 * @return {?Element}
1290 */
1291 disclosureCell() {
1292 return this._disclosureCell;
1293 }
1294
1295 /**
1287 * @protected 1296 * @protected
1288 * @return {!Element} 1297 * @return {!Element}
1289 */ 1298 */
1290 createElement() { 1299 createElement() {
1291 this._element = createElement('tr'); 1300 this._element = createElement('tr');
1292 this._element._dataGridNode = this; 1301 this._element._dataGridNode = this;
1293 1302
1294 if (this._hasChildren) 1303 if (this._hasChildren)
1295 this._element.classList.add('parent'); 1304 this._element.classList.add('parent');
1296 if (this.expanded) 1305 if (this.expanded)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 */ 1572 */
1564 createTD(columnId) { 1573 createTD(columnId) {
1565 var cell = this._createTDWithClass(columnId + '-column'); 1574 var cell = this._createTDWithClass(columnId + '-column');
1566 cell[DataGrid.DataGrid._columnIdSymbol] = columnId; 1575 cell[DataGrid.DataGrid._columnIdSymbol] = columnId;
1567 1576
1568 var alignment = this.dataGrid._columns[columnId].align; 1577 var alignment = this.dataGrid._columns[columnId].align;
1569 if (alignment) 1578 if (alignment)
1570 cell.classList.add(alignment); 1579 cell.classList.add(alignment);
1571 1580
1572 if (columnId === this.dataGrid.disclosureColumnId) { 1581 if (columnId === this.dataGrid.disclosureColumnId) {
1582 this._disclosureCell = cell;
1573 cell.classList.add('disclosure'); 1583 cell.classList.add('disclosure');
1574 if (this.leftPadding)
1575 cell.style.setProperty('padding-left', this.leftPadding + 'px');
1576 } 1584 }
1577 1585
1578 return cell; 1586 return cell;
1579 } 1587 }
1580 1588
1581 /** 1589 /**
1582 * @param {string} columnId 1590 * @param {string} columnId
1583 * @return {!Element} 1591 * @return {!Element}
1584 */ 1592 */
1585 createCell(columnId) { 1593 createCell(columnId) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 return false; 1938 return false;
1931 1939
1932 var left = cell.totalOffsetLeft() + this.leftPadding; 1940 var left = cell.totalOffsetLeft() + this.leftPadding;
1933 return event.pageX >= left && event.pageX <= left + this.disclosureToggleWid th; 1941 return event.pageX >= left && event.pageX <= left + this.disclosureToggleWid th;
1934 } 1942 }
1935 1943
1936 _attach() { 1944 _attach() {
1937 if (!this.dataGrid || this._attached) 1945 if (!this.dataGrid || this._attached)
1938 return; 1946 return;
1939 1947
1948 var leftPadding = this.leftPadding;
1949 if (leftPadding && this._disclosureCell)
1950 this._disclosureCell.style.setProperty('padding-left', leftPadding + 'px') ;
1951
1940 this._attached = true; 1952 this._attached = true;
1941 1953
1942 var previousNode = this.traversePreviousNode(true, true); 1954 var previousNode = this.traversePreviousNode(true, true);
1943 var previousElement = previousNode ? previousNode.element() : this.dataGrid. _topFillerRow; 1955 var previousElement = previousNode ? previousNode.element() : this.dataGrid. _topFillerRow;
1944 this.dataGrid.dataTableBody.insertBefore(this.element(), previousElement.nex tSibling); 1956 this.dataGrid.dataTableBody.insertBefore(this.element(), previousElement.nex tSibling);
1945 1957
1946 if (this.expanded) { 1958 if (this.expanded) {
1947 for (var i = 0; i < this.children.length; ++i) 1959 for (var i = 0; i < this.children.length; ++i)
1948 this.children[i]._attach(); 1960 this.children[i]._attach();
1949 } 1961 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 /** 2061 /**
2050 * @override 2062 * @override
2051 */ 2063 */
2052 detachChildWidgets() { 2064 detachChildWidgets() {
2053 super.detachChildWidgets(); 2065 super.detachChildWidgets();
2054 for (var dataGrid of this._dataGrids) 2066 for (var dataGrid of this._dataGrids)
2055 this.element.removeChild(dataGrid.element); 2067 this.element.removeChild(dataGrid.element);
2056 this._dataGrids = []; 2068 this._dataGrids = [];
2057 } 2069 }
2058 }; 2070 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/data_grid/ViewportDataGrid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698