OLD | NEW |
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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 /** | 27 /** |
28 * @unrestricted | 28 * @unrestricted |
29 */ | 29 */ |
30 Components.ObjectPropertiesSection = class extends TreeOutlineInShadow { | 30 Components.ObjectPropertiesSection = class extends UI.TreeOutlineInShadow { |
31 /** | 31 /** |
32 * @param {!SDK.RemoteObject} object | 32 * @param {!SDK.RemoteObject} object |
33 * @param {?string|!Element=} title | 33 * @param {?string|!Element=} title |
34 * @param {!Components.Linkifier=} linkifier | 34 * @param {!Components.Linkifier=} linkifier |
35 * @param {?string=} emptyPlaceholder | 35 * @param {?string=} emptyPlaceholder |
36 * @param {boolean=} ignoreHasOwnProperty | 36 * @param {boolean=} ignoreHasOwnProperty |
37 * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties | 37 * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties |
38 */ | 38 */ |
39 constructor(object, title, linkifier, emptyPlaceholder, ignoreHasOwnProperty,
extraProperties) { | 39 constructor(object, title, linkifier, emptyPlaceholder, ignoreHasOwnProperty,
extraProperties) { |
40 super(); | 40 super(); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 | 365 |
366 /** | 366 /** |
367 * @param {boolean} value | 367 * @param {boolean} value |
368 */ | 368 */ |
369 setEditable(value) { | 369 setEditable(value) { |
370 this._editable = value; | 370 this._editable = value; |
371 } | 371 } |
372 | 372 |
373 /** | 373 /** |
374 * @return {!TreeElement} | 374 * @return {!UI.TreeElement} |
375 */ | 375 */ |
376 objectTreeElement() { | 376 objectTreeElement() { |
377 return this._objectTreeElement; | 377 return this._objectTreeElement; |
378 } | 378 } |
379 | 379 |
380 enableContextMenu() { | 380 enableContextMenu() { |
381 this.element.addEventListener('contextmenu', this._contextMenuEventFired.bin
d(this), false); | 381 this.element.addEventListener('contextmenu', this._contextMenuEventFired.bin
d(this), false); |
382 } | 382 } |
383 | 383 |
384 _contextMenuEventFired(event) { | 384 _contextMenuEventFired(event) { |
385 var contextMenu = new UI.ContextMenu(event); | 385 var contextMenu = new UI.ContextMenu(event); |
386 contextMenu.appendApplicableItems(this._object); | 386 contextMenu.appendApplicableItems(this._object); |
387 contextMenu.show(); | 387 contextMenu.show(); |
388 } | 388 } |
389 | 389 |
390 titleLessMode() { | 390 titleLessMode() { |
391 this._objectTreeElement.listItemElement.classList.add('hidden'); | 391 this._objectTreeElement.listItemElement.classList.add('hidden'); |
392 this._objectTreeElement.childrenListElement.classList.add('title-less-mode')
; | 392 this._objectTreeElement.childrenListElement.classList.add('title-less-mode')
; |
393 this._objectTreeElement.expand(); | 393 this._objectTreeElement.expand(); |
394 } | 394 } |
395 }; | 395 }; |
396 | 396 |
397 /** @const */ | 397 /** @const */ |
398 Components.ObjectPropertiesSection._arrayLoadThreshold = 100; | 398 Components.ObjectPropertiesSection._arrayLoadThreshold = 100; |
399 | 399 |
400 | 400 |
401 /** | 401 /** |
402 * @unrestricted | 402 * @unrestricted |
403 */ | 403 */ |
404 Components.ObjectPropertiesSection.RootElement = class extends TreeElement { | 404 Components.ObjectPropertiesSection.RootElement = class extends UI.TreeElement { |
405 /** | 405 /** |
406 * @param {!SDK.RemoteObject} object | 406 * @param {!SDK.RemoteObject} object |
407 * @param {!Components.Linkifier=} linkifier | 407 * @param {!Components.Linkifier=} linkifier |
408 * @param {?string=} emptyPlaceholder | 408 * @param {?string=} emptyPlaceholder |
409 * @param {boolean=} ignoreHasOwnProperty | 409 * @param {boolean=} ignoreHasOwnProperty |
410 * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties | 410 * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties |
411 */ | 411 */ |
412 constructor(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraPr
operties) { | 412 constructor(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraPr
operties) { |
413 var contentElement = createElement('content'); | 413 var contentElement = createElement('content'); |
414 super(contentElement); | 414 super(contentElement); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 onpopulate() { | 472 onpopulate() { |
473 Components.ObjectPropertyTreeElement._populate( | 473 Components.ObjectPropertyTreeElement._populate( |
474 this, this._object, !!this.treeOutline._skipProto, this._linkifier, this
._emptyPlaceholder, | 474 this, this._object, !!this.treeOutline._skipProto, this._linkifier, this
._emptyPlaceholder, |
475 this._ignoreHasOwnProperty, this._extraProperties); | 475 this._ignoreHasOwnProperty, this._extraProperties); |
476 } | 476 } |
477 }; | 477 }; |
478 | 478 |
479 /** | 479 /** |
480 * @unrestricted | 480 * @unrestricted |
481 */ | 481 */ |
482 Components.ObjectPropertyTreeElement = class extends TreeElement { | 482 Components.ObjectPropertyTreeElement = class extends UI.TreeElement { |
483 /** | 483 /** |
484 * @param {!SDK.RemoteObjectProperty} property | 484 * @param {!SDK.RemoteObjectProperty} property |
485 * @param {!Components.Linkifier=} linkifier | 485 * @param {!Components.Linkifier=} linkifier |
486 */ | 486 */ |
487 constructor(property, linkifier) { | 487 constructor(property, linkifier) { |
488 // Pass an empty title, the title gets made later in onattach. | 488 // Pass an empty title, the title gets made later in onattach. |
489 super(); | 489 super(); |
490 | 490 |
491 this.property = property; | 491 this.property = property; |
492 this.toggleOnClick = true; | 492 this.toggleOnClick = true; |
493 this.selectable = false; | 493 this.selectable = false; |
494 /** @type {!Array.<!Object>} */ | 494 /** @type {!Array.<!Object>} */ |
495 this._highlightChanges = []; | 495 this._highlightChanges = []; |
496 this._linkifier = linkifier; | 496 this._linkifier = linkifier; |
497 } | 497 } |
498 | 498 |
499 /** | 499 /** |
500 * @param {!TreeElement} treeElement | 500 * @param {!UI.TreeElement} treeElement |
501 * @param {!SDK.RemoteObject} value | 501 * @param {!SDK.RemoteObject} value |
502 * @param {boolean} skipProto | 502 * @param {boolean} skipProto |
503 * @param {!Components.Linkifier=} linkifier | 503 * @param {!Components.Linkifier=} linkifier |
504 * @param {?string=} emptyPlaceholder | 504 * @param {?string=} emptyPlaceholder |
505 * @param {boolean=} flattenProtoChain | 505 * @param {boolean=} flattenProtoChain |
506 * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties | 506 * @param {!Array.<!SDK.RemoteObjectProperty>=} extraProperties |
507 * @param {!SDK.RemoteObject=} targetValue | 507 * @param {!SDK.RemoteObject=} targetValue |
508 */ | 508 */ |
509 static _populate( | 509 static _populate( |
510 treeElement, | 510 treeElement, |
(...skipping 27 matching lines...) Expand all Loading... |
538 treeElement, properties, internalProperties, skipProto, targetValue ||
value, linkifier, emptyPlaceholder); | 538 treeElement, properties, internalProperties, skipProto, targetValue ||
value, linkifier, emptyPlaceholder); |
539 } | 539 } |
540 | 540 |
541 if (flattenProtoChain) | 541 if (flattenProtoChain) |
542 value.getAllProperties(false, callback); | 542 value.getAllProperties(false, callback); |
543 else | 543 else |
544 SDK.RemoteObject.loadFromObjectPerProto(value, callback); | 544 SDK.RemoteObject.loadFromObjectPerProto(value, callback); |
545 } | 545 } |
546 | 546 |
547 /** | 547 /** |
548 * @param {!TreeElement} treeNode | 548 * @param {!UI.TreeElement} treeNode |
549 * @param {!Array.<!SDK.RemoteObjectProperty>} properties | 549 * @param {!Array.<!SDK.RemoteObjectProperty>} properties |
550 * @param {?Array.<!SDK.RemoteObjectProperty>} internalProperties | 550 * @param {?Array.<!SDK.RemoteObjectProperty>} internalProperties |
551 * @param {boolean} skipProto | 551 * @param {boolean} skipProto |
552 * @param {?SDK.RemoteObject} value | 552 * @param {?SDK.RemoteObject} value |
553 * @param {!Components.Linkifier=} linkifier | 553 * @param {!Components.Linkifier=} linkifier |
554 * @param {?string=} emptyPlaceholder | 554 * @param {?string=} emptyPlaceholder |
555 */ | 555 */ |
556 static populateWithProperties( | 556 static populateWithProperties( |
557 treeNode, | 557 treeNode, |
558 properties, | 558 properties, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 treeElement.expand(); | 601 treeElement.expand(); |
602 } | 602 } |
603 treeNode.appendChild(treeElement); | 603 treeNode.appendChild(treeElement); |
604 } | 604 } |
605 } | 605 } |
606 | 606 |
607 Components.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeNod
e, emptyPlaceholder); | 607 Components.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeNod
e, emptyPlaceholder); |
608 } | 608 } |
609 | 609 |
610 /** | 610 /** |
611 * @param {!TreeElement} treeNode | 611 * @param {!UI.TreeElement} treeNode |
612 * @param {?string=} emptyPlaceholder | 612 * @param {?string=} emptyPlaceholder |
613 */ | 613 */ |
614 static _appendEmptyPlaceholderIfNeeded(treeNode, emptyPlaceholder) { | 614 static _appendEmptyPlaceholderIfNeeded(treeNode, emptyPlaceholder) { |
615 if (treeNode.childCount()) | 615 if (treeNode.childCount()) |
616 return; | 616 return; |
617 var title = createElementWithClass('div', 'gray-info-message'); | 617 var title = createElementWithClass('div', 'gray-info-message'); |
618 title.textContent = emptyPlaceholder || Common.UIString('No Properties'); | 618 title.textContent = emptyPlaceholder || Common.UIString('No Properties'); |
619 var infoElement = new TreeElement(title); | 619 var infoElement = new UI.TreeElement(title); |
620 treeNode.appendChild(infoElement); | 620 treeNode.appendChild(infoElement); |
621 } | 621 } |
622 | 622 |
623 /** | 623 /** |
624 * @param {?SDK.RemoteObject} object | 624 * @param {?SDK.RemoteObject} object |
625 * @param {!Array.<string>} propertyPath | 625 * @param {!Array.<string>} propertyPath |
626 * @param {function(?SDK.RemoteObject, boolean=)} callback | 626 * @param {function(?SDK.RemoteObject, boolean=)} callback |
627 * @return {!Element} | 627 * @return {!Element} |
628 */ | 628 */ |
629 static createRemoteObjectAccessorPropertySpan(object, propertyPath, callback)
{ | 629 static createRemoteObjectAccessorPropertySpan(object, propertyPath, callback)
{ |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } else { | 952 } else { |
953 this.setExpandable(false); | 953 this.setExpandable(false); |
954 } | 954 } |
955 } | 955 } |
956 }; | 956 }; |
957 | 957 |
958 | 958 |
959 /** | 959 /** |
960 * @unrestricted | 960 * @unrestricted |
961 */ | 961 */ |
962 Components.ArrayGroupingTreeElement = class extends TreeElement { | 962 Components.ArrayGroupingTreeElement = class extends UI.TreeElement { |
963 /** | 963 /** |
964 * @param {!SDK.RemoteObject} object | 964 * @param {!SDK.RemoteObject} object |
965 * @param {number} fromIndex | 965 * @param {number} fromIndex |
966 * @param {number} toIndex | 966 * @param {number} toIndex |
967 * @param {number} propertyCount | 967 * @param {number} propertyCount |
968 * @param {!Components.Linkifier=} linkifier | 968 * @param {!Components.Linkifier=} linkifier |
969 */ | 969 */ |
970 constructor(object, fromIndex, toIndex, propertyCount, linkifier) { | 970 constructor(object, fromIndex, toIndex, propertyCount, linkifier) { |
971 super(String.sprintf('[%d \u2026 %d]', fromIndex, toIndex), true); | 971 super(String.sprintf('[%d \u2026 %d]', fromIndex, toIndex), true); |
972 this.toggleOnClick = true; | 972 this.toggleOnClick = true; |
973 this.selectable = false; | 973 this.selectable = false; |
974 this._fromIndex = fromIndex; | 974 this._fromIndex = fromIndex; |
975 this._toIndex = toIndex; | 975 this._toIndex = toIndex; |
976 this._object = object; | 976 this._object = object; |
977 this._readOnly = true; | 977 this._readOnly = true; |
978 this._propertyCount = propertyCount; | 978 this._propertyCount = propertyCount; |
979 this._linkifier = linkifier; | 979 this._linkifier = linkifier; |
980 } | 980 } |
981 | 981 |
982 /** | 982 /** |
983 * @param {!TreeElement} treeNode | 983 * @param {!UI.TreeElement} treeNode |
984 * @param {!SDK.RemoteObject} object | 984 * @param {!SDK.RemoteObject} object |
985 * @param {number} fromIndex | 985 * @param {number} fromIndex |
986 * @param {number} toIndex | 986 * @param {number} toIndex |
987 * @param {!Components.Linkifier=} linkifier | 987 * @param {!Components.Linkifier=} linkifier |
988 */ | 988 */ |
989 static _populateArray(treeNode, object, fromIndex, toIndex, linkifier) { | 989 static _populateArray(treeNode, object, fromIndex, toIndex, linkifier) { |
990 Components.ArrayGroupingTreeElement._populateRanges(treeNode, object, fromIn
dex, toIndex, true, linkifier); | 990 Components.ArrayGroupingTreeElement._populateRanges(treeNode, object, fromIn
dex, toIndex, true, linkifier); |
991 } | 991 } |
992 | 992 |
993 /** | 993 /** |
994 * @param {!TreeElement} treeNode | 994 * @param {!UI.TreeElement} treeNode |
995 * @param {!SDK.RemoteObject} object | 995 * @param {!SDK.RemoteObject} object |
996 * @param {number} fromIndex | 996 * @param {number} fromIndex |
997 * @param {number} toIndex | 997 * @param {number} toIndex |
998 * @param {boolean} topLevel | 998 * @param {boolean} topLevel |
999 * @param {!Components.Linkifier=} linkifier | 999 * @param {!Components.Linkifier=} linkifier |
1000 * @this {Components.ArrayGroupingTreeElement} | 1000 * @this {Components.ArrayGroupingTreeElement} |
1001 */ | 1001 */ |
1002 static _populateRanges(treeNode, object, fromIndex, toIndex, topLevel, linkifi
er) { | 1002 static _populateRanges(treeNode, object, fromIndex, toIndex, topLevel, linkifi
er) { |
1003 object.callFunctionJSON( | 1003 object.callFunctionJSON( |
1004 packRanges, | 1004 packRanges, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 } | 1104 } |
1105 } | 1105 } |
1106 if (topLevel) { | 1106 if (topLevel) { |
1107 Components.ArrayGroupingTreeElement._populateNonIndexProperties( | 1107 Components.ArrayGroupingTreeElement._populateNonIndexProperties( |
1108 treeNode, object, result.skipGetOwnPropertyNames, linkifier); | 1108 treeNode, object, result.skipGetOwnPropertyNames, linkifier); |
1109 } | 1109 } |
1110 } | 1110 } |
1111 } | 1111 } |
1112 | 1112 |
1113 /** | 1113 /** |
1114 * @param {!TreeElement} treeNode | 1114 * @param {!UI.TreeElement} treeNode |
1115 * @param {!SDK.RemoteObject} object | 1115 * @param {!SDK.RemoteObject} object |
1116 * @param {number} fromIndex | 1116 * @param {number} fromIndex |
1117 * @param {number} toIndex | 1117 * @param {number} toIndex |
1118 * @param {!Components.Linkifier=} linkifier | 1118 * @param {!Components.Linkifier=} linkifier |
1119 * @this {Components.ArrayGroupingTreeElement} | 1119 * @this {Components.ArrayGroupingTreeElement} |
1120 */ | 1120 */ |
1121 static _populateAsFragment(treeNode, object, fromIndex, toIndex, linkifier) { | 1121 static _populateAsFragment(treeNode, object, fromIndex, toIndex, linkifier) { |
1122 object.callFunction( | 1122 object.callFunction( |
1123 buildArrayFragment, | 1123 buildArrayFragment, |
1124 [{value: fromIndex}, {value: toIndex}, {value: Components.ArrayGroupingT
reeElement._sparseIterationThreshold}], | 1124 [{value: fromIndex}, {value: toIndex}, {value: Components.ArrayGroupingT
reeElement._sparseIterationThreshold}], |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 for (var i = 0; i < properties.length; ++i) { | 1170 for (var i = 0; i < properties.length; ++i) { |
1171 properties[i].parentObject = this._object; | 1171 properties[i].parentObject = this._object; |
1172 var childTreeElement = new Components.ObjectPropertyTreeElement(properti
es[i], linkifier); | 1172 var childTreeElement = new Components.ObjectPropertyTreeElement(properti
es[i], linkifier); |
1173 childTreeElement._readOnly = true; | 1173 childTreeElement._readOnly = true; |
1174 treeNode.appendChild(childTreeElement); | 1174 treeNode.appendChild(childTreeElement); |
1175 } | 1175 } |
1176 } | 1176 } |
1177 } | 1177 } |
1178 | 1178 |
1179 /** | 1179 /** |
1180 * @param {!TreeElement} treeNode | 1180 * @param {!UI.TreeElement} treeNode |
1181 * @param {!SDK.RemoteObject} object | 1181 * @param {!SDK.RemoteObject} object |
1182 * @param {boolean} skipGetOwnPropertyNames | 1182 * @param {boolean} skipGetOwnPropertyNames |
1183 * @param {!Components.Linkifier=} linkifier | 1183 * @param {!Components.Linkifier=} linkifier |
1184 * @this {Components.ArrayGroupingTreeElement} | 1184 * @this {Components.ArrayGroupingTreeElement} |
1185 */ | 1185 */ |
1186 static _populateNonIndexProperties(treeNode, object, skipGetOwnPropertyNames,
linkifier) { | 1186 static _populateNonIndexProperties(treeNode, object, skipGetOwnPropertyNames,
linkifier) { |
1187 object.callFunction(buildObjectFragment, [{value: skipGetOwnPropertyNames}],
processObjectFragment.bind(this)); | 1187 object.callFunction(buildObjectFragment, [{value: skipGetOwnPropertyNames}],
processObjectFragment.bind(this)); |
1188 | 1188 |
1189 /** | 1189 /** |
1190 * @param {boolean=} skipGetOwnPropertyNames | 1190 * @param {boolean=} skipGetOwnPropertyNames |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 constructor() { | 1280 constructor() { |
1281 /** @type {!Set.<string>} */ | 1281 /** @type {!Set.<string>} */ |
1282 this._expandedProperties = new Set(); | 1282 this._expandedProperties = new Set(); |
1283 } | 1283 } |
1284 | 1284 |
1285 /** | 1285 /** |
1286 * @param {string} id | 1286 * @param {string} id |
1287 * @param {!Components.ObjectPropertiesSection} section | 1287 * @param {!Components.ObjectPropertiesSection} section |
1288 */ | 1288 */ |
1289 watchSection(id, section) { | 1289 watchSection(id, section) { |
1290 section.addEventListener(TreeOutline.Events.ElementAttached, this._elementAt
tached, this); | 1290 section.addEventListener(UI.TreeOutline.Events.ElementAttached, this._elemen
tAttached, this); |
1291 section.addEventListener(TreeOutline.Events.ElementExpanded, this._elementEx
panded, this); | 1291 section.addEventListener(UI.TreeOutline.Events.ElementExpanded, this._elemen
tExpanded, this); |
1292 section.addEventListener(TreeOutline.Events.ElementCollapsed, this._elementC
ollapsed, this); | 1292 section.addEventListener(UI.TreeOutline.Events.ElementCollapsed, this._eleme
ntCollapsed, this); |
1293 section[Components.ObjectPropertiesSectionExpandController._treeOutlineId] =
id; | 1293 section[Components.ObjectPropertiesSectionExpandController._treeOutlineId] =
id; |
1294 | 1294 |
1295 if (this._expandedProperties.has(id)) | 1295 if (this._expandedProperties.has(id)) |
1296 section.expand(); | 1296 section.expand(); |
1297 } | 1297 } |
1298 | 1298 |
1299 /** | 1299 /** |
1300 * @param {string} id | 1300 * @param {string} id |
1301 */ | 1301 */ |
1302 stopWatchSectionsWithId(id) { | 1302 stopWatchSectionsWithId(id) { |
1303 for (var property of this._expandedProperties) { | 1303 for (var property of this._expandedProperties) { |
1304 if (property.startsWith(id + ':')) | 1304 if (property.startsWith(id + ':')) |
1305 this._expandedProperties.delete(property); | 1305 this._expandedProperties.delete(property); |
1306 } | 1306 } |
1307 } | 1307 } |
1308 | 1308 |
1309 /** | 1309 /** |
1310 * @param {!Common.Event} event | 1310 * @param {!Common.Event} event |
1311 */ | 1311 */ |
1312 _elementAttached(event) { | 1312 _elementAttached(event) { |
1313 var element = /** @type {!TreeElement} */ (event.data); | 1313 var element = /** @type {!UI.TreeElement} */ (event.data); |
1314 if (element.isExpandable() && this._expandedProperties.has(this._propertyPat
h(element))) | 1314 if (element.isExpandable() && this._expandedProperties.has(this._propertyPat
h(element))) |
1315 element.expand(); | 1315 element.expand(); |
1316 } | 1316 } |
1317 | 1317 |
1318 /** | 1318 /** |
1319 * @param {!Common.Event} event | 1319 * @param {!Common.Event} event |
1320 */ | 1320 */ |
1321 _elementExpanded(event) { | 1321 _elementExpanded(event) { |
1322 var element = /** @type {!TreeElement} */ (event.data); | 1322 var element = /** @type {!UI.TreeElement} */ (event.data); |
1323 this._expandedProperties.add(this._propertyPath(element)); | 1323 this._expandedProperties.add(this._propertyPath(element)); |
1324 } | 1324 } |
1325 | 1325 |
1326 /** | 1326 /** |
1327 * @param {!Common.Event} event | 1327 * @param {!Common.Event} event |
1328 */ | 1328 */ |
1329 _elementCollapsed(event) { | 1329 _elementCollapsed(event) { |
1330 var element = /** @type {!TreeElement} */ (event.data); | 1330 var element = /** @type {!UI.TreeElement} */ (event.data); |
1331 this._expandedProperties.delete(this._propertyPath(element)); | 1331 this._expandedProperties.delete(this._propertyPath(element)); |
1332 } | 1332 } |
1333 | 1333 |
1334 /** | 1334 /** |
1335 * @param {!TreeElement} treeElement | 1335 * @param {!UI.TreeElement} treeElement |
1336 * @return {string} | 1336 * @return {string} |
1337 */ | 1337 */ |
1338 _propertyPath(treeElement) { | 1338 _propertyPath(treeElement) { |
1339 var cachedPropertyPath = treeElement[Components.ObjectPropertiesSectionExpan
dController._cachedPathSymbol]; | 1339 var cachedPropertyPath = treeElement[Components.ObjectPropertiesSectionExpan
dController._cachedPathSymbol]; |
1340 if (cachedPropertyPath) | 1340 if (cachedPropertyPath) |
1341 return cachedPropertyPath; | 1341 return cachedPropertyPath; |
1342 | 1342 |
1343 var current = treeElement; | 1343 var current = treeElement; |
1344 var rootElement = treeElement.treeOutline.objectTreeElement(); | 1344 var rootElement = treeElement.treeOutline.objectTreeElement(); |
1345 | 1345 |
(...skipping 11 matching lines...) Expand all Loading... |
1357 } | 1357 } |
1358 var treeOutlineId = treeElement.treeOutline[Components.ObjectPropertiesSecti
onExpandController._treeOutlineId]; | 1358 var treeOutlineId = treeElement.treeOutline[Components.ObjectPropertiesSecti
onExpandController._treeOutlineId]; |
1359 result = treeOutlineId + (result ? ':' + result : ''); | 1359 result = treeOutlineId + (result ? ':' + result : ''); |
1360 treeElement[Components.ObjectPropertiesSectionExpandController._cachedPathSy
mbol] = result; | 1360 treeElement[Components.ObjectPropertiesSectionExpandController._cachedPathSy
mbol] = result; |
1361 return result; | 1361 return result; |
1362 } | 1362 } |
1363 }; | 1363 }; |
1364 | 1364 |
1365 Components.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('c
achedPath'); | 1365 Components.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('c
achedPath'); |
1366 Components.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('tree
OutlineId'); | 1366 Components.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('tree
OutlineId'); |
OLD | NEW |