| 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 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperti
es); | 46 object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperti
es); |
| 47 this.appendChild(this._objectTreeElement); | 47 this.appendChild(this._objectTreeElement); |
| 48 if (typeof title === 'string' || !title) { | 48 if (typeof title === 'string' || !title) { |
| 49 this.titleElement = this.element.createChild('span'); | 49 this.titleElement = this.element.createChild('span'); |
| 50 this.titleElement.textContent = title || ''; | 50 this.titleElement.textContent = title || ''; |
| 51 } else { | 51 } else { |
| 52 this.titleElement = title; | 52 this.titleElement = title; |
| 53 this.element.appendChild(title); | 53 this.element.appendChild(title); |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (object.description && Components.ObjectPropertiesSection._needsAlternate
Title(object)) { | |
| 57 this.expandedTitleElement = createElement('span'); | |
| 58 this.expandedTitleElement.createTextChild(object.description); | |
| 59 | |
| 60 var note = this.expandedTitleElement.createChild('span', 'object-state-not
e'); | |
| 61 note.classList.add('info-note'); | |
| 62 note.title = Common.UIString('Value below was evaluated just now.'); | |
| 63 } | |
| 64 | |
| 65 this.element._section = this; | 56 this.element._section = this; |
| 66 this.registerRequiredCSS('components/objectValue.css'); | 57 this.registerRequiredCSS('components/objectValue.css'); |
| 67 this.registerRequiredCSS('components/objectPropertiesSection.css'); | 58 this.registerRequiredCSS('components/objectPropertiesSection.css'); |
| 68 this.rootElement().childrenListElement.classList.add('source-code', 'object-
properties-section'); | 59 this.rootElement().childrenListElement.classList.add('source-code', 'object-
properties-section'); |
| 69 } | 60 } |
| 70 | 61 |
| 71 /** | 62 /** |
| 72 * @param {!SDK.RemoteObject} object | 63 * @param {!SDK.RemoteObject} object |
| 73 * @param {!Components.Linkifier=} linkifier | 64 * @param {!Components.Linkifier=} linkifier |
| 74 * @param {boolean=} skipProto | 65 * @param {boolean=} skipProto |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 var numberParts = description.split('e'); | 311 var numberParts = description.split('e'); |
| 321 valueElement.createChild('span', 'object-value-scientific-notation-mantiss
a').textContent = numberParts[0]; | 312 valueElement.createChild('span', 'object-value-scientific-notation-mantiss
a').textContent = numberParts[0]; |
| 322 valueElement.createChild('span', 'object-value-scientific-notation-exponen
t').textContent = 'e' + numberParts[1]; | 313 valueElement.createChild('span', 'object-value-scientific-notation-exponen
t').textContent = 'e' + numberParts[1]; |
| 323 valueElement.classList.add('object-value-scientific-notation-number'); | 314 valueElement.classList.add('object-value-scientific-notation-number'); |
| 324 valueElement.title = description || ''; | 315 valueElement.title = description || ''; |
| 325 return valueElement; | 316 return valueElement; |
| 326 } | 317 } |
| 327 } | 318 } |
| 328 | 319 |
| 329 /** | 320 /** |
| 330 * @param {!SDK.RemoteObject} object | |
| 331 * @return {boolean} | |
| 332 */ | |
| 333 static _needsAlternateTitle(object) { | |
| 334 return object && object.hasChildren && !object.customPreview() && object.sub
type !== 'node' && | |
| 335 object.type !== 'function' && (object.type !== 'object' || object.previe
w); | |
| 336 } | |
| 337 | |
| 338 /** | |
| 339 * @param {!SDK.RemoteObject} func | 321 * @param {!SDK.RemoteObject} func |
| 340 * @param {!Element} element | 322 * @param {!Element} element |
| 341 * @param {boolean} linkify | 323 * @param {boolean} linkify |
| 342 * @param {boolean=} includePreview | 324 * @param {boolean=} includePreview |
| 343 */ | 325 */ |
| 344 static formatObjectAsFunction(func, element, linkify, includePreview) { | 326 static formatObjectAsFunction(func, element, linkify, includePreview) { |
| 345 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails); | 327 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails); |
| 346 | 328 |
| 347 /** | 329 /** |
| 348 * @param {?SDK.DebuggerModel.FunctionDetails} response | 330 * @param {?SDK.DebuggerModel.FunctionDetails} response |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 this.selectable = false; | 412 this.selectable = false; |
| 431 this.toggleOnClick = true; | 413 this.toggleOnClick = true; |
| 432 this.listItemElement.classList.add('object-properties-section-root-element')
; | 414 this.listItemElement.classList.add('object-properties-section-root-element')
; |
| 433 this._linkifier = linkifier; | 415 this._linkifier = linkifier; |
| 434 } | 416 } |
| 435 | 417 |
| 436 /** | 418 /** |
| 437 * @override | 419 * @override |
| 438 */ | 420 */ |
| 439 onexpand() { | 421 onexpand() { |
| 440 if (this.treeOutline) { | 422 if (this.treeOutline) |
| 441 this.treeOutline.element.classList.add('expanded'); | 423 this.treeOutline.element.classList.add('expanded'); |
| 442 this._showExpandedTitleElement(true); | |
| 443 } | |
| 444 } | 424 } |
| 445 | 425 |
| 446 /** | 426 /** |
| 447 * @override | 427 * @override |
| 448 */ | 428 */ |
| 449 oncollapse() { | 429 oncollapse() { |
| 450 if (this.treeOutline) { | 430 if (this.treeOutline) |
| 451 this.treeOutline.element.classList.remove('expanded'); | 431 this.treeOutline.element.classList.remove('expanded'); |
| 452 this._showExpandedTitleElement(false); | |
| 453 } | |
| 454 } | 432 } |
| 455 | 433 |
| 456 /** | 434 /** |
| 457 * @param {boolean} value | |
| 458 */ | |
| 459 _showExpandedTitleElement(value) { | |
| 460 if (!this.treeOutline.expandedTitleElement) | |
| 461 return; | |
| 462 if (value) | |
| 463 this.treeOutline.element.replaceChild(this.treeOutline.expandedTitleElemen
t, this.treeOutline.titleElement); | |
| 464 else | |
| 465 this.treeOutline.element.replaceChild(this.treeOutline.titleElement, this.
treeOutline.expandedTitleElement); | |
| 466 } | |
| 467 | |
| 468 /** | |
| 469 * @override | 435 * @override |
| 470 * @param {!Event} e | 436 * @param {!Event} e |
| 471 * @return {boolean} | 437 * @return {boolean} |
| 472 */ | 438 */ |
| 473 ondblclick(e) { | 439 ondblclick(e) { |
| 474 return true; | 440 return true; |
| 475 } | 441 } |
| 476 | 442 |
| 477 /** | 443 /** |
| 478 * @override | 444 * @override |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 this.listItemElement.replaceChild(this.expandedValueElement, this.valueEle
ment); | 716 this.listItemElement.replaceChild(this.expandedValueElement, this.valueEle
ment); |
| 751 else | 717 else |
| 752 this.listItemElement.replaceChild(this.valueElement, this.expandedValueEle
ment); | 718 this.listItemElement.replaceChild(this.valueElement, this.expandedValueEle
ment); |
| 753 } | 719 } |
| 754 | 720 |
| 755 /** | 721 /** |
| 756 * @param {!SDK.RemoteObject} value | 722 * @param {!SDK.RemoteObject} value |
| 757 * @return {?Element} | 723 * @return {?Element} |
| 758 */ | 724 */ |
| 759 _createExpandedValueElement(value) { | 725 _createExpandedValueElement(value) { |
| 760 if (!Components.ObjectPropertiesSection._needsAlternateTitle(value)) | 726 var needsAlternateValue = value.hasChildren && !value.customPreview() && val
ue.subtype !== 'node' && |
| 727 value.type !== 'function' && (value.type !== 'object' || value.preview); |
| 728 if (!needsAlternateValue) |
| 761 return null; | 729 return null; |
| 762 | 730 |
| 763 var valueElement = createElementWithClass('span', 'value'); | 731 var valueElement = createElementWithClass('span', 'value'); |
| 764 valueElement.setTextContentTruncatedIfNeeded(value.description || ''); | 732 valueElement.setTextContentTruncatedIfNeeded(value.description || ''); |
| 765 valueElement.classList.add('object-value-' + (value.subtype || value.type)); | 733 valueElement.classList.add('object-value-' + (value.subtype || value.type)); |
| 766 valueElement.title = value.description || ''; | 734 valueElement.title = value.description || ''; |
| 767 return valueElement; | 735 return valueElement; |
| 768 } | 736 } |
| 769 | 737 |
| 770 update() { | 738 update() { |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 } | 1333 } |
| 1366 var treeOutlineId = treeElement.treeOutline[Components.ObjectPropertiesSecti
onExpandController._treeOutlineId]; | 1334 var treeOutlineId = treeElement.treeOutline[Components.ObjectPropertiesSecti
onExpandController._treeOutlineId]; |
| 1367 result = treeOutlineId + (result ? ':' + result : ''); | 1335 result = treeOutlineId + (result ? ':' + result : ''); |
| 1368 treeElement[Components.ObjectPropertiesSectionExpandController._cachedPathSy
mbol] = result; | 1336 treeElement[Components.ObjectPropertiesSectionExpandController._cachedPathSy
mbol] = result; |
| 1369 return result; | 1337 return result; |
| 1370 } | 1338 } |
| 1371 }; | 1339 }; |
| 1372 | 1340 |
| 1373 Components.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('c
achedPath'); | 1341 Components.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('c
achedPath'); |
| 1374 Components.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('tree
OutlineId'); | 1342 Components.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('tree
OutlineId'); |
| OLD | NEW |