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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 this.nameElement = WebInspector.ObjectPropertiesSection.createNameElemen t(this.property.name); | 297 this.nameElement = WebInspector.ObjectPropertiesSection.createNameElemen t(this.property.name); |
| 298 if (!this.property.enumerable) | 298 if (!this.property.enumerable) |
| 299 this.nameElement.classList.add("object-properties-section-dimmed"); | 299 this.nameElement.classList.add("object-properties-section-dimmed"); |
| 300 if (this.property.isAccessorProperty()) | 300 if (this.property.isAccessorProperty()) |
| 301 this.nameElement.classList.add("properties-accessor-property-name"); | 301 this.nameElement.classList.add("properties-accessor-property-name"); |
| 302 if (this.property.synthetic) | 302 if (this.property.synthetic) |
| 303 this.nameElement.classList.add("synthetic-property"); | 303 this.nameElement.classList.add("synthetic-property"); |
| 304 if (this.property.symbol) | 304 if (this.property.symbol) |
| 305 this.nameElement.addEventListener("contextmenu", this._contextMenuFi red.bind(this, this.property.symbol), false); | 305 this.nameElement.addEventListener("contextmenu", this._contextMenuFi red.bind(this, this.property.symbol), false); |
| 306 | 306 |
| 307 this._updatePropertyPath(); | |
| 308 this.nameElement.addEventListener("contextmenu", this._contextMenuFired. bind(this, this.nameElement), false); | |
| 309 | |
| 307 var separatorElement = createElementWithClass("span", "object-properties -section-separator"); | 310 var separatorElement = createElementWithClass("span", "object-properties -section-separator"); |
| 308 separatorElement.textContent = ": "; | 311 separatorElement.textContent = ": "; |
| 309 | 312 |
| 310 if (this.property.value) { | 313 if (this.property.value) { |
| 311 this.valueElement = WebInspector.ObjectPropertiesSection.createValue ElementWithCustomSupport(this.property.value, this.property.wasThrown, this.list ItemElement); | 314 this.valueElement = WebInspector.ObjectPropertiesSection.createValue ElementWithCustomSupport(this.property.value, this.property.wasThrown, this.list ItemElement); |
| 312 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property.value), false); | 315 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property.value), false); |
| 313 } else if (this.property.getter) { | 316 } else if (this.property.getter) { |
| 314 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); | 317 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); |
| 315 } else { | 318 } else { |
| 316 this.valueElement = createElementWithClass("span", "object-value-und efined"); | 319 this.valueElement = createElementWithClass("span", "object-value-und efined"); |
| 317 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); | 320 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); |
| 318 this.valueElement.title = WebInspector.UIString("No property getter" ); | 321 this.valueElement.title = WebInspector.UIString("No property getter" ); |
| 319 } | 322 } |
| 320 | 323 |
| 321 this.listItemElement.removeChildren(); | 324 this.listItemElement.removeChildren(); |
| 322 this.listItemElement.appendChildren(this.nameElement, separatorElement, this.valueElement); | 325 this.listItemElement.appendChildren(this.nameElement, separatorElement, this.valueElement); |
| 323 }, | 326 }, |
| 324 | 327 |
| 328 _updatePropertyPath: function() | |
| 329 { | |
| 330 if (this.title) | |
|
dgozman
2016/05/17 02:09:50
Why this check?
luoe
2016/05/18 00:16:23
In the case when a property is a getter, clicking
| |
| 331 return; | |
| 332 | |
| 333 var useDotNotation = /^(_|\$|[A-Z])(_|\$|[A-Z]|\d)*$/i; | |
| 334 var isInteger = /^[1-9]\d*$/; | |
| 335 var name = this.property.name; | |
| 336 var parentPath = this.parent.nameElement ? this.parent.nameElement.title : "this"; | |
|
dgozman
2016/05/17 02:09:50
Could there be no parent?
luoe
2016/05/18 00:16:23
Currently, ObjectPropertiesSection.js is the only
| |
| 337 if (useDotNotation.test(name)) | |
| 338 this.nameElement.title = parentPath + "." + name; | |
| 339 else if (isInteger.test(name)) | |
| 340 this.nameElement.title = parentPath + "[" + name + "]"; | |
| 341 else | |
| 342 this.nameElement.title = parentPath + "[\"" + name + "\"]"; | |
| 343 }, | |
| 344 | |
| 325 _contextMenuFired: function(value, event) | 345 _contextMenuFired: function(value, event) |
|
dgozman
2016/05/17 02:09:50
Let's annotate parameters.
luoe
2016/05/18 00:16:23
Done.
| |
| 326 { | 346 { |
| 327 var contextMenu = new WebInspector.ContextMenu(event); | 347 var contextMenu = new WebInspector.ContextMenu(event); |
| 348 if (value && value.classList && value.classList.contains("name")) | |
|
dgozman
2016/05/17 02:09:50
How can value be null? Or value.classList?
luoe
2016/05/18 00:16:23
Refactored to avoid this check
| |
| 349 contextMenu.appendItem(WebInspector.copyPropertyPathLabel(), Inspect orFrontendHost.copyText.bind(InspectorFrontendHost, value.title)); | |
| 328 contextMenu.appendApplicableItems(value); | 350 contextMenu.appendApplicableItems(value); |
| 329 contextMenu.show(); | 351 contextMenu.show(); |
| 330 }, | 352 }, |
| 331 | 353 |
| 332 _startEditing: function() | 354 _startEditing: function() |
| 333 { | 355 { |
| 334 if (this._prompt || !this.treeOutline._editable || this._readOnly) | 356 if (this._prompt || !this.treeOutline._editable || this._readOnly) |
| 335 return; | 357 return; |
| 336 | 358 |
| 337 this._editableDiv = this.listItemElement.createChild("span"); | 359 this._editableDiv = this.listItemElement.createChild("span"); |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1384 | 1406 |
| 1385 result = currentName + (result ? "." + result : ""); | 1407 result = currentName + (result ? "." + result : ""); |
| 1386 current = current.parent; | 1408 current = current.parent; |
| 1387 } | 1409 } |
| 1388 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; | 1410 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; |
| 1389 result = treeOutlineId + (result ? ":" + result : ""); | 1411 result = treeOutlineId + (result ? ":" + result : ""); |
| 1390 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; | 1412 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; |
| 1391 return result; | 1413 return result; |
| 1392 } | 1414 } |
| 1393 } | 1415 } |
| OLD | NEW |