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

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

Issue 2536723003: [Devtools] Removed DataGrid's hasChildren getter/setter to use functions (Closed)
Patch Set: Created 4 years, 1 month 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/ui_lazy/DataGrid.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/DataGrid.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/DataGrid.js
index 4ea0f932bace64b895460d474250c8a2ac5f7ec9..675221b5aae3a41004f02d9f479dcbcba3ca0d6d 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/DataGrid.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/DataGrid.js
@@ -267,7 +267,7 @@ UI.DataGrid = class extends Common.Object {
/** @type {!UI.DataGridNode} */
this._rootNode = rootNode;
rootNode._isRoot = true;
- rootNode.hasChildren = false;
+ rootNode.setHasChildren(false);
rootNode._expanded = true;
rootNode._revealed = true;
rootNode.selectable = false;
@@ -805,7 +805,7 @@ UI.DataGrid = class extends Common.Object {
if (!this.selectedNode.revealed) {
this.selectedNode.reveal();
handled = true;
- } else if (this.selectedNode.hasChildren) {
+ } else if (this.selectedNode.hasChildren()) {
handled = true;
if (this.selectedNode.expanded) {
nextSelectedNode = this.selectedNode.children[0];
@@ -1009,7 +1009,7 @@ UI.DataGrid = class extends Common.Object {
*/
_clickInDataTable(event) {
var gridNode = this.dataGridNodeFromNode(/** @type {!Node} */ (event.target));
- if (!gridNode || !gridNode.hasChildren || !gridNode.isEventWithinDisclosureTriangle(event))
+ if (!gridNode || !gridNode.hasChildren() || !gridNode.isEventWithinDisclosureTriangle(event))
return;
if (gridNode.expanded) {
@@ -1225,7 +1225,7 @@ UI.DataGridNode = class extends Common.Object {
/** @type {!Object.<string, *>} */
this._data = data || {};
/** @type {boolean} */
- this.hasChildren = hasChildren || false;
+ this._hasChildren = hasChildren || false;
/** @type {!Array.<!UI.DataGridNode>} */
this.children = [];
/** @type {?UI.DataGrid} */
@@ -1264,7 +1264,7 @@ UI.DataGridNode = class extends Common.Object {
this._element = createElement('tr');
this._element._dataGridNode = this;
- if (this.hasChildren)
+ if (this._hasChildren)
this._element.classList.add('parent');
if (this.expanded)
this._element.classList.add('expanded');
@@ -1340,14 +1340,14 @@ UI.DataGridNode = class extends Common.Object {
/**
* @return {boolean}
*/
- get hasChildren() {
+ hasChildren() {
return this._hasChildren;
}
/**
* @param {boolean} x
*/
- set hasChildren(x) {
+ setHasChildren(x) {
if (this._hasChildren === x)
return;
@@ -1524,7 +1524,7 @@ UI.DataGridNode = class extends Common.Object {
child.remove();
this.children.splice(index, 0, child);
- this.hasChildren = true;
+ this.setHasChildren(true);
child.parent = this;
child.dataGrid = this.dataGrid;
@@ -1582,7 +1582,7 @@ UI.DataGridNode = class extends Common.Object {
child.previousSibling = null;
if (this.children.length <= 0)
- this.hasChildren = false;
+ this.setHasChildren(false);
}
removeChildren() {
@@ -1598,7 +1598,7 @@ UI.DataGridNode = class extends Common.Object {
}
this.children = [];
- this.hasChildren = false;
+ this.setHasChildren(false);
}
/**
@@ -1644,7 +1644,7 @@ UI.DataGridNode = class extends Common.Object {
}
expand() {
- if (!this.hasChildren || this.expanded)
+ if (!this._hasChildren || this.expanded)
return;
if (this._isRoot)
return;
@@ -1751,7 +1751,7 @@ UI.DataGridNode = class extends Common.Object {
* @return {?UI.DataGridNode}
*/
traverseNextNode(skipHidden, stayWithin, dontPopulate, info) {
- if (!dontPopulate && this.hasChildren)
+ if (!dontPopulate && this._hasChildren)
this.populate();
if (info)
@@ -1792,12 +1792,12 @@ UI.DataGridNode = class extends Common.Object {
*/
traversePreviousNode(skipHidden, dontPopulate) {
var node = (!skipHidden || this.revealed) ? this.previousSibling : null;
- if (!dontPopulate && node && node.hasChildren)
+ if (!dontPopulate && node && node._hasChildren)
node.populate();
while (node &&
((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null)) {
- if (!dontPopulate && node.hasChildren)
+ if (!dontPopulate && node._hasChildren)
node.populate();
node = ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null);
}
@@ -1816,7 +1816,7 @@ UI.DataGridNode = class extends Common.Object {
* @return {boolean}
*/
isEventWithinDisclosureTriangle(event) {
- if (!this.hasChildren)
+ if (!this._hasChildren)
return false;
var cell = event.target.enclosingNodeOrSelfWithNodeName('td');
if (!cell || !cell.classList.contains('disclosure'))

Powered by Google App Engine
This is Rietveld 408576698