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

Side by Side Diff: Source/devtools/front_end/elements/ElementsTreeOutline.js

Issue 614323003: DevTools: enable by default disableAgentsWhenProfile experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: unnecessary line was removed Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 return this._expandedChildrenLimit; 1133 return this._expandedChildrenLimit;
1134 }, 1134 },
1135 1135
1136 set expandedChildrenLimit(x) 1136 set expandedChildrenLimit(x)
1137 { 1137 {
1138 if (this._expandedChildrenLimit === x) 1138 if (this._expandedChildrenLimit === x)
1139 return; 1139 return;
1140 1140
1141 this._expandedChildrenLimit = x; 1141 this._expandedChildrenLimit = x;
1142 if (this.treeOutline && !this._updateChildrenInProgress) 1142 if (this.treeOutline && !this._updateChildrenInProgress)
1143 this._updateChildren(true); 1143 this._updateChildren(true, this.children);
1144 }, 1144 },
1145 1145
1146 get expandedChildCount() 1146 get expandedChildCount()
1147 { 1147 {
1148 var count = this.children.length; 1148 var count = this.children.length;
1149 if (count && this.children[count - 1]._elementCloseTag) 1149 if (count && this.children[count - 1]._elementCloseTag)
1150 count--; 1150 count--;
1151 if (count && this.children[count - 1].expandAllButton) 1151 if (count && this.children[count - 1].expandAllButton)
1152 count--; 1152 count--;
1153 return count; 1153 return count;
1154 }, 1154 },
1155 1155
1156 /** 1156 /**
1157 * @param {!WebInspector.DOMNode} child 1157 * @param {!WebInspector.DOMNode} child
1158 * @return {?WebInspector.ElementsTreeElement} 1158 * @return {?WebInspector.ElementsTreeElement}
1159 */ 1159 */
1160 _showChild: function(child) 1160 _showChild: function(child)
1161 { 1161 {
1162 if (this._elementCloseTag) 1162 if (this._elementCloseTag)
1163 return null; 1163 return null;
1164 1164
1165 var index = this._visibleChildren().indexOf(child); 1165 var index = this._visibleChildren().indexOf(child);
1166 if (index === -1) 1166 if (index === -1)
1167 return null; 1167 return null;
1168 1168
1169 if (index >= this.expandedChildrenLimit) { 1169 if (index >= this.expandedChildrenLimit) {
1170 this._expandedChildrenLimit = index + 1; 1170 this._expandedChildrenLimit = index + 1;
1171 this._updateChildren(true); 1171 this._updateChildren(true, this.children);
1172 } 1172 }
1173 1173
1174 // Whether index-th child is visible in the children tree 1174 // Whether index-th child is visible in the children tree
1175 return this.expandedChildCount > index ? this.children[index] : null; 1175 return this.expandedChildCount > index ? this.children[index] : null;
1176 }, 1176 },
1177 1177
1178 updateSelection: function() 1178 updateSelection: function()
1179 { 1179 {
1180 var listItemElement = this.listItemElement; 1180 var listItemElement = this.listItemElement;
1181 if (!listItemElement) 1181 if (!listItemElement)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 }, 1232 },
1233 1233
1234 /** 1234 /**
1235 * @param {boolean=} fullRefresh 1235 * @param {boolean=} fullRefresh
1236 */ 1236 */
1237 updateChildren: function(fullRefresh) 1237 updateChildren: function(fullRefresh)
1238 { 1238 {
1239 if (!this.hasChildren) 1239 if (!this.hasChildren)
1240 return; 1240 return;
1241 console.assert(!this._elementCloseTag); 1241 console.assert(!this._elementCloseTag);
1242 this._node.getChildNodes(this._updateChildren.bind(this, fullRefresh)); 1242 this._node.getChildNodes(this._updateChildren.bind(this, fullRefresh || false));
1243 }, 1243 },
1244 1244
1245 /** 1245 /**
1246 * @param {!WebInspector.DOMNode} child 1246 * @param {!WebInspector.DOMNode} child
1247 * @param {number} index 1247 * @param {number} index
1248 * @param {boolean=} closingTag 1248 * @param {boolean=} closingTag
1249 * @return {!WebInspector.ElementsTreeElement} 1249 * @return {!WebInspector.ElementsTreeElement}
1250 */ 1250 */
1251 insertChildElement: function(child, index, closingTag) 1251 insertChildElement: function(child, index, closingTag)
1252 { 1252 {
1253 var newElement = new WebInspector.ElementsTreeElement(child, closingTag) ; 1253 var newElement = new WebInspector.ElementsTreeElement(child, closingTag) ;
1254 newElement.selectable = this.treeOutline._selectEnabled; 1254 newElement.selectable = this.treeOutline._selectEnabled;
1255 this.insertChild(newElement, index); 1255 this.insertChild(newElement, index);
1256 return newElement; 1256 return newElement;
1257 }, 1257 },
1258 1258
1259 moveChild: function(child, targetIndex) 1259 moveChild: function(child, targetIndex)
1260 { 1260 {
1261 var wasSelected = child.selected; 1261 var wasSelected = child.selected;
1262 this.removeChild(child); 1262 this.removeChild(child);
1263 this.insertChild(child, targetIndex); 1263 this.insertChild(child, targetIndex);
1264 if (wasSelected) 1264 if (wasSelected)
1265 child.select(); 1265 child.select();
1266 }, 1266 },
1267 1267
1268 /** 1268 /**
1269 * @param {boolean=} fullRefresh 1269 * @param {boolean} fullRefresh
1270 * @param {?Array.<!WebInspector.DOMNode>} children
1270 */ 1271 */
1271 _updateChildren: function(fullRefresh) 1272 _updateChildren: function(fullRefresh, children)
1272 { 1273 {
1273 if (this._updateChildrenInProgress || !this.treeOutline._visible) 1274 if (!children || this._updateChildrenInProgress || !this.treeOutline._vi sible)
pfeldman 2014/11/12 17:19:39 Could reviewers explain why this is needed here?
1274 return; 1275 return;
1275 1276
1276 this._updateChildrenInProgress = true; 1277 this._updateChildrenInProgress = true;
1277 var selectedNode = this.treeOutline.selectedDOMNode(); 1278 var selectedNode = this.treeOutline.selectedDOMNode();
1278 var originalScrollTop = 0; 1279 var originalScrollTop = 0;
1279 if (fullRefresh) { 1280 if (fullRefresh) {
1280 var treeOutlineContainerElement = this.treeOutline.element.parentNod e; 1281 var treeOutlineContainerElement = this.treeOutline.element.parentNod e;
1281 originalScrollTop = treeOutlineContainerElement.scrollTop; 1282 originalScrollTop = treeOutlineContainerElement.scrollTop;
1282 var selectedTreeElement = this.treeOutline.selectedTreeElement; 1283 var selectedTreeElement = this.treeOutline.selectedTreeElement;
1283 if (selectedTreeElement && selectedTreeElement.hasAncestor(this)) 1284 if (selectedTreeElement && selectedTreeElement.hasAncestor(this))
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 treeOutline.rootDOMNode = node; 2951 treeOutline.rootDOMNode = node;
2951 if (!treeOutline.children[0].hasChildren) 2952 if (!treeOutline.children[0].hasChildren)
2952 treeOutline._element.classList.add("single-node"); 2953 treeOutline._element.classList.add("single-node");
2953 treeOutline.setVisible(true); 2954 treeOutline.setVisible(true);
2954 treeOutline.element.treeElementForTest = treeOutline.children[0] ; 2955 treeOutline.element.treeElementForTest = treeOutline.children[0] ;
2955 resolve(treeOutline.element); 2956 resolve(treeOutline.element);
2956 } 2957 }
2957 } 2958 }
2958 } 2959 }
2959 } 2960 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/components/InspectorView.js ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698