| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 update: function() | 295 update: function() |
| 296 { | 296 { |
| 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 |
| 305 this.nameElement.addEventListener("contextmenu", this._contextMenuFi
red.bind(this, this.property.symbol), false); | 305 this._updatePropertyPath(); |
| 306 this.nameElement.addEventListener("contextmenu", this._contextMenuFired.
bind(this, this.property), false); |
| 306 | 307 |
| 307 var separatorElement = createElementWithClass("span", "object-properties
-section-separator"); | 308 var separatorElement = createElementWithClass("span", "object-properties
-section-separator"); |
| 308 separatorElement.textContent = ": "; | 309 separatorElement.textContent = ": "; |
| 309 | 310 |
| 310 if (this.property.value) { | 311 if (this.property.value) { |
| 311 this.valueElement = WebInspector.ObjectPropertiesSection.createValue
ElementWithCustomSupport(this.property.value, this.property.wasThrown, this.list
ItemElement); | 312 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); | 313 this.valueElement.addEventListener("contextmenu", this._contextMenuF
ired.bind(this, this.property), false); |
| 313 } else if (this.property.getter) { | 314 } else if (this.property.getter) { |
| 314 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem
oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name],
this._onInvokeGetterClick.bind(this)); | 315 this.valueElement = WebInspector.ObjectPropertyTreeElement.createRem
oteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name],
this._onInvokeGetterClick.bind(this)); |
| 315 } else { | 316 } else { |
| 316 this.valueElement = createElementWithClass("span", "object-value-und
efined"); | 317 this.valueElement = createElementWithClass("span", "object-value-und
efined"); |
| 317 this.valueElement.textContent = WebInspector.UIString("<unreadable>"
); | 318 this.valueElement.textContent = WebInspector.UIString("<unreadable>"
); |
| 318 this.valueElement.title = WebInspector.UIString("No property getter"
); | 319 this.valueElement.title = WebInspector.UIString("No property getter"
); |
| 319 } | 320 } |
| 320 | 321 |
| 321 this.listItemElement.removeChildren(); | 322 this.listItemElement.removeChildren(); |
| 322 this.listItemElement.appendChildren(this.nameElement, separatorElement,
this.valueElement); | 323 this.listItemElement.appendChildren(this.nameElement, separatorElement,
this.valueElement); |
| 323 }, | 324 }, |
| 324 | 325 |
| 325 _contextMenuFired: function(value, event) | 326 _updatePropertyPath: function() |
| 327 { |
| 328 if (this.nameElement.title) |
| 329 return; |
| 330 |
| 331 var useDotNotation = /^(_|\$|[A-Z])(_|\$|[A-Z]|\d)*$/i; |
| 332 var isInteger = /^[1-9]\d*$/; |
| 333 var name = this.property.name; |
| 334 var parentPath = this.parent.nameElement ? this.parent.nameElement.title
: ""; |
| 335 if (useDotNotation.test(name)) |
| 336 this.nameElement.title = parentPath + "." + name; |
| 337 else if (isInteger.test(name)) |
| 338 this.nameElement.title = parentPath + "[" + name + "]"; |
| 339 else |
| 340 this.nameElement.title = parentPath + "[\"" + name + "\"]"; |
| 341 }, |
| 342 |
| 343 /** |
| 344 * @param {!WebInspector.RemoteObjectProperty} property |
| 345 * @param {!Event} event |
| 346 */ |
| 347 _contextMenuFired: function(property, event) |
| 326 { | 348 { |
| 327 var contextMenu = new WebInspector.ContextMenu(event); | 349 var contextMenu = new WebInspector.ContextMenu(event); |
| 328 contextMenu.appendApplicableItems(value); | 350 if (property.symbol) |
| 351 contextMenu.appendApplicableItems(property.symbol); |
| 352 if (property.value) |
| 353 contextMenu.appendApplicableItems(property.value); |
| 354 var copyPathHandler = InspectorFrontendHost.copyText.bind(InspectorFront
endHost, this.nameElement.title); |
| 355 contextMenu.beforeShow(() => { contextMenu.appendItem(WebInspector.UIStr
ing.capitalize("Copy ^property ^path"), copyPathHandler); }); |
| 329 contextMenu.show(); | 356 contextMenu.show(); |
| 330 }, | 357 }, |
| 331 | 358 |
| 332 _startEditing: function() | 359 _startEditing: function() |
| 333 { | 360 { |
| 334 if (this._prompt || !this.treeOutline._editable || this._readOnly) | 361 if (this._prompt || !this.treeOutline._editable || this._readOnly) |
| 335 return; | 362 return; |
| 336 | 363 |
| 337 this._editableDiv = this.listItemElement.createChild("span"); | 364 this._editableDiv = this.listItemElement.createChild("span"); |
| 338 | 365 |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 | 1411 |
| 1385 result = currentName + (result ? "." + result : ""); | 1412 result = currentName + (result ? "." + result : ""); |
| 1386 current = current.parent; | 1413 current = current.parent; |
| 1387 } | 1414 } |
| 1388 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie
sSectionExpandController._treeOutlineId]; | 1415 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie
sSectionExpandController._treeOutlineId]; |
| 1389 result = treeOutlineId + (result ? ":" + result : ""); | 1416 result = treeOutlineId + (result ? ":" + result : ""); |
| 1390 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached
PathSymbol] = result; | 1417 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached
PathSymbol] = result; |
| 1391 return result; | 1418 return result; |
| 1392 } | 1419 } |
| 1393 } | 1420 } |
| OLD | NEW |