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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 var targetValue = this.property.name !== '__proto__' ? propertyValue : this.
property.parentObject; | 679 var targetValue = this.property.name !== '__proto__' ? propertyValue : this.
property.parentObject; |
680 ObjectUI.ObjectPropertyTreeElement._populate( | 680 ObjectUI.ObjectPropertyTreeElement._populate( |
681 this, propertyValue, skipProto, this._linkifier, undefined, undefined, u
ndefined, targetValue); | 681 this, propertyValue, skipProto, this._linkifier, undefined, undefined, u
ndefined, targetValue); |
682 } | 682 } |
683 | 683 |
684 /** | 684 /** |
685 * @override | 685 * @override |
686 * @return {boolean} | 686 * @return {boolean} |
687 */ | 687 */ |
688 ondblclick(event) { | 688 ondblclick(event) { |
689 var inEditableElement = event.target.isSelfOrDescendant(this.valueElement) |
| | 689 var inEditableElement = event.target.isSelfOrDescendant(this.valueElement); |
690 (this.expandedValueElement && event.target.isSelfOrDescendant(this.expan
dedValueElement)); | |
691 if (!this.property.value.customPreview() && inEditableElement && (this.prope
rty.writable || this.property.setter)) | 690 if (!this.property.value.customPreview() && inEditableElement && (this.prope
rty.writable || this.property.setter)) |
692 this._startEditing(); | 691 this._startEditing(); |
693 return false; | 692 return false; |
694 } | 693 } |
695 | 694 |
696 /** | 695 /** |
697 * @override | 696 * @override |
698 */ | 697 */ |
699 onattach() { | 698 onattach() { |
700 this.update(); | 699 this.update(); |
701 this._updateExpandable(); | 700 this._updateExpandable(); |
702 } | 701 } |
703 | 702 |
704 /** | |
705 * @override | |
706 */ | |
707 onexpand() { | |
708 this._showExpandedValueElement(true); | |
709 } | |
710 | |
711 /** | |
712 * @override | |
713 */ | |
714 oncollapse() { | |
715 this._showExpandedValueElement(false); | |
716 } | |
717 | |
718 /** | |
719 * @param {boolean} value | |
720 */ | |
721 _showExpandedValueElement(value) { | |
722 if (!this.expandedValueElement) | |
723 return; | |
724 if (value) | |
725 this.listItemElement.replaceChild(this.expandedValueElement, this.valueEle
ment); | |
726 else | |
727 this.listItemElement.replaceChild(this.valueElement, this.expandedValueEle
ment); | |
728 } | |
729 | |
730 /** | |
731 * @param {!SDK.RemoteObject} value | |
732 * @return {?Element} | |
733 */ | |
734 _createExpandedValueElement(value) { | |
735 var needsAlternateValue = value.hasChildren && !value.customPreview() && val
ue.subtype !== 'node' && | |
736 value.type !== 'function' && (value.type !== 'object' || value.preview); | |
737 if (!needsAlternateValue) | |
738 return null; | |
739 | |
740 var valueElement = createElementWithClass('span', 'value'); | |
741 valueElement.setTextContentTruncatedIfNeeded(value.description || ''); | |
742 valueElement.classList.add('object-value-' + (value.subtype || value.type)); | |
743 valueElement.title = value.description || ''; | |
744 return valueElement; | |
745 } | |
746 | |
747 update() { | 703 update() { |
748 this.nameElement = ObjectUI.ObjectPropertiesSection.createNameElement(this.p
roperty.name); | 704 this.nameElement = ObjectUI.ObjectPropertiesSection.createNameElement(this.p
roperty.name); |
749 if (!this.property.enumerable) | 705 if (!this.property.enumerable) |
750 this.nameElement.classList.add('object-properties-section-dimmed'); | 706 this.nameElement.classList.add('object-properties-section-dimmed'); |
751 if (this.property.synthetic) | 707 if (this.property.synthetic) |
752 this.nameElement.classList.add('synthetic-property'); | 708 this.nameElement.classList.add('synthetic-property'); |
753 | 709 |
754 this._updatePropertyPath(); | 710 this._updatePropertyPath(); |
755 this.nameElement.addEventListener('contextmenu', this._contextMenuFired.bind
(this, this.property), false); | 711 this.nameElement.addEventListener('contextmenu', this._contextMenuFired.bind
(this, this.property), false); |
756 | 712 |
757 var separatorElement = createElementWithClass('span', 'object-properties-sec
tion-separator'); | 713 var separatorElement = createElementWithClass('span', 'object-properties-sec
tion-separator'); |
758 separatorElement.textContent = ': '; | 714 separatorElement.textContent = ': '; |
759 | 715 |
760 if (this.property.value) { | 716 if (this.property.value) { |
761 var showPreview = this.property.name !== '__proto__'; | 717 var showPreview = this.property.name !== '__proto__'; |
762 this.valueElement = ObjectUI.ObjectPropertiesSection.createValueElementWit
hCustomSupport( | 718 this.valueElement = ObjectUI.ObjectPropertiesSection.createValueElementWit
hCustomSupport( |
763 this.property.value, this.property.wasThrown, showPreview, this.listIt
emElement, this._linkifier); | 719 this.property.value, this.property.wasThrown, showPreview, this.listIt
emElement, this._linkifier); |
764 this.valueElement.addEventListener('contextmenu', this._contextMenuFired.b
ind(this, this.property), false); | 720 this.valueElement.addEventListener('contextmenu', this._contextMenuFired.b
ind(this, this.property), false); |
765 } else if (this.property.getter) { | 721 } else if (this.property.getter) { |
766 this.valueElement = ObjectUI.ObjectPropertyTreeElement.createRemoteObjectA
ccessorPropertySpan( | 722 this.valueElement = ObjectUI.ObjectPropertyTreeElement.createRemoteObjectA
ccessorPropertySpan( |
767 this.property.parentObject, [this.property.name], this._onInvokeGetter
Click.bind(this)); | 723 this.property.parentObject, [this.property.name], this._onInvokeGetter
Click.bind(this)); |
768 } else { | 724 } else { |
769 this.valueElement = createElementWithClass('span', 'object-value-undefined
'); | 725 this.valueElement = createElementWithClass('span', 'object-value-undefined
'); |
770 this.valueElement.textContent = Common.UIString('<unreadable>'); | 726 this.valueElement.textContent = Common.UIString('<unreadable>'); |
771 this.valueElement.title = Common.UIString('No property getter'); | 727 this.valueElement.title = Common.UIString('No property getter'); |
772 } | 728 } |
773 | 729 |
774 var valueText = this.valueElement.textContent; | |
775 if (this.property.value && valueText && !this.property.wasThrown) | |
776 this.expandedValueElement = this._createExpandedValueElement(this.property
.value); | |
777 | |
778 this.listItemElement.removeChildren(); | 730 this.listItemElement.removeChildren(); |
779 this.listItemElement.appendChildren(this.nameElement, separatorElement, this
.valueElement); | 731 this.listItemElement.appendChildren(this.nameElement, separatorElement, this
.valueElement); |
780 } | 732 } |
781 | 733 |
782 _updatePropertyPath() { | 734 _updatePropertyPath() { |
783 if (this.nameElement.title) | 735 if (this.nameElement.title) |
784 return; | 736 return; |
785 | 737 |
786 var useDotNotation = /^(_|\$|[A-Z])(_|\$|[A-Z]|\d)*$/i; | 738 var useDotNotation = /^(_|\$|[A-Z])(_|\$|[A-Z]|\d)*$/i; |
787 var isInteger = /^[1-9]\d*$/; | 739 var isInteger = /^[1-9]\d*$/; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 } | 1295 } |
1344 var treeOutlineId = treeElement.treeOutline[ObjectUI.ObjectPropertiesSection
ExpandController._treeOutlineId]; | 1296 var treeOutlineId = treeElement.treeOutline[ObjectUI.ObjectPropertiesSection
ExpandController._treeOutlineId]; |
1345 result = treeOutlineId + (result ? ':' + result : ''); | 1297 result = treeOutlineId + (result ? ':' + result : ''); |
1346 treeElement[ObjectUI.ObjectPropertiesSectionExpandController._cachedPathSymb
ol] = result; | 1298 treeElement[ObjectUI.ObjectPropertiesSectionExpandController._cachedPathSymb
ol] = result; |
1347 return result; | 1299 return result; |
1348 } | 1300 } |
1349 }; | 1301 }; |
1350 | 1302 |
1351 ObjectUI.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('cac
hedPath'); | 1303 ObjectUI.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('cac
hedPath'); |
1352 ObjectUI.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('treeOu
tlineId'); | 1304 ObjectUI.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('treeOu
tlineId'); |
OLD | NEW |