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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 var note = this.expandedTitleElement.createChild("span", "object-state-n ote"); 58 var note = this.expandedTitleElement.createChild("span", "object-state-n ote");
59 note.classList.add("info-note"); 59 note.classList.add("info-note");
60 note.title = WebInspector.UIString("Value below was evaluated just now." ); 60 note.title = WebInspector.UIString("Value below was evaluated just now." );
61 } 61 }
62 62
63 this.element._section = this; 63 this.element._section = this;
64 this.registerRequiredCSS("components/objectValue.css"); 64 this.registerRequiredCSS("components/objectValue.css");
65 this.registerRequiredCSS("components/objectPropertiesSection.css"); 65 this.registerRequiredCSS("components/objectPropertiesSection.css");
66 this.rootElement().childrenListElement.classList.add("source-code", "object- properties-section"); 66 this.rootElement().childrenListElement.classList.add("source-code", "object- properties-section");
67 } 67 };
68 68
69 /** @const */ 69 /** @const */
70 WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100; 70 WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100;
71 71
72 /** 72 /**
73 * @param {!WebInspector.RemoteObject} object 73 * @param {!WebInspector.RemoteObject} object
74 * @param {!WebInspector.Linkifier=} linkifier 74 * @param {!WebInspector.Linkifier=} linkifier
75 * @param {boolean=} skipProto 75 * @param {boolean=} skipProto
76 * @return {!Element} 76 * @return {!Element}
77 */ 77 */
78 WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object , linkifier, skipProto) 78 WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object , linkifier, skipProto)
79 { 79 {
80 var componentRoot = createElementWithClass("span", "source-code"); 80 var componentRoot = createElementWithClass("span", "source-code");
81 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(componentRoot, "components/objectValue.css"); 81 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(componentRoot, "components/objectValue.css");
82 shadowRoot.appendChild(WebInspector.ObjectPropertiesSection.createValueEleme nt(object, false)); 82 shadowRoot.appendChild(WebInspector.ObjectPropertiesSection.createValueEleme nt(object, false));
83 if (!object.hasChildren) 83 if (!object.hasChildren)
84 return componentRoot; 84 return componentRoot;
85 85
86 var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(objec t, componentRoot, linkifier); 86 var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(objec t, componentRoot, linkifier);
87 objectPropertiesSection.editable = false; 87 objectPropertiesSection.editable = false;
88 if (skipProto) 88 if (skipProto)
89 objectPropertiesSection.skipProto(); 89 objectPropertiesSection.skipProto();
90 90
91 return objectPropertiesSection.element; 91 return objectPropertiesSection.element;
92 } 92 };
93 93
94 WebInspector.ObjectPropertiesSection.prototype = { 94 WebInspector.ObjectPropertiesSection.prototype = {
95 skipProto: function() 95 skipProto: function()
96 { 96 {
97 this._skipProto = true; 97 this._skipProto = true;
98 }, 98 },
99 99
100 expand: function() 100 expand: function()
101 { 101 {
102 this._objectTreeElement.expand(); 102 this._objectTreeElement.expand();
(...skipping 28 matching lines...) Expand all
131 }, 131 },
132 132
133 titleLessMode: function() 133 titleLessMode: function()
134 { 134 {
135 this._objectTreeElement.listItemElement.classList.add("hidden"); 135 this._objectTreeElement.listItemElement.classList.add("hidden");
136 this._objectTreeElement.childrenListElement.classList.add("title-less-mo de"); 136 this._objectTreeElement.childrenListElement.classList.add("title-less-mo de");
137 this._objectTreeElement.expand(); 137 this._objectTreeElement.expand();
138 }, 138 },
139 139
140 __proto__: TreeOutlineInShadow.prototype 140 __proto__: TreeOutlineInShadow.prototype
141 } 141 };
142 142
143 /** 143 /**
144 * @param {!WebInspector.RemoteObjectProperty} propertyA 144 * @param {!WebInspector.RemoteObjectProperty} propertyA
145 * @param {!WebInspector.RemoteObjectProperty} propertyB 145 * @param {!WebInspector.RemoteObjectProperty} propertyB
146 * @return {number} 146 * @return {number}
147 */ 147 */
148 WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, pro pertyB) 148 WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, pro pertyB)
149 { 149 {
150 var a = propertyA.name; 150 var a = propertyA.name;
151 var b = propertyB.name; 151 var b = propertyB.name;
152 if (a === "__proto__") 152 if (a === "__proto__")
153 return 1; 153 return 1;
154 if (b === "__proto__") 154 if (b === "__proto__")
155 return -1; 155 return -1;
156 if (propertyA.symbol && !propertyB.symbol) 156 if (propertyA.symbol && !propertyB.symbol)
157 return 1; 157 return 1;
158 if (propertyB.symbol && !propertyA.symbol) 158 if (propertyB.symbol && !propertyA.symbol)
159 return -1; 159 return -1;
160 return String.naturalOrderComparator(a, b); 160 return String.naturalOrderComparator(a, b);
161 } 161 };
162 162
163 /** 163 /**
164 * @constructor 164 * @constructor
165 * @extends {TreeElement} 165 * @extends {TreeElement}
166 * @param {!WebInspector.RemoteObject} object 166 * @param {!WebInspector.RemoteObject} object
167 * @param {!WebInspector.Linkifier=} linkifier 167 * @param {!WebInspector.Linkifier=} linkifier
168 * @param {?string=} emptyPlaceholder 168 * @param {?string=} emptyPlaceholder
169 * @param {boolean=} ignoreHasOwnProperty 169 * @param {boolean=} ignoreHasOwnProperty
170 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties 170 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties
171 */ 171 */
172 WebInspector.ObjectPropertiesSection.RootElement = function(object, linkifier, e mptyPlaceholder, ignoreHasOwnProperty, extraProperties) 172 WebInspector.ObjectPropertiesSection.RootElement = function(object, linkifier, e mptyPlaceholder, ignoreHasOwnProperty, extraProperties)
173 { 173 {
174 this._object = object; 174 this._object = object;
175 this._extraProperties = extraProperties || []; 175 this._extraProperties = extraProperties || [];
176 this._ignoreHasOwnProperty = !!ignoreHasOwnProperty; 176 this._ignoreHasOwnProperty = !!ignoreHasOwnProperty;
177 this._emptyPlaceholder = emptyPlaceholder; 177 this._emptyPlaceholder = emptyPlaceholder;
178 var contentElement = createElement("content"); 178 var contentElement = createElement("content");
179 TreeElement.call(this, contentElement); 179 TreeElement.call(this, contentElement);
180 this.setExpandable(true); 180 this.setExpandable(true);
181 this.selectable = false; 181 this.selectable = false;
182 this.toggleOnClick = true; 182 this.toggleOnClick = true;
183 this.listItemElement.classList.add("object-properties-section-root-element") ; 183 this.listItemElement.classList.add("object-properties-section-root-element") ;
184 this._linkifier = linkifier; 184 this._linkifier = linkifier;
185 } 185 };
186 186
187 WebInspector.ObjectPropertiesSection.RootElement.prototype = { 187 WebInspector.ObjectPropertiesSection.RootElement.prototype = {
188 /** 188 /**
189 * @override 189 * @override
190 */ 190 */
191 onexpand: function() 191 onexpand: function()
192 { 192 {
193 if (this.treeOutline) { 193 if (this.treeOutline) {
194 this.treeOutline.element.classList.add("expanded"); 194 this.treeOutline.element.classList.add("expanded");
195 this._showExpandedTitleElement(true); 195 this._showExpandedTitleElement(true);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 { 229 {
230 return true; 230 return true;
231 }, 231 },
232 232
233 onpopulate: function() 233 onpopulate: function()
234 { 234 {
235 WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!t his.treeOutline._skipProto, this._linkifier, this._emptyPlaceholder, this._ignor eHasOwnProperty, this._extraProperties); 235 WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!t his.treeOutline._skipProto, this._linkifier, this._emptyPlaceholder, this._ignor eHasOwnProperty, this._extraProperties);
236 }, 236 },
237 237
238 __proto__: TreeElement.prototype 238 __proto__: TreeElement.prototype
239 } 239 };
240 240
241 /** 241 /**
242 * @constructor 242 * @constructor
243 * @extends {TreeElement} 243 * @extends {TreeElement}
244 * @param {!WebInspector.RemoteObjectProperty} property 244 * @param {!WebInspector.RemoteObjectProperty} property
245 * @param {!WebInspector.Linkifier=} linkifier 245 * @param {!WebInspector.Linkifier=} linkifier
246 */ 246 */
247 WebInspector.ObjectPropertyTreeElement = function(property, linkifier) 247 WebInspector.ObjectPropertyTreeElement = function(property, linkifier)
248 { 248 {
249 this.property = property; 249 this.property = property;
250 250
251 // Pass an empty title, the title gets made later in onattach. 251 // Pass an empty title, the title gets made later in onattach.
252 TreeElement.call(this); 252 TreeElement.call(this);
253 this.toggleOnClick = true; 253 this.toggleOnClick = true;
254 this.selectable = false; 254 this.selectable = false;
255 /** @type {!Array.<!Object>} */ 255 /** @type {!Array.<!Object>} */
256 this._highlightChanges = []; 256 this._highlightChanges = [];
257 this._linkifier = linkifier; 257 this._linkifier = linkifier;
258 } 258 };
259 259
260 WebInspector.ObjectPropertyTreeElement.prototype = { 260 WebInspector.ObjectPropertyTreeElement.prototype = {
261 /** 261 /**
262 * @param {!RegExp} regex 262 * @param {!RegExp} regex
263 * @param {string=} additionalCssClassName 263 * @param {string=} additionalCssClassName
264 * @return {boolean} 264 * @return {boolean}
265 */ 265 */
266 setSearchRegex: function(regex, additionalCssClassName) 266 setSearchRegex: function(regex, additionalCssClassName)
267 { 267 {
268 var cssClasses = WebInspector.highlightedSearchResultClassName; 268 var cssClasses = WebInspector.highlightedSearchResultClassName;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 572
573 _updateExpandable: function() 573 _updateExpandable: function()
574 { 574 {
575 if (this.property.value) 575 if (this.property.value)
576 this.setExpandable(!this.property.value.customPreview() && this.prop erty.value.hasChildren && !this.property.wasThrown); 576 this.setExpandable(!this.property.value.customPreview() && this.prop erty.value.hasChildren && !this.property.wasThrown);
577 else 577 else
578 this.setExpandable(false); 578 this.setExpandable(false);
579 }, 579 },
580 580
581 __proto__: TreeElement.prototype 581 __proto__: TreeElement.prototype
582 } 582 };
583 583
584 /** 584 /**
585 * @param {!TreeElement} treeElement 585 * @param {!TreeElement} treeElement
586 * @param {!WebInspector.RemoteObject} value 586 * @param {!WebInspector.RemoteObject} value
587 * @param {boolean} skipProto 587 * @param {boolean} skipProto
588 * @param {!WebInspector.Linkifier=} linkifier 588 * @param {!WebInspector.Linkifier=} linkifier
589 * @param {?string=} emptyPlaceholder 589 * @param {?string=} emptyPlaceholder
590 * @param {boolean=} flattenProtoChain 590 * @param {boolean=} flattenProtoChain
591 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties 591 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties
592 * @param {!WebInspector.RemoteObject=} targetValue 592 * @param {!WebInspector.RemoteObject=} targetValue
(...skipping 21 matching lines...) Expand all
614 properties.push(extraProperties[i]); 614 properties.push(extraProperties[i]);
615 615
616 WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElemen t, properties, internalProperties, 616 WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElemen t, properties, internalProperties,
617 skipProto, targetValue || value, linkifier, emptyPlaceholder); 617 skipProto, targetValue || value, linkifier, emptyPlaceholder);
618 } 618 }
619 619
620 if (flattenProtoChain) 620 if (flattenProtoChain)
621 value.getAllProperties(false, callback); 621 value.getAllProperties(false, callback);
622 else 622 else
623 WebInspector.RemoteObject.loadFromObjectPerProto(value, callback); 623 WebInspector.RemoteObject.loadFromObjectPerProto(value, callback);
624 } 624 };
625 625
626 /** 626 /**
627 * @param {!TreeElement} treeNode 627 * @param {!TreeElement} treeNode
628 * @param {!Array.<!WebInspector.RemoteObjectProperty>} properties 628 * @param {!Array.<!WebInspector.RemoteObjectProperty>} properties
629 * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties 629 * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties
630 * @param {boolean} skipProto 630 * @param {boolean} skipProto
631 * @param {?WebInspector.RemoteObject} value 631 * @param {?WebInspector.RemoteObject} value
632 * @param {!WebInspector.Linkifier=} linkifier 632 * @param {!WebInspector.Linkifier=} linkifier
633 * @param {?string=} emptyPlaceholder 633 * @param {?string=} emptyPlaceholder
634 */ 634 */
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 internalProperties[i].parentObject = value; 666 internalProperties[i].parentObject = value;
667 var treeElement = new WebInspector.ObjectPropertyTreeElement(interna lProperties[i], linkifier); 667 var treeElement = new WebInspector.ObjectPropertyTreeElement(interna lProperties[i], linkifier);
668 if (internalProperties[i].name === "[[Entries]]") { 668 if (internalProperties[i].name === "[[Entries]]") {
669 treeElement.setExpandable(true); 669 treeElement.setExpandable(true);
670 treeElement.expand(); 670 treeElement.expand();
671 } 671 }
672 treeNode.appendChild(treeElement); 672 treeNode.appendChild(treeElement);
673 } 673 }
674 } 674 }
675 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeN ode, emptyPlaceholder); 675 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeN ode, emptyPlaceholder);
676 } 676 };
677 677
678 /** 678 /**
679 * @param {!TreeElement} treeNode 679 * @param {!TreeElement} treeNode
680 * @param {?string=} emptyPlaceholder 680 * @param {?string=} emptyPlaceholder
681 */ 681 */
682 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio n(treeNode, emptyPlaceholder) 682 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio n(treeNode, emptyPlaceholder)
683 { 683 {
684 if (treeNode.childCount()) 684 if (treeNode.childCount())
685 return; 685 return;
686 var title = createElementWithClass("div", "gray-info-message"); 686 var title = createElementWithClass("div", "gray-info-message");
687 title.textContent = emptyPlaceholder || WebInspector.UIString("No Properties "); 687 title.textContent = emptyPlaceholder || WebInspector.UIString("No Properties ");
688 var infoElement = new TreeElement(title); 688 var infoElement = new TreeElement(title);
689 treeNode.appendChild(infoElement); 689 treeNode.appendChild(infoElement);
690 } 690 };
691 691
692 /** 692 /**
693 * @param {?WebInspector.RemoteObject} object 693 * @param {?WebInspector.RemoteObject} object
694 * @param {!Array.<string>} propertyPath 694 * @param {!Array.<string>} propertyPath
695 * @param {function(?WebInspector.RemoteObject, boolean=)} callback 695 * @param {function(?WebInspector.RemoteObject, boolean=)} callback
696 * @return {!Element} 696 * @return {!Element}
697 */ 697 */
698 WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan = function(object, propertyPath, callback) 698 WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan = function(object, propertyPath, callback)
699 { 699 {
700 var rootElement = createElement("span"); 700 var rootElement = createElement("span");
701 var element = rootElement.createChild("span"); 701 var element = rootElement.createChild("span");
702 element.textContent = WebInspector.UIString("(...)"); 702 element.textContent = WebInspector.UIString("(...)");
703 if (!object) 703 if (!object)
704 return rootElement; 704 return rootElement;
705 element.classList.add("object-value-calculate-value-button"); 705 element.classList.add("object-value-calculate-value-button");
706 element.title = WebInspector.UIString("Invoke property getter"); 706 element.title = WebInspector.UIString("Invoke property getter");
707 element.addEventListener("click", onInvokeGetterClick, false); 707 element.addEventListener("click", onInvokeGetterClick, false);
708 708
709 function onInvokeGetterClick(event) 709 function onInvokeGetterClick(event)
710 { 710 {
711 event.consume(); 711 event.consume();
712 object.getProperty(propertyPath, callback); 712 object.getProperty(propertyPath, callback);
713 } 713 }
714 714
715 return rootElement; 715 return rootElement;
716 } 716 };
717 717
718 /** 718 /**
719 * @constructor 719 * @constructor
720 * @extends {TreeElement} 720 * @extends {TreeElement}
721 * @param {!WebInspector.RemoteObject} object 721 * @param {!WebInspector.RemoteObject} object
722 * @param {number} fromIndex 722 * @param {number} fromIndex
723 * @param {number} toIndex 723 * @param {number} toIndex
724 * @param {number} propertyCount 724 * @param {number} propertyCount
725 * @param {!WebInspector.Linkifier=} linkifier 725 * @param {!WebInspector.Linkifier=} linkifier
726 */ 726 */
727 WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro pertyCount, linkifier) 727 WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro pertyCount, linkifier)
728 { 728 {
729 TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex), true); 729 TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex), true);
730 this.toggleOnClick = true; 730 this.toggleOnClick = true;
731 this.selectable = false; 731 this.selectable = false;
732 this._fromIndex = fromIndex; 732 this._fromIndex = fromIndex;
733 this._toIndex = toIndex; 733 this._toIndex = toIndex;
734 this._object = object; 734 this._object = object;
735 this._readOnly = true; 735 this._readOnly = true;
736 this._propertyCount = propertyCount; 736 this._propertyCount = propertyCount;
737 this._linkifier = linkifier; 737 this._linkifier = linkifier;
738 } 738 };
739 739
740 WebInspector.ArrayGroupingTreeElement._bucketThreshold = 100; 740 WebInspector.ArrayGroupingTreeElement._bucketThreshold = 100;
741 WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold = 250000; 741 WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold = 250000;
742 WebInspector.ArrayGroupingTreeElement._getOwnPropertyNamesThreshold = 500000; 742 WebInspector.ArrayGroupingTreeElement._getOwnPropertyNamesThreshold = 500000;
743 743
744 /** 744 /**
745 * @param {!TreeElement} treeNode 745 * @param {!TreeElement} treeNode
746 * @param {!WebInspector.RemoteObject} object 746 * @param {!WebInspector.RemoteObject} object
747 * @param {number} fromIndex 747 * @param {number} fromIndex
748 * @param {number} toIndex 748 * @param {number} toIndex
749 * @param {!WebInspector.Linkifier=} linkifier 749 * @param {!WebInspector.Linkifier=} linkifier
750 */ 750 */
751 WebInspector.ArrayGroupingTreeElement._populateArray = function(treeNode, object , fromIndex, toIndex, linkifier) 751 WebInspector.ArrayGroupingTreeElement._populateArray = function(treeNode, object , fromIndex, toIndex, linkifier)
752 { 752 {
753 WebInspector.ArrayGroupingTreeElement._populateRanges(treeNode, object, from Index, toIndex, true, linkifier); 753 WebInspector.ArrayGroupingTreeElement._populateRanges(treeNode, object, from Index, toIndex, true, linkifier);
754 } 754 };
755 755
756 /** 756 /**
757 * @param {!TreeElement} treeNode 757 * @param {!TreeElement} treeNode
758 * @param {!WebInspector.RemoteObject} object 758 * @param {!WebInspector.RemoteObject} object
759 * @param {number} fromIndex 759 * @param {number} fromIndex
760 * @param {number} toIndex 760 * @param {number} toIndex
761 * @param {boolean} topLevel 761 * @param {boolean} topLevel
762 * @param {!WebInspector.Linkifier=} linkifier 762 * @param {!WebInspector.Linkifier=} linkifier
763 * @this {WebInspector.ArrayGroupingTreeElement} 763 * @this {WebInspector.ArrayGroupingTreeElement}
764 */ 764 */
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 var count = ranges[i][2]; 864 var count = ranges[i][2];
865 if (fromIndex === toIndex) 865 if (fromIndex === toIndex)
866 WebInspector.ArrayGroupingTreeElement._populateAsFragment(tr eeNode, object, fromIndex, toIndex, linkifier); 866 WebInspector.ArrayGroupingTreeElement._populateAsFragment(tr eeNode, object, fromIndex, toIndex, linkifier);
867 else 867 else
868 treeNode.appendChild(new WebInspector.ArrayGroupingTreeEleme nt(object, fromIndex, toIndex, count, linkifier)); 868 treeNode.appendChild(new WebInspector.ArrayGroupingTreeEleme nt(object, fromIndex, toIndex, count, linkifier));
869 } 869 }
870 } 870 }
871 if (topLevel) 871 if (topLevel)
872 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties(tr eeNode, object, result.skipGetOwnPropertyNames, linkifier); 872 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties(tr eeNode, object, result.skipGetOwnPropertyNames, linkifier);
873 } 873 }
874 } 874 };
875 875
876 /** 876 /**
877 * @param {!TreeElement} treeNode 877 * @param {!TreeElement} treeNode
878 * @param {!WebInspector.RemoteObject} object 878 * @param {!WebInspector.RemoteObject} object
879 * @param {number} fromIndex 879 * @param {number} fromIndex
880 * @param {number} toIndex 880 * @param {number} toIndex
881 * @param {!WebInspector.Linkifier=} linkifier 881 * @param {!WebInspector.Linkifier=} linkifier
882 * @this {WebInspector.ArrayGroupingTreeElement} 882 * @this {WebInspector.ArrayGroupingTreeElement}
883 */ 883 */
884 WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeNode, o bject, fromIndex, toIndex, linkifier) 884 WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeNode, o bject, fromIndex, toIndex, linkifier)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 return; 931 return;
932 932
933 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties); 933 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
934 for (var i = 0; i < properties.length; ++i) { 934 for (var i = 0; i < properties.length; ++i) {
935 properties[i].parentObject = this._object; 935 properties[i].parentObject = this._object;
936 var childTreeElement = new WebInspector.ObjectPropertyTreeElement(pr operties[i], linkifier); 936 var childTreeElement = new WebInspector.ObjectPropertyTreeElement(pr operties[i], linkifier);
937 childTreeElement._readOnly = true; 937 childTreeElement._readOnly = true;
938 treeNode.appendChild(childTreeElement); 938 treeNode.appendChild(childTreeElement);
939 } 939 }
940 } 940 }
941 } 941 };
942 942
943 /** 943 /**
944 * @param {!TreeElement} treeNode 944 * @param {!TreeElement} treeNode
945 * @param {!WebInspector.RemoteObject} object 945 * @param {!WebInspector.RemoteObject} object
946 * @param {boolean} skipGetOwnPropertyNames 946 * @param {boolean} skipGetOwnPropertyNames
947 * @param {!WebInspector.Linkifier=} linkifier 947 * @param {!WebInspector.Linkifier=} linkifier
948 * @this {WebInspector.ArrayGroupingTreeElement} 948 * @this {WebInspector.ArrayGroupingTreeElement}
949 */ 949 */
950 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties = function(tre eNode, object, skipGetOwnPropertyNames, linkifier) 950 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties = function(tre eNode, object, skipGetOwnPropertyNames, linkifier)
951 { 951 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 if (!properties) 996 if (!properties)
997 return; 997 return;
998 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties); 998 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
999 for (var i = 0; i < properties.length; ++i) { 999 for (var i = 0; i < properties.length; ++i) {
1000 properties[i].parentObject = this._object; 1000 properties[i].parentObject = this._object;
1001 var childTreeElement = new WebInspector.ObjectPropertyTreeElement(pr operties[i], linkifier); 1001 var childTreeElement = new WebInspector.ObjectPropertyTreeElement(pr operties[i], linkifier);
1002 childTreeElement._readOnly = true; 1002 childTreeElement._readOnly = true;
1003 treeNode.appendChild(childTreeElement); 1003 treeNode.appendChild(childTreeElement);
1004 } 1004 }
1005 } 1005 }
1006 } 1006 };
1007 1007
1008 WebInspector.ArrayGroupingTreeElement.prototype = { 1008 WebInspector.ArrayGroupingTreeElement.prototype = {
1009 onpopulate: function() 1009 onpopulate: function()
1010 { 1010 {
1011 if (this._propertyCount >= WebInspector.ArrayGroupingTreeElement._bucket Threshold) { 1011 if (this._propertyCount >= WebInspector.ArrayGroupingTreeElement._bucket Threshold) {
1012 WebInspector.ArrayGroupingTreeElement._populateRanges(this, this._ob ject, this._fromIndex, this._toIndex, false, this._linkifier); 1012 WebInspector.ArrayGroupingTreeElement._populateRanges(this, this._ob ject, this._fromIndex, this._toIndex, false, this._linkifier);
1013 return; 1013 return;
1014 } 1014 }
1015 WebInspector.ArrayGroupingTreeElement._populateAsFragment(this, this._ob ject, this._fromIndex, this._toIndex, this._linkifier); 1015 WebInspector.ArrayGroupingTreeElement._populateAsFragment(this, this._ob ject, this._fromIndex, this._toIndex, this._linkifier);
1016 }, 1016 },
1017 1017
1018 onattach: function() 1018 onattach: function()
1019 { 1019 {
1020 this.listItemElement.classList.add("object-properties-section-name"); 1020 this.listItemElement.classList.add("object-properties-section-name");
1021 }, 1021 },
1022 1022
1023 __proto__: TreeElement.prototype 1023 __proto__: TreeElement.prototype
1024 } 1024 };
1025 1025
1026 /** 1026 /**
1027 * @constructor 1027 * @constructor
1028 * @extends {WebInspector.TextPrompt} 1028 * @extends {WebInspector.TextPrompt}
1029 */ 1029 */
1030 WebInspector.ObjectPropertyPrompt = function() 1030 WebInspector.ObjectPropertyPrompt = function()
1031 { 1031 {
1032 WebInspector.TextPrompt.call(this, WebInspector.ExecutionContextSelector.com pletionsForTextPromptInCurrentContext); 1032 WebInspector.TextPrompt.call(this, WebInspector.ExecutionContextSelector.com pletionsForTextPromptInCurrentContext);
1033 this.setSuggestBoxEnabled(true); 1033 this.setSuggestBoxEnabled(true);
1034 } 1034 };
1035 1035
1036 WebInspector.ObjectPropertyPrompt.prototype = { 1036 WebInspector.ObjectPropertyPrompt.prototype = {
1037 __proto__: WebInspector.TextPrompt.prototype 1037 __proto__: WebInspector.TextPrompt.prototype
1038 } 1038 };
1039 1039
1040 /** 1040 /**
1041 * @param {?string} name 1041 * @param {?string} name
1042 * @return {!Element} 1042 * @return {!Element}
1043 */ 1043 */
1044 WebInspector.ObjectPropertiesSection.createNameElement = function(name) 1044 WebInspector.ObjectPropertiesSection.createNameElement = function(name)
1045 { 1045 {
1046 var nameElement = createElementWithClass("span", "name"); 1046 var nameElement = createElementWithClass("span", "name");
1047 if (/^\s|\s$|^$|\n/.test(name)) 1047 if (/^\s|\s$|^$|\n/.test(name))
1048 nameElement.createTextChildren("\"", name.replace(/\n/g, "\u21B5"), "\"" ); 1048 nameElement.createTextChildren("\"", name.replace(/\n/g, "\u21B5"), "\"" );
1049 else 1049 else
1050 nameElement.textContent = name; 1050 nameElement.textContent = name;
1051 return nameElement; 1051 return nameElement;
1052 } 1052 };
1053 1053
1054 WebInspector.ObjectPropertiesSection._functionPrefixSource = /^(?:async\s)?funct ion\*?\s/; 1054 WebInspector.ObjectPropertiesSection._functionPrefixSource = /^(?:async\s)?funct ion\*?\s/;
1055 1055
1056 /** 1056 /**
1057 * @param {?string=} description 1057 * @param {?string=} description
1058 * @return {string} valueText 1058 * @return {string} valueText
1059 */ 1059 */
1060 WebInspector.ObjectPropertiesSection.valueTextForFunctionDescription = function( description) 1060 WebInspector.ObjectPropertiesSection.valueTextForFunctionDescription = function( description)
1061 { 1061 {
1062 var text = description.replace(/^function [gs]et /, "function "); 1062 var text = description.replace(/^function [gs]et /, "function ");
1063 var functionPrefixWithArguments = new RegExp(WebInspector.ObjectPropertiesSe ction._functionPrefixSource.source + "([^)]*)"); 1063 var functionPrefixWithArguments = new RegExp(WebInspector.ObjectPropertiesSe ction._functionPrefixSource.source + "([^)]*)");
1064 var matches = functionPrefixWithArguments.exec(text); 1064 var matches = functionPrefixWithArguments.exec(text);
1065 if (!matches) { 1065 if (!matches) {
1066 // process shorthand methods 1066 // process shorthand methods
1067 matches = /[^(]*(\([^)]*)/.exec(text); 1067 matches = /[^(]*(\([^)]*)/.exec(text);
1068 } 1068 }
1069 var match = matches ? matches[1] : null; 1069 var match = matches ? matches[1] : null;
1070 return match ? match.replace(/\n/g, " ") + ")" : (text || ""); 1070 return match ? match.replace(/\n/g, " ") + ")" : (text || "");
1071 } 1071 };
1072 1072
1073 /** 1073 /**
1074 * @param {!WebInspector.RemoteObject} value 1074 * @param {!WebInspector.RemoteObject} value
1075 * @param {boolean} wasThrown 1075 * @param {boolean} wasThrown
1076 * @param {!Element=} parentElement 1076 * @param {!Element=} parentElement
1077 * @param {!WebInspector.Linkifier=} linkifier 1077 * @param {!WebInspector.Linkifier=} linkifier
1078 * @return {!Element} 1078 * @return {!Element}
1079 */ 1079 */
1080 WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = funct ion(value, wasThrown, parentElement, linkifier) 1080 WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = funct ion(value, wasThrown, parentElement, linkifier)
1081 { 1081 {
1082 if (value.customPreview()) { 1082 if (value.customPreview()) {
1083 var result = (new WebInspector.CustomPreviewComponent(value)).element; 1083 var result = (new WebInspector.CustomPreviewComponent(value)).element;
1084 result.classList.add("object-properties-section-custom-section"); 1084 result.classList.add("object-properties-section-custom-section");
1085 return result 1085 return result;
1086 } 1086 }
1087 return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThr own, parentElement, linkifier); 1087 return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThr own, parentElement, linkifier);
1088 } 1088 };
1089 1089
1090 /** 1090 /**
1091 * @param {!WebInspector.RemoteObject} value 1091 * @param {!WebInspector.RemoteObject} value
1092 * @param {boolean} wasThrown 1092 * @param {boolean} wasThrown
1093 * @param {!Element=} parentElement 1093 * @param {!Element=} parentElement
1094 * @param {!WebInspector.Linkifier=} linkifier 1094 * @param {!WebInspector.Linkifier=} linkifier
1095 * @return {!Element} 1095 * @return {!Element}
1096 */ 1096 */
1097 WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr own, parentElement, linkifier) 1097 WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr own, parentElement, linkifier)
1098 { 1098 {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 /** 1168 /**
1169 * @param {!Event} event 1169 * @param {!Event} event
1170 */ 1170 */
1171 function mouseClick(event) 1171 function mouseClick(event)
1172 { 1172 {
1173 WebInspector.Revealer.reveal(value); 1173 WebInspector.Revealer.reveal(value);
1174 event.consume(true); 1174 event.consume(true);
1175 } 1175 }
1176 1176
1177 return valueElement; 1177 return valueElement;
1178 } 1178 };
1179 1179
1180 /** 1180 /**
1181 * @param {!WebInspector.RemoteObject} object 1181 * @param {!WebInspector.RemoteObject} object
1182 * @return {boolean} 1182 * @return {boolean}
1183 */ 1183 */
1184 WebInspector.ObjectPropertiesSection._needsAlternateTitle = function(object) 1184 WebInspector.ObjectPropertiesSection._needsAlternateTitle = function(object)
1185 { 1185 {
1186 return object && object.hasChildren && !object.customPreview() && object.sub type !== "node" && object.type !== "function" && (object.type !== "object" || ob ject.preview); 1186 return object && object.hasChildren && !object.customPreview() && object.sub type !== "node" && object.type !== "function" && (object.type !== "object" || ob ject.preview);
1187 } 1187 };
1188 1188
1189 /** 1189 /**
1190 * @param {!WebInspector.RemoteObject} func 1190 * @param {!WebInspector.RemoteObject} func
1191 * @param {!Element} element 1191 * @param {!Element} element
1192 * @param {boolean} linkify 1192 * @param {boolean} linkify
1193 * @param {boolean=} includePreview 1193 * @param {boolean=} includePreview
1194 */ 1194 */
1195 WebInspector.ObjectPropertiesSection.formatObjectAsFunction = function(func, ele ment, linkify, includePreview) 1195 WebInspector.ObjectPropertiesSection.formatObjectAsFunction = function(func, ele ment, linkify, includePreview)
1196 { 1196 {
1197 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails); 1197 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 if (doneProcessing) 1260 if (doneProcessing)
1261 return; 1261 return;
1262 if (token === "(") { 1262 if (token === "(") {
1263 params = []; 1263 params = [];
1264 return; 1264 return;
1265 } 1265 }
1266 if (params && tokenType === "js-def") 1266 if (params && tokenType === "js-def")
1267 params.push(token); 1267 params.push(token);
1268 } 1268 }
1269 } 1269 }
1270 } 1270 };
1271 1271
1272 /** 1272 /**
1273 * @constructor 1273 * @constructor
1274 */ 1274 */
1275 WebInspector.ObjectPropertiesSectionExpandController = function() 1275 WebInspector.ObjectPropertiesSectionExpandController = function()
1276 { 1276 {
1277 /** @type {!Set.<string>} */ 1277 /** @type {!Set.<string>} */
1278 this._expandedProperties = new Set(); 1278 this._expandedProperties = new Set();
1279 } 1279 };
1280 1280
1281 WebInspector.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol( "cachedPath"); 1281 WebInspector.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol( "cachedPath");
1282 WebInspector.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol("tr eeOutlineId"); 1282 WebInspector.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol("tr eeOutlineId");
1283 1283
1284 WebInspector.ObjectPropertiesSectionExpandController.prototype = { 1284 WebInspector.ObjectPropertiesSectionExpandController.prototype = {
1285 /** 1285 /**
1286 * @param {string} id 1286 * @param {string} id
1287 * @param {!WebInspector.ObjectPropertiesSection} section 1287 * @param {!WebInspector.ObjectPropertiesSection} section
1288 */ 1288 */
1289 watchSection: function(id, section) 1289 watchSection: function(id, section)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 currentName = typeof current.title === "string" ? current.title : current.title.textContent; 1359 currentName = typeof current.title === "string" ? current.title : current.title.textContent;
1360 1360
1361 result = currentName + (result ? "." + result : ""); 1361 result = currentName + (result ? "." + result : "");
1362 current = current.parent; 1362 current = current.parent;
1363 } 1363 }
1364 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; 1364 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId];
1365 result = treeOutlineId + (result ? ":" + result : ""); 1365 result = treeOutlineId + (result ? ":" + result : "");
1366 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; 1366 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result;
1367 return result; 1367 return result;
1368 } 1368 }
1369 } 1369 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698