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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 this.startEditing(event); | 170 this.startEditing(event); |
171 return false; | 171 return false; |
172 }, | 172 }, |
173 | 173 |
174 /** | 174 /** |
175 * @override | 175 * @override |
176 */ | 176 */ |
177 onattach: function() | 177 onattach: function() |
178 { | 178 { |
179 this.update(); | 179 this.update(); |
180 if (this.property.value) | |
sergeyv
2015/02/24 13:03:16
lets move this to constructor
| |
181 this.setExpandable(this.property.value.hasChildren && !this.property .wasThrown); | |
180 }, | 182 }, |
181 | 183 |
182 update: function() | 184 update: function() |
183 { | 185 { |
184 this.nameElement = WebInspector.ObjectPropertiesSection.createNameElemen t(this.property.name); | 186 this.nameElement = WebInspector.ObjectPropertiesSection.createNameElemen t(this.property.name); |
185 if (!this.property.enumerable) | 187 if (!this.property.enumerable) |
186 this.nameElement.classList.add("dimmed"); | 188 this.nameElement.classList.add("dimmed"); |
187 if (this.property.isAccessorProperty()) | 189 if (this.property.isAccessorProperty()) |
188 this.nameElement.classList.add("properties-accessor-property-name"); | 190 this.nameElement.classList.add("properties-accessor-property-name"); |
189 if (this.property.symbol) | 191 if (this.property.symbol) |
190 this.nameElement.addEventListener("contextmenu", this._contextMenuFi red.bind(this, this.property.symbol), false); | 192 this.nameElement.addEventListener("contextmenu", this._contextMenuFi red.bind(this, this.property.symbol), false); |
191 | 193 |
192 if (this.property.value) { | 194 if (this.property.value) { |
193 this.valueElement = WebInspector.ObjectPropertiesSection.createValue Element(this.property.value, this.property.wasThrown, this.listItemElement); | 195 this.valueElement = WebInspector.ObjectPropertiesSection.createValue Element(this.property.value, this.property.wasThrown, this.listItemElement); |
194 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property.value), false); | 196 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property.value), false); |
195 this.hasChildren = this.property.value.hasChildren && !this.property .wasThrown; | |
196 } else if (this.property.getter) { | 197 } else if (this.property.getter) { |
197 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); | 198 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); |
198 } else { | 199 } else { |
199 this.valueElement = createElementWithClass("span", "console-formatte d-undefined"); | 200 this.valueElement = createElementWithClass("span", "console-formatte d-undefined"); |
200 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); | 201 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); |
201 this.valueElement.title = WebInspector.UIString("No property getter" ); | 202 this.valueElement.title = WebInspector.UIString("No property getter" ); |
202 } | 203 } |
203 | 204 |
204 var separatorElement = createElementWithClass("span", "separator"); | 205 var separatorElement = createElementWithClass("span", "separator"); |
205 separatorElement.textContent = ": "; | 206 separatorElement.textContent = ": "; |
(...skipping 27 matching lines...) Expand all Loading... | |
233 if (WebInspector.isBeingEdited(this.valueElement) || !this.treeOutline.s ection.editable || this._readOnly) | 234 if (WebInspector.isBeingEdited(this.valueElement) || !this.treeOutline.s ection.editable || this._readOnly) |
234 return; | 235 return; |
235 | 236 |
236 // Edit original source. | 237 // Edit original source. |
237 if (typeof valueToEdit !== "undefined") | 238 if (typeof valueToEdit !== "undefined") |
238 this.valueElement.setTextContentTruncatedIfNeeded(valueToEdit, WebIn spector.UIString("<string is too large to edit>")); | 239 this.valueElement.setTextContentTruncatedIfNeeded(valueToEdit, WebIn spector.UIString("<string is too large to edit>")); |
239 | 240 |
240 var context = { expanded: this.expanded, previousContent: this.valueElem ent.textContent }; | 241 var context = { expanded: this.expanded, previousContent: this.valueElem ent.textContent }; |
241 | 242 |
242 // Lie about our children to prevent expanding on double click and to co llapse subproperties. | 243 // Lie about our children to prevent expanding on double click and to co llapse subproperties. |
243 this.hasChildren = false; | 244 this.setExpandable(false); |
244 | 245 |
245 this.listItemElement.classList.add("editing-sub-part"); | 246 this.listItemElement.classList.add("editing-sub-part"); |
246 | 247 |
247 this._prompt = new WebInspector.ObjectPropertyPrompt(); | 248 this._prompt = new WebInspector.ObjectPropertyPrompt(); |
248 | 249 |
249 /** | 250 /** |
250 * @this {WebInspector.ObjectPropertyTreeElement} | 251 * @this {WebInspector.ObjectPropertyTreeElement} |
251 */ | 252 */ |
252 function blurListener() | 253 function blurListener() |
253 { | 254 { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 return rootElement; | 521 return rootElement; |
521 } | 522 } |
522 | 523 |
523 /** | 524 /** |
524 * @constructor | 525 * @constructor |
525 * @extends {TreeElement} | 526 * @extends {TreeElement} |
526 * @param {!WebInspector.RemoteObject} remoteObject | 527 * @param {!WebInspector.RemoteObject} remoteObject |
527 */ | 528 */ |
528 WebInspector.FunctionScopeMainTreeElement = function(remoteObject) | 529 WebInspector.FunctionScopeMainTreeElement = function(remoteObject) |
529 { | 530 { |
530 TreeElement.call(this, "<function scope>"); | 531 TreeElement.call(this, "<function scope>", true); |
531 this.toggleOnClick = true; | 532 this.toggleOnClick = true; |
532 this.selectable = false; | 533 this.selectable = false; |
533 this._remoteObject = remoteObject; | 534 this._remoteObject = remoteObject; |
534 this.hasChildren = true; | |
535 } | 535 } |
536 | 536 |
537 WebInspector.FunctionScopeMainTreeElement.prototype = { | 537 WebInspector.FunctionScopeMainTreeElement.prototype = { |
538 onpopulate: function() | 538 onpopulate: function() |
539 { | 539 { |
540 /** | 540 /** |
541 * @param {?WebInspector.DebuggerModel.FunctionDetails} response | 541 * @param {?WebInspector.DebuggerModel.FunctionDetails} response |
542 * @this {WebInspector.FunctionScopeMainTreeElement} | 542 * @this {WebInspector.FunctionScopeMainTreeElement} |
543 */ | 543 */ |
544 function didGetDetails(response) | 544 function didGetDetails(response) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
607 __proto__: TreeElement.prototype | 607 __proto__: TreeElement.prototype |
608 } | 608 } |
609 | 609 |
610 /** | 610 /** |
611 * @constructor | 611 * @constructor |
612 * @extends {TreeElement} | 612 * @extends {TreeElement} |
613 * @param {!WebInspector.RemoteObject} remoteObject | 613 * @param {!WebInspector.RemoteObject} remoteObject |
614 */ | 614 */ |
615 WebInspector.CollectionEntriesMainTreeElement = function(remoteObject) | 615 WebInspector.CollectionEntriesMainTreeElement = function(remoteObject) |
616 { | 616 { |
617 TreeElement.call(this, "<entries>"); | 617 TreeElement.call(this, "<entries>", true); |
618 this.toggleOnClick = true; | 618 this.toggleOnClick = true; |
619 this.selectable = false; | 619 this.selectable = false; |
620 this._remoteObject = remoteObject; | 620 this._remoteObject = remoteObject; |
621 this.hasChildren = true; | |
622 this.expand(); | 621 this.expand(); |
623 } | 622 } |
624 | 623 |
625 WebInspector.CollectionEntriesMainTreeElement.prototype = { | 624 WebInspector.CollectionEntriesMainTreeElement.prototype = { |
626 onpopulate: function() | 625 onpopulate: function() |
627 { | 626 { |
628 /** | 627 /** |
629 * @param {?Array.<!DebuggerAgent.CollectionEntry>} entries | 628 * @param {?Array.<!DebuggerAgent.CollectionEntry>} entries |
630 * @this {WebInspector.CollectionEntriesMainTreeElement} | 629 * @this {WebInspector.CollectionEntriesMainTreeElement} |
631 */ | 630 */ |
(...skipping 27 matching lines...) Expand all Loading... | |
659 } | 658 } |
660 | 659 |
661 /** | 660 /** |
662 * @constructor | 661 * @constructor |
663 * @extends {TreeElement} | 662 * @extends {TreeElement} |
664 * @param {string} title | 663 * @param {string} title |
665 * @param {!WebInspector.RemoteObject} remoteObject | 664 * @param {!WebInspector.RemoteObject} remoteObject |
666 */ | 665 */ |
667 WebInspector.ScopeTreeElement = function(title, remoteObject) | 666 WebInspector.ScopeTreeElement = function(title, remoteObject) |
668 { | 667 { |
669 TreeElement.call(this, title); | 668 TreeElement.call(this, title, true); |
670 this.toggleOnClick = true; | 669 this.toggleOnClick = true; |
671 this.selectable = false; | 670 this.selectable = false; |
672 this._remoteObject = remoteObject; | 671 this._remoteObject = remoteObject; |
673 this.hasChildren = true; | |
674 } | 672 } |
675 | 673 |
676 WebInspector.ScopeTreeElement.prototype = { | 674 WebInspector.ScopeTreeElement.prototype = { |
677 onpopulate: function() | 675 onpopulate: function() |
678 { | 676 { |
679 WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObjec t, false); | 677 WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObjec t, false); |
680 }, | 678 }, |
681 | 679 |
682 __proto__: TreeElement.prototype | 680 __proto__: TreeElement.prototype |
683 } | 681 } |
684 | 682 |
685 /** | 683 /** |
686 * @constructor | 684 * @constructor |
687 * @extends {TreeElement} | 685 * @extends {TreeElement} |
688 * @param {!WebInspector.RemoteObject} object | 686 * @param {!WebInspector.RemoteObject} object |
689 * @param {number} fromIndex | 687 * @param {number} fromIndex |
690 * @param {number} toIndex | 688 * @param {number} toIndex |
691 * @param {number} propertyCount | 689 * @param {number} propertyCount |
692 */ | 690 */ |
693 WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro pertyCount) | 691 WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro pertyCount) |
694 { | 692 { |
695 TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex), true); | 693 TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex), true); |
696 this.toggleOnClick = true; | 694 this.toggleOnClick = true; |
697 this.selectable = false; | 695 this.selectable = false; |
698 this._fromIndex = fromIndex; | 696 this._fromIndex = fromIndex; |
699 this._toIndex = toIndex; | 697 this._toIndex = toIndex; |
700 this._object = object; | 698 this._object = object; |
701 this._readOnly = true; | 699 this._readOnly = true; |
702 this._propertyCount = propertyCount; | 700 this._propertyCount = propertyCount; |
703 this._populated = false; | |
704 } | 701 } |
705 | 702 |
706 WebInspector.ArrayGroupingTreeElement._bucketThreshold = 100; | 703 WebInspector.ArrayGroupingTreeElement._bucketThreshold = 100; |
707 WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold = 250000; | 704 WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold = 250000; |
708 WebInspector.ArrayGroupingTreeElement._getOwnPropertyNamesThreshold = 500000; | 705 WebInspector.ArrayGroupingTreeElement._getOwnPropertyNamesThreshold = 500000; |
709 | 706 |
710 /** | 707 /** |
711 * @param {!TreeElement} treeNode | 708 * @param {!TreeElement} treeNode |
712 * @param {!WebInspector.RemoteObject} object | 709 * @param {!WebInspector.RemoteObject} object |
713 * @param {number} fromIndex | 710 * @param {number} fromIndex |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 var childTreeElement = new WebInspector.ObjectPropertyTreeElement(pr operties[i]); | 960 var childTreeElement = new WebInspector.ObjectPropertyTreeElement(pr operties[i]); |
964 childTreeElement._readOnly = true; | 961 childTreeElement._readOnly = true; |
965 treeNode.appendChild(childTreeElement); | 962 treeNode.appendChild(childTreeElement); |
966 } | 963 } |
967 } | 964 } |
968 } | 965 } |
969 | 966 |
970 WebInspector.ArrayGroupingTreeElement.prototype = { | 967 WebInspector.ArrayGroupingTreeElement.prototype = { |
971 onpopulate: function() | 968 onpopulate: function() |
972 { | 969 { |
973 if (this._populated) | |
974 return; | |
975 | |
976 this._populated = true; | |
977 | |
978 if (this._propertyCount >= WebInspector.ArrayGroupingTreeElement._bucket Threshold) { | 970 if (this._propertyCount >= WebInspector.ArrayGroupingTreeElement._bucket Threshold) { |
979 WebInspector.ArrayGroupingTreeElement._populateRanges(this, this._ob ject, this._fromIndex, this._toIndex, false); | 971 WebInspector.ArrayGroupingTreeElement._populateRanges(this, this._ob ject, this._fromIndex, this._toIndex, false); |
980 return; | 972 return; |
981 } | 973 } |
982 WebInspector.ArrayGroupingTreeElement._populateAsFragment(this, this._ob ject, this._fromIndex, this._toIndex); | 974 WebInspector.ArrayGroupingTreeElement._populateAsFragment(this, this._ob ject, this._fromIndex, this._toIndex); |
983 }, | 975 }, |
984 | 976 |
985 onattach: function() | 977 onattach: function() |
986 { | 978 { |
987 this.listItemElement.classList.add("name"); | 979 this.listItemElement.classList.add("name"); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1084 value.highlightAsDOMNode(); | 1076 value.highlightAsDOMNode(); |
1085 } | 1077 } |
1086 | 1078 |
1087 function mouseLeave() | 1079 function mouseLeave() |
1088 { | 1080 { |
1089 value.hideDOMNodeHighlight(); | 1081 value.hideDOMNodeHighlight(); |
1090 } | 1082 } |
1091 | 1083 |
1092 return valueElement; | 1084 return valueElement; |
1093 } | 1085 } |
OLD | NEW |