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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js

Issue 1592973002: Devtools: Fix auto-expanding of arrays and function scopes in watches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 if (property.startsWith(id + ":")) 1275 if (property.startsWith(id + ":"))
1276 this._expandedProperties.delete(property); 1276 this._expandedProperties.delete(property);
1277 } 1277 }
1278 }, 1278 },
1279 1279
1280 /** 1280 /**
1281 * @param {!WebInspector.Event} event 1281 * @param {!WebInspector.Event} event
1282 */ 1282 */
1283 _elementAttached: function(event) 1283 _elementAttached: function(event)
1284 { 1284 {
1285 var element = /** @type {!WebInspector.ObjectPropertyTreeElement|!WebIns pector.ObjectPropertiesSection.RootElement} */ (event.data); 1285 var element = /** @type {!TreeElement} */ (event.data);
1286 if (element.isExpandable() && this._expandedProperties.has(this._propert yPath(element))) 1286 if (element.isExpandable() && this._expandedProperties.has(this._propert yPath(element)))
1287 element.expand(); 1287 element.expand();
1288 }, 1288 },
1289 1289
1290 /** 1290 /**
1291 * @param {!WebInspector.Event} event 1291 * @param {!WebInspector.Event} event
1292 */ 1292 */
1293 _elementExpanded: function(event) 1293 _elementExpanded: function(event)
1294 { 1294 {
1295 var element = /** @type {!WebInspector.ObjectPropertyTreeElement|!WebIns pector.ObjectPropertiesSection.RootElement} */ (event.data); 1295 var element = /** @type {!TreeElement} */ (event.data);
1296 this._expandedProperties.add(this._propertyPath(element)); 1296 this._expandedProperties.add(this._propertyPath(element));
1297 }, 1297 },
1298 1298
1299 /** 1299 /**
1300 * @param {!WebInspector.Event} event 1300 * @param {!WebInspector.Event} event
1301 */ 1301 */
1302 _elementCollapsed: function(event) 1302 _elementCollapsed: function(event)
1303 { 1303 {
1304 var element = /** @type {!WebInspector.ObjectPropertyTreeElement|!WebIns pector.ObjectPropertiesSection.RootElement} */ (event.data); 1304 var element = /** @type {!TreeElement} */ (event.data);
1305 this._expandedProperties.delete(this._propertyPath(element)); 1305 this._expandedProperties.delete(this._propertyPath(element));
1306 }, 1306 },
1307 1307
1308 /** 1308 /**
1309 * @param {!WebInspector.ObjectPropertyTreeElement|!WebInspector.ObjectPrope rtiesSection.RootElement} treeElement 1309 * @param {!TreeElement} treeElement
1310 * @return {string} 1310 * @return {string}
1311 */ 1311 */
1312 _propertyPath: function(treeElement) 1312 _propertyPath: function(treeElement)
1313 { 1313 {
1314 var cachedPropertyPath = treeElement[WebInspector.ObjectPropertiesSectio nExpandController._cachedPathSymbol]; 1314 var cachedPropertyPath = treeElement[WebInspector.ObjectPropertiesSectio nExpandController._cachedPathSymbol];
1315 if (cachedPropertyPath) 1315 if (cachedPropertyPath)
1316 return cachedPropertyPath; 1316 return cachedPropertyPath;
1317 1317
1318 var current = treeElement; 1318 var current = treeElement;
1319 var rootElement = treeElement.treeOutline.objectTreeElement(); 1319 var rootElement = treeElement.treeOutline.objectTreeElement();
1320 1320
1321 var result; 1321 var result;
1322 1322
1323 while (current !== rootElement) { 1323 while (current !== rootElement) {
1324 result = current.property.name + (result ? "." + result : ""); 1324 var currentName = "";
1325 if (current.property)
1326 currentName = current.property.name;
1327 else
1328 currentName = typeof current.title === "string" ? current.title : current.title.textContent;
1329
1330 result = currentName + (result ? "." + result : "");
1325 current = current.parent; 1331 current = current.parent;
1326 } 1332 }
1327 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; 1333 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId];
1328 result = treeOutlineId + (result ? ":" + result : ""); 1334 result = treeOutlineId + (result ? ":" + result : "");
1329 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; 1335 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result;
1330 return result; 1336 return result;
1331 } 1337 }
1332 } 1338 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698