Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| index 0185ab8db2cc3962b61e354d929110dfcef5bbf7..9bdeae81e191a03f3e97e6a2f66d45f7949b0875 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| @@ -304,6 +304,9 @@ WebInspector.ObjectPropertyTreeElement.prototype = { |
| if (this.property.symbol) |
| this.nameElement.addEventListener("contextmenu", this._contextMenuFired.bind(this, this.property.symbol), false); |
| + this._updatePropertyPath(); |
| + this.nameElement.addEventListener("contextmenu", this._contextMenuFired.bind(this, this.nameElement), false); |
| + |
| var separatorElement = createElementWithClass("span", "object-properties-section-separator"); |
| separatorElement.textContent = ": "; |
| @@ -322,9 +325,28 @@ WebInspector.ObjectPropertyTreeElement.prototype = { |
| this.listItemElement.appendChildren(this.nameElement, separatorElement, this.valueElement); |
| }, |
| + _updatePropertyPath: function() |
| + { |
| + 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
|
| + return; |
| + |
| + var useDotNotation = /^(_|\$|[A-Z])(_|\$|[A-Z]|\d)*$/i; |
| + var isInteger = /^[1-9]\d*$/; |
| + var name = this.property.name; |
| + 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
|
| + if (useDotNotation.test(name)) |
| + this.nameElement.title = parentPath + "." + name; |
| + else if (isInteger.test(name)) |
| + this.nameElement.title = parentPath + "[" + name + "]"; |
| + else |
| + this.nameElement.title = parentPath + "[\"" + name + "\"]"; |
| + }, |
| + |
| _contextMenuFired: function(value, event) |
|
dgozman
2016/05/17 02:09:50
Let's annotate parameters.
luoe
2016/05/18 00:16:23
Done.
|
| { |
| var contextMenu = new WebInspector.ContextMenu(event); |
| + 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
|
| + contextMenu.appendItem(WebInspector.copyPropertyPathLabel(), InspectorFrontendHost.copyText.bind(InspectorFrontendHost, value.title)); |
| contextMenu.appendApplicableItems(value); |
| contextMenu.show(); |
| }, |