Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 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 * @constructor | 28 * @constructor |
| 29 * @extends {TreeOutlineInShadow} | 29 * @extends {TreeOutlineInShadow} |
| 30 * @param {!WebInspector.RemoteObject} object | 30 * @param {!WebInspector.RemoteObject} object |
| 31 * @param {?string|!Element=} title | 31 * @param {?string|!Element=} title |
| 32 * @param {?WebInspector.Linkifier=} linkifier | |
| 32 * @param {?string=} emptyPlaceholder | 33 * @param {?string=} emptyPlaceholder |
| 33 * @param {boolean=} ignoreHasOwnProperty | 34 * @param {boolean=} ignoreHasOwnProperty |
| 34 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties | 35 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties |
| 35 */ | 36 */ |
| 36 WebInspector.ObjectPropertiesSection = function(object, title, emptyPlaceholder, ignoreHasOwnProperty, extraProperties) | 37 WebInspector.ObjectPropertiesSection = function(object, title, linkifier, emptyP laceholder, ignoreHasOwnProperty, extraProperties) |
| 37 { | 38 { |
| 38 this._object = object; | 39 this._object = object; |
| 39 this._editable = true; | 40 this._editable = true; |
| 40 TreeOutlineInShadow.call(this); | 41 TreeOutlineInShadow.call(this); |
| 41 this.hideOverflow(); | 42 this.hideOverflow(); |
| 42 this.setFocusable(false); | 43 this.setFocusable(false); |
| 43 this._objectTreeElement = new WebInspector.ObjectPropertiesSection.RootEleme nt(object, emptyPlaceholder, ignoreHasOwnProperty, extraProperties); | 44 this._objectTreeElement = new WebInspector.ObjectPropertiesSection.RootEleme nt(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties); |
| 44 this.appendChild(this._objectTreeElement); | 45 this.appendChild(this._objectTreeElement); |
| 45 if (typeof title === "string" || !title) | 46 if (typeof title === "string" || !title) |
| 46 this.element.createChild("span").textContent = title || ""; | 47 this.element.createChild("span").textContent = title || ""; |
| 47 else | 48 else |
| 48 this.element.appendChild(title); | 49 this.element.appendChild(title); |
| 49 | 50 |
| 50 this.element._section = this; | 51 this.element._section = this; |
| 51 this.registerRequiredCSS("components/objectValue.css"); | 52 this.registerRequiredCSS("components/objectValue.css"); |
| 52 this.registerRequiredCSS("components/objectPropertiesSection.css"); | 53 this.registerRequiredCSS("components/objectPropertiesSection.css"); |
| 53 this.rootElement().childrenListElement.classList.add("source-code", "object- properties-section"); | 54 this.rootElement().childrenListElement.classList.add("source-code", "object- properties-section"); |
| 54 } | 55 } |
| 55 | 56 |
| 56 /** @const */ | 57 /** @const */ |
| 57 WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100; | 58 WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100; |
| 58 | 59 |
| 59 /** | 60 /** |
| 60 * @param {!WebInspector.RemoteObject} object | 61 * @param {!WebInspector.RemoteObject} object |
| 62 * @param {?WebInspector.Linkifier=} linkifier | |
| 61 * @param {boolean=} skipProto | 63 * @param {boolean=} skipProto |
| 62 * @return {!Element} | 64 * @return {!Element} |
| 63 */ | 65 */ |
| 64 WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object , skipProto) | 66 WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object , linkifier, skipProto) |
| 65 { | 67 { |
| 66 var componentRoot = createElementWithClass("span", "source-code"); | 68 var componentRoot = createElementWithClass("span", "source-code"); |
| 67 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(componentRoot, "components/objectValue.css"); | 69 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(componentRoot, "components/objectValue.css"); |
| 68 shadowRoot.appendChild(WebInspector.ObjectPropertiesSection.createValueEleme nt(object, false)); | 70 shadowRoot.appendChild(WebInspector.ObjectPropertiesSection.createValueEleme nt(object, false)); |
| 69 if (!object.hasChildren) | 71 if (!object.hasChildren) |
| 70 return componentRoot; | 72 return componentRoot; |
| 71 | 73 |
| 72 var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(objec t, componentRoot); | 74 var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(objec t, componentRoot, linkifier); |
| 73 objectPropertiesSection.editable = false; | 75 objectPropertiesSection.editable = false; |
| 74 if (skipProto) | 76 if (skipProto) |
| 75 objectPropertiesSection.skipProto(); | 77 objectPropertiesSection.skipProto(); |
| 76 | 78 |
| 77 return objectPropertiesSection.element; | 79 return objectPropertiesSection.element; |
| 78 } | 80 } |
| 79 | 81 |
| 80 WebInspector.ObjectPropertiesSection.prototype = { | 82 WebInspector.ObjectPropertiesSection.prototype = { |
| 81 skipProto: function() | 83 skipProto: function() |
| 82 { | 84 { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 return 1; | 145 return 1; |
| 144 if (propertyB.symbol && !propertyA.symbol) | 146 if (propertyB.symbol && !propertyA.symbol) |
| 145 return -1; | 147 return -1; |
| 146 return String.naturalOrderComparator(a, b); | 148 return String.naturalOrderComparator(a, b); |
| 147 } | 149 } |
| 148 | 150 |
| 149 /** | 151 /** |
| 150 * @constructor | 152 * @constructor |
| 151 * @extends {TreeElement} | 153 * @extends {TreeElement} |
| 152 * @param {!WebInspector.RemoteObject} object | 154 * @param {!WebInspector.RemoteObject} object |
| 155 * @param {?WebInspector.Linkifier=} linkifier | |
| 153 * @param {?string=} emptyPlaceholder | 156 * @param {?string=} emptyPlaceholder |
| 154 * @param {boolean=} ignoreHasOwnProperty | 157 * @param {boolean=} ignoreHasOwnProperty |
| 155 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties | 158 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties |
| 156 */ | 159 */ |
| 157 WebInspector.ObjectPropertiesSection.RootElement = function(object, emptyPlaceho lder, ignoreHasOwnProperty, extraProperties) | 160 WebInspector.ObjectPropertiesSection.RootElement = function(object, linkifier, e mptyPlaceholder, ignoreHasOwnProperty, extraProperties) |
| 158 { | 161 { |
| 159 this._object = object; | 162 this._object = object; |
| 160 this._extraProperties = extraProperties || []; | 163 this._extraProperties = extraProperties || []; |
| 161 this._ignoreHasOwnProperty = !!ignoreHasOwnProperty; | 164 this._ignoreHasOwnProperty = !!ignoreHasOwnProperty; |
| 162 this._emptyPlaceholder = emptyPlaceholder; | 165 this._emptyPlaceholder = emptyPlaceholder; |
| 163 var contentElement = createElement("content"); | 166 var contentElement = createElement("content"); |
| 164 TreeElement.call(this, contentElement); | 167 TreeElement.call(this, contentElement); |
| 165 this.setExpandable(true); | 168 this.setExpandable(true); |
| 166 this.selectable = false; | 169 this.selectable = false; |
| 167 this.toggleOnClick = true; | 170 this.toggleOnClick = true; |
| 168 this.listItemElement.classList.add("object-properties-section-root-element") ; | 171 this.listItemElement.classList.add("object-properties-section-root-element") ; |
| 172 this._linkifier = linkifier; | |
| 169 } | 173 } |
| 170 | 174 |
| 171 WebInspector.ObjectPropertiesSection.RootElement.prototype = { | 175 WebInspector.ObjectPropertiesSection.RootElement.prototype = { |
| 172 | 176 |
| 173 onexpand: function() | 177 onexpand: function() |
| 174 { | 178 { |
| 175 if (this.treeOutline) | 179 if (this.treeOutline) |
| 176 this.treeOutline.element.classList.add("expanded"); | 180 this.treeOutline.element.classList.add("expanded"); |
| 177 }, | 181 }, |
| 178 | 182 |
| 179 oncollapse: function() | 183 oncollapse: function() |
| 180 { | 184 { |
| 181 if (this.treeOutline) | 185 if (this.treeOutline) |
| 182 this.treeOutline.element.classList.remove("expanded"); | 186 this.treeOutline.element.classList.remove("expanded"); |
| 183 }, | 187 }, |
| 184 | 188 |
| 185 /** | 189 /** |
| 186 * @override | 190 * @override |
| 187 * @param {!Event} e | 191 * @param {!Event} e |
| 188 * @return {boolean} | 192 * @return {boolean} |
| 189 */ | 193 */ |
| 190 ondblclick: function(e) | 194 ondblclick: function(e) |
| 191 { | 195 { |
| 192 return true; | 196 return true; |
| 193 }, | 197 }, |
| 194 | 198 |
| 195 onpopulate: function() | 199 onpopulate: function() |
| 196 { | 200 { |
| 197 WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!t his.treeOutline._skipProto, this._emptyPlaceholder, this._ignoreHasOwnProperty, this._extraProperties); | 201 WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!t his.treeOutline._skipProto, this._linkifier, this._emptyPlaceholder, this._ignor eHasOwnProperty, this._extraProperties); |
| 198 }, | 202 }, |
| 199 | 203 |
| 200 __proto__: TreeElement.prototype | 204 __proto__: TreeElement.prototype |
| 201 } | 205 } |
| 202 | 206 |
| 203 /** | 207 /** |
| 204 * @constructor | 208 * @constructor |
| 205 * @extends {TreeElement} | 209 * @extends {TreeElement} |
| 206 * @param {!WebInspector.RemoteObjectProperty} property | 210 * @param {!WebInspector.RemoteObjectProperty} property |
| 211 * @param {?WebInspector.Linkifier=} linkifier | |
| 207 */ | 212 */ |
| 208 WebInspector.ObjectPropertyTreeElement = function(property) | 213 WebInspector.ObjectPropertyTreeElement = function(property, linkifier) |
| 209 { | 214 { |
| 210 this.property = property; | 215 this.property = property; |
| 211 | 216 |
| 212 // Pass an empty title, the title gets made later in onattach. | 217 // Pass an empty title, the title gets made later in onattach. |
| 213 TreeElement.call(this); | 218 TreeElement.call(this); |
| 214 this.toggleOnClick = true; | 219 this.toggleOnClick = true; |
| 215 this.selectable = false; | 220 this.selectable = false; |
| 216 /** @type {!Array.<!Object>} */ | 221 /** @type {!Array.<!Object>} */ |
| 217 this._highlightChanges = []; | 222 this._highlightChanges = []; |
| 223 | |
|
dgozman
2016/07/07 00:44:34
nit: extra blank line?
kozy
2016/07/07 17:58:02
Done.
| |
| 224 this._linkifier = linkifier; | |
| 218 } | 225 } |
| 219 | 226 |
| 220 WebInspector.ObjectPropertyTreeElement.prototype = { | 227 WebInspector.ObjectPropertyTreeElement.prototype = { |
| 221 /** | 228 /** |
| 222 * @param {!RegExp} regex | 229 * @param {!RegExp} regex |
| 223 * @param {string=} additionalCssClassName | 230 * @param {string=} additionalCssClassName |
| 224 * @return {boolean} | 231 * @return {boolean} |
| 225 */ | 232 */ |
| 226 setSearchRegex: function(regex, additionalCssClassName) { | 233 setSearchRegex: function(regex, additionalCssClassName) { |
| 227 var cssClasses = WebInspector.highlightedSearchResultClassName; | 234 var cssClasses = WebInspector.highlightedSearchResultClassName; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 WebInspector.revertDomChanges(this._highlightChanges); | 268 WebInspector.revertDomChanges(this._highlightChanges); |
| 262 this._highlightChanges = []; | 269 this._highlightChanges = []; |
| 263 }, | 270 }, |
| 264 | 271 |
| 265 onpopulate: function() | 272 onpopulate: function() |
| 266 { | 273 { |
| 267 var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.prop erty.value); | 274 var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.prop erty.value); |
| 268 console.assert(propertyValue); | 275 console.assert(propertyValue); |
| 269 var skipProto = this.treeOutline ? this.treeOutline._skipProto : true; | 276 var skipProto = this.treeOutline ? this.treeOutline._skipProto : true; |
| 270 var targetValue = this.property.name !== "__proto__" ? propertyValue : t his.property.parentObject; | 277 var targetValue = this.property.name !== "__proto__" ? propertyValue : t his.property.parentObject; |
| 271 WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, sk ipProto, undefined, undefined, undefined, targetValue); | 278 WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, sk ipProto, this._linkifier, undefined, undefined, undefined, targetValue); |
| 272 }, | 279 }, |
| 273 | 280 |
| 274 /** | 281 /** |
| 275 * @override | 282 * @override |
| 276 * @return {boolean} | 283 * @return {boolean} |
| 277 */ | 284 */ |
| 278 ondblclick: function(event) | 285 ondblclick: function(event) |
| 279 { | 286 { |
| 280 var editableElement = this.valueElement; | 287 var editableElement = this.valueElement; |
| 281 if (!this.property.value.customPreview() && (this.property.writable || t his.property.setter) && event.target.isSelfOrDescendant(editableElement)) | 288 if (!this.property.value.customPreview() && (this.property.writable || t his.property.setter) && event.target.isSelfOrDescendant(editableElement)) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 302 if (this.property.synthetic) | 309 if (this.property.synthetic) |
| 303 this.nameElement.classList.add("synthetic-property"); | 310 this.nameElement.classList.add("synthetic-property"); |
| 304 | 311 |
| 305 this._updatePropertyPath(); | 312 this._updatePropertyPath(); |
| 306 this.nameElement.addEventListener("contextmenu", this._contextMenuFired. bind(this, this.property), false); | 313 this.nameElement.addEventListener("contextmenu", this._contextMenuFired. bind(this, this.property), false); |
| 307 | 314 |
| 308 var separatorElement = createElementWithClass("span", "object-properties -section-separator"); | 315 var separatorElement = createElementWithClass("span", "object-properties -section-separator"); |
| 309 separatorElement.textContent = ": "; | 316 separatorElement.textContent = ": "; |
| 310 | 317 |
| 311 if (this.property.value) { | 318 if (this.property.value) { |
| 312 this.valueElement = WebInspector.ObjectPropertiesSection.createValue ElementWithCustomSupport(this.property.value, this.property.wasThrown, this.list ItemElement); | 319 this.valueElement = WebInspector.ObjectPropertiesSection.createValue ElementWithCustomSupport(this.property.value, this.property.wasThrown, this.list ItemElement, this._linkifier); |
| 313 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property), false); | 320 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property), false); |
| 314 } else if (this.property.getter) { | 321 } else if (this.property.getter) { |
| 315 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); | 322 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); |
| 316 } else { | 323 } else { |
| 317 this.valueElement = createElementWithClass("span", "object-value-und efined"); | 324 this.valueElement = createElementWithClass("span", "object-value-und efined"); |
| 318 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); | 325 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); |
| 319 this.valueElement.title = WebInspector.UIString("No property getter" ); | 326 this.valueElement.title = WebInspector.UIString("No property getter" ); |
| 320 } | 327 } |
| 321 | 328 |
| 322 this.listItemElement.removeChildren(); | 329 this.listItemElement.removeChildren(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 this.setExpandable(false); | 498 this.setExpandable(false); |
| 492 }, | 499 }, |
| 493 | 500 |
| 494 __proto__: TreeElement.prototype | 501 __proto__: TreeElement.prototype |
| 495 } | 502 } |
| 496 | 503 |
| 497 /** | 504 /** |
| 498 * @param {!TreeElement} treeElement | 505 * @param {!TreeElement} treeElement |
| 499 * @param {!WebInspector.RemoteObject} value | 506 * @param {!WebInspector.RemoteObject} value |
| 500 * @param {boolean} skipProto | 507 * @param {boolean} skipProto |
| 508 * @param {?WebInspector.Linkifier=} linkifier | |
| 501 * @param {?string=} emptyPlaceholder | 509 * @param {?string=} emptyPlaceholder |
| 502 * @param {boolean=} flattenProtoChain | 510 * @param {boolean=} flattenProtoChain |
| 503 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties | 511 * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties |
| 504 * @param {!WebInspector.RemoteObject=} targetValue | 512 * @param {!WebInspector.RemoteObject=} targetValue |
| 505 */ | 513 */ |
| 506 WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, skipProto, emptyPlaceholder, flattenProtoChain, extraProperties, targetValue) | 514 WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, skipProto, linkifier, emptyPlaceholder, flattenProtoChain, extraProperties, targ etValue) |
| 507 { | 515 { |
| 508 if (value.arrayLength() > WebInspector.ObjectPropertiesSection._arrayLoadThr eshold) { | 516 if (value.arrayLength() > WebInspector.ObjectPropertiesSection._arrayLoadThr eshold) { |
| 509 treeElement.removeChildren(); | 517 treeElement.removeChildren(); |
| 510 WebInspector.ArrayGroupingTreeElement._populateArray(treeElement, value, 0, value.arrayLength() - 1); | 518 WebInspector.ArrayGroupingTreeElement._populateArray(treeElement, value, 0, value.arrayLength() - 1); |
| 511 return; | 519 return; |
| 512 } | 520 } |
| 513 | 521 |
| 514 /** | 522 /** |
| 515 * @param {?Array.<!WebInspector.RemoteObjectProperty>} properties | 523 * @param {?Array.<!WebInspector.RemoteObjectProperty>} properties |
| 516 * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties | 524 * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties |
| 517 */ | 525 */ |
| 518 function callback(properties, internalProperties) | 526 function callback(properties, internalProperties) |
| 519 { | 527 { |
| 520 treeElement.removeChildren(); | 528 treeElement.removeChildren(); |
| 521 if (!properties) | 529 if (!properties) |
| 522 return; | 530 return; |
| 523 | 531 |
| 524 extraProperties = extraProperties || []; | 532 extraProperties = extraProperties || []; |
| 525 for (var i = 0; i < extraProperties.length; ++i) | 533 for (var i = 0; i < extraProperties.length; ++i) |
| 526 properties.push(extraProperties[i]); | 534 properties.push(extraProperties[i]); |
| 527 | 535 |
| 528 WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElemen t, properties, internalProperties, | 536 WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElemen t, properties, internalProperties, |
| 529 skipProto, targetValue || value, emptyPlaceholder); | 537 skipProto, targetValue || value, linkifier, emptyPlaceholder); |
| 530 } | 538 } |
| 531 | 539 |
| 532 if (flattenProtoChain) | 540 if (flattenProtoChain) |
| 533 value.getAllProperties(false, callback); | 541 value.getAllProperties(false, callback); |
| 534 else | 542 else |
| 535 WebInspector.RemoteObject.loadFromObjectPerProto(value, callback); | 543 WebInspector.RemoteObject.loadFromObjectPerProto(value, callback); |
| 536 } | 544 } |
| 537 | 545 |
| 538 /** | 546 /** |
| 539 * @param {!TreeElement} treeNode | 547 * @param {!TreeElement} treeNode |
| 540 * @param {!Array.<!WebInspector.RemoteObjectProperty>} properties | 548 * @param {!Array.<!WebInspector.RemoteObjectProperty>} properties |
| 541 * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties | 549 * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties |
| 542 * @param {boolean} skipProto | 550 * @param {boolean} skipProto |
| 543 * @param {?WebInspector.RemoteObject} value | 551 * @param {?WebInspector.RemoteObject} value |
| 552 * @param {?WebInspector.Linkifier=} linkifier | |
| 544 * @param {?string=} emptyPlaceholder | 553 * @param {?string=} emptyPlaceholder |
| 545 */ | 554 */ |
| 546 WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNod e, properties, internalProperties, skipProto, value, emptyPlaceholder) { | 555 WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNod e, properties, internalProperties, skipProto, value, linkifier, emptyPlaceholder ) { |
| 547 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties); | 556 properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties); |
| 548 | 557 |
| 549 for (var i = 0; i < properties.length; ++i) { | 558 for (var i = 0; i < properties.length; ++i) { |
| 550 var property = properties[i]; | 559 var property = properties[i]; |
| 551 if (skipProto && property.name === "__proto__") | 560 if (skipProto && property.name === "__proto__") |
| 552 continue; | 561 continue; |
| 553 if (property.isAccessorProperty()) { | 562 if (property.isAccessorProperty()) { |
| 554 if (property.name !== "__proto__" && property.getter) { | 563 if (property.name !== "__proto__" && property.getter) { |
| 555 property.parentObject = value; | 564 property.parentObject = value; |
| 556 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement( property)); | 565 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement( property)); |
| 557 } | 566 } |
| 558 if (property.isOwn) { | 567 if (property.isOwn) { |
| 559 if (property.getter) { | 568 if (property.getter) { |
| 560 var getterProperty = new WebInspector.RemoteObjectProperty(" get " + property.name, property.getter); | 569 var getterProperty = new WebInspector.RemoteObjectProperty(" get " + property.name, property.getter); |
| 561 getterProperty.parentObject = value; | 570 getterProperty.parentObject = value; |
| 562 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElem ent(getterProperty)); | 571 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElem ent(getterProperty)); |
|
dgozman
2016/07/07 00:44:34
We should pass linkifier through everywhere.
kozy
2016/07/07 17:58:02
Done.
| |
| 563 } | 572 } |
| 564 if (property.setter) { | 573 if (property.setter) { |
| 565 var setterProperty = new WebInspector.RemoteObjectProperty(" set " + property.name, property.setter); | 574 var setterProperty = new WebInspector.RemoteObjectProperty(" set " + property.name, property.setter); |
| 566 setterProperty.parentObject = value; | 575 setterProperty.parentObject = value; |
| 567 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElem ent(setterProperty)); | 576 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElem ent(setterProperty)); |
| 568 } | 577 } |
| 569 } | 578 } |
| 570 } else { | 579 } else { |
| 571 property.parentObject = value; | 580 property.parentObject = value; |
| 572 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(prop erty)); | 581 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(prop erty)); |
| 573 } | 582 } |
| 574 } | 583 } |
| 575 if (internalProperties) { | 584 if (internalProperties) { |
| 576 for (var i = 0; i < internalProperties.length; i++) { | 585 for (var i = 0; i < internalProperties.length; i++) { |
| 577 internalProperties[i].parentObject = value; | 586 internalProperties[i].parentObject = value; |
| 578 var treeElement = new WebInspector.ObjectPropertyTreeElement(interna lProperties[i]); | 587 var treeElement = new WebInspector.ObjectPropertyTreeElement(interna lProperties[i], linkifier); |
| 579 if (internalProperties[i].name === "[[Entries]]") { | 588 if (internalProperties[i].name === "[[Entries]]") { |
| 580 treeElement.setExpandable(true); | 589 treeElement.setExpandable(true); |
| 581 treeElement.expand(); | 590 treeElement.expand(); |
| 582 } | 591 } |
| 583 treeNode.appendChild(treeElement); | 592 treeNode.appendChild(treeElement); |
| 584 } | 593 } |
| 585 } | 594 } |
| 586 if (value && value.type === "function") { | 595 if (value && value.type === "function") { |
| 587 // Whether function has TargetFunction internal property. | 596 // Whether function has TargetFunction internal property. |
| 588 // This is a simple way to tell that the function is actually a bound fu nction (we are not told). | 597 // This is a simple way to tell that the function is actually a bound fu nction (we are not told). |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 { | 748 { |
| 740 TreeElement.call(this, title, true); | 749 TreeElement.call(this, title, true); |
| 741 this.toggleOnClick = true; | 750 this.toggleOnClick = true; |
| 742 this.selectable = false; | 751 this.selectable = false; |
| 743 this._remoteObject = remoteObject; | 752 this._remoteObject = remoteObject; |
| 744 } | 753 } |
| 745 | 754 |
| 746 WebInspector.ScopeTreeElement.prototype = { | 755 WebInspector.ScopeTreeElement.prototype = { |
| 747 onpopulate: function() | 756 onpopulate: function() |
| 748 { | 757 { |
| 749 WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObjec t, false); | 758 WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObjec t, false, null); |
| 750 }, | 759 }, |
| 751 | 760 |
| 752 __proto__: TreeElement.prototype | 761 __proto__: TreeElement.prototype |
| 753 } | 762 } |
| 754 | 763 |
| 755 /** | 764 /** |
| 756 * @constructor | 765 * @constructor |
| 757 * @extends {TreeElement} | 766 * @extends {TreeElement} |
| 758 * @param {!WebInspector.RemoteObject} object | 767 * @param {!WebInspector.RemoteObject} object |
| 759 * @param {number} fromIndex | 768 * @param {number} fromIndex |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1095 matches = /[^(]*(\([^)]*)/.exec(text); | 1104 matches = /[^(]*(\([^)]*)/.exec(text); |
| 1096 } | 1105 } |
| 1097 var match = matches ? matches[1] : null; | 1106 var match = matches ? matches[1] : null; |
| 1098 return match ? match.replace(/\n/g, " ") + ")" : (text || ""); | 1107 return match ? match.replace(/\n/g, " ") + ")" : (text || ""); |
| 1099 } | 1108 } |
| 1100 | 1109 |
| 1101 /** | 1110 /** |
| 1102 * @param {!WebInspector.RemoteObject} value | 1111 * @param {!WebInspector.RemoteObject} value |
| 1103 * @param {boolean} wasThrown | 1112 * @param {boolean} wasThrown |
| 1104 * @param {!Element=} parentElement | 1113 * @param {!Element=} parentElement |
| 1114 * @param {?WebInspector.Linkifier=} linkifier | |
| 1105 * @return {!Element} | 1115 * @return {!Element} |
| 1106 */ | 1116 */ |
| 1107 WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = funct ion(value, wasThrown, parentElement) | 1117 WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = funct ion(value, wasThrown, parentElement, linkifier) |
| 1108 { | 1118 { |
| 1109 if (value.customPreview()) { | 1119 if (value.customPreview()) { |
| 1110 var result = (new WebInspector.CustomPreviewComponent(value)).element; | 1120 var result = (new WebInspector.CustomPreviewComponent(value)).element; |
| 1111 result.classList.add("object-properties-section-custom-section"); | 1121 result.classList.add("object-properties-section-custom-section"); |
| 1112 return result | 1122 return result |
| 1113 } | 1123 } |
| 1114 return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThr own, parentElement); | 1124 return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThr own, parentElement, linkifier); |
| 1115 } | 1125 } |
| 1116 | 1126 |
| 1117 /** | 1127 /** |
| 1118 * @param {!WebInspector.RemoteObject} value | 1128 * @param {!WebInspector.RemoteObject} value |
| 1119 * @param {boolean} wasThrown | 1129 * @param {boolean} wasThrown |
| 1120 * @param {!Element=} parentElement | 1130 * @param {!Element=} parentElement |
| 1131 * @param {?WebInspector.Linkifier=} linkifier | |
| 1121 * @return {!Element} | 1132 * @return {!Element} |
| 1122 */ | 1133 */ |
| 1123 WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr own, parentElement) | 1134 WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr own, parentElement, linkifier) |
| 1124 { | 1135 { |
| 1125 var valueElement = createElementWithClass("span", "value"); | 1136 var valueElement = createElementWithClass("span", "value"); |
| 1126 var type = value.type; | 1137 var type = value.type; |
| 1127 var subtype = value.subtype; | 1138 var subtype = value.subtype; |
| 1128 var description = value.description; | 1139 var description = value.description; |
| 1129 var prefix; | 1140 var prefix; |
| 1130 var valueText; | 1141 var valueText; |
| 1131 var suffix; | 1142 var suffix; |
| 1132 if (wasThrown) { | 1143 if (wasThrown) { |
| 1133 prefix = "[Exception: "; | 1144 prefix = "[Exception: "; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1167 | 1178 |
| 1168 if (type === "object" && subtype === "node" && description) { | 1179 if (type === "object" && subtype === "node" && description) { |
| 1169 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(valueElement, description); | 1180 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(valueElement, description); |
| 1170 valueElement.addEventListener("click", mouseClick, false); | 1181 valueElement.addEventListener("click", mouseClick, false); |
| 1171 valueElement.addEventListener("mousemove", mouseMove, false); | 1182 valueElement.addEventListener("mousemove", mouseMove, false); |
| 1172 valueElement.addEventListener("mouseleave", mouseLeave, false); | 1183 valueElement.addEventListener("mouseleave", mouseLeave, false); |
| 1173 } else { | 1184 } else { |
| 1174 valueElement.title = description || ""; | 1185 valueElement.title = description || ""; |
| 1175 } | 1186 } |
| 1176 | 1187 |
| 1188 if (type === "object" && subtype === "internal#location" && linkifier) { | |
| 1189 var loc = value.value; | |
| 1190 return linkifier.linkifyScriptLocation(value.target(), loc.scriptId, "", loc.lineNumber, loc.columnNumber); | |
| 1191 } | |
| 1192 | |
| 1177 function mouseMove() | 1193 function mouseMove() |
| 1178 { | 1194 { |
| 1179 WebInspector.DOMModel.highlightObjectAsDOMNode(value); | 1195 WebInspector.DOMModel.highlightObjectAsDOMNode(value); |
| 1180 } | 1196 } |
| 1181 | 1197 |
| 1182 function mouseLeave() | 1198 function mouseLeave() |
| 1183 { | 1199 { |
| 1184 WebInspector.DOMModel.hideDOMNodeHighlight(); | 1200 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 1185 } | 1201 } |
| 1186 | 1202 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 | 1379 |
| 1364 result = currentName + (result ? "." + result : ""); | 1380 result = currentName + (result ? "." + result : ""); |
| 1365 current = current.parent; | 1381 current = current.parent; |
| 1366 } | 1382 } |
| 1367 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; | 1383 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; |
| 1368 result = treeOutlineId + (result ? ":" + result : ""); | 1384 result = treeOutlineId + (result ? ":" + result : ""); |
| 1369 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; | 1385 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; |
| 1370 return result; | 1386 return result; |
| 1371 } | 1387 } |
| 1372 } | 1388 } |
| OLD | NEW |