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 5f9d406b81aa8eec22eed1aa4f21b687c513ea82..c99038b48a746b36bfee41eb5d4c84c529549683 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| @@ -29,18 +29,19 @@ |
| * @extends {TreeOutlineInShadow} |
| * @param {!WebInspector.RemoteObject} object |
| * @param {?string|!Element=} title |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @param {?string=} emptyPlaceholder |
| * @param {boolean=} ignoreHasOwnProperty |
| * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties |
| */ |
| -WebInspector.ObjectPropertiesSection = function(object, title, emptyPlaceholder, ignoreHasOwnProperty, extraProperties) |
| +WebInspector.ObjectPropertiesSection = function(object, title, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties) |
| { |
| this._object = object; |
| this._editable = true; |
| TreeOutlineInShadow.call(this); |
| this.hideOverflow(); |
| this.setFocusable(false); |
| - this._objectTreeElement = new WebInspector.ObjectPropertiesSection.RootElement(object, emptyPlaceholder, ignoreHasOwnProperty, extraProperties); |
| + this._objectTreeElement = new WebInspector.ObjectPropertiesSection.RootElement(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties); |
| this.appendChild(this._objectTreeElement); |
| if (typeof title === "string" || !title) |
| this.element.createChild("span").textContent = title || ""; |
| @@ -58,10 +59,11 @@ WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100; |
| /** |
| * @param {!WebInspector.RemoteObject} object |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @param {boolean=} skipProto |
| * @return {!Element} |
| */ |
| -WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object, skipProto) |
| +WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object, linkifier, skipProto) |
| { |
| var componentRoot = createElementWithClass("span", "source-code"); |
| var shadowRoot = WebInspector.createShadowRootWithCoreStyles(componentRoot, "components/objectValue.css"); |
| @@ -69,7 +71,7 @@ WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object |
| if (!object.hasChildren) |
| return componentRoot; |
| - var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(object, componentRoot); |
| + var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(object, componentRoot, linkifier); |
| objectPropertiesSection.editable = false; |
| if (skipProto) |
| objectPropertiesSection.skipProto(); |
| @@ -150,11 +152,12 @@ WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, pro |
| * @constructor |
| * @extends {TreeElement} |
| * @param {!WebInspector.RemoteObject} object |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @param {?string=} emptyPlaceholder |
| * @param {boolean=} ignoreHasOwnProperty |
| * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties |
| */ |
| -WebInspector.ObjectPropertiesSection.RootElement = function(object, emptyPlaceholder, ignoreHasOwnProperty, extraProperties) |
| +WebInspector.ObjectPropertiesSection.RootElement = function(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties) |
| { |
| this._object = object; |
| this._extraProperties = extraProperties || []; |
| @@ -166,6 +169,7 @@ WebInspector.ObjectPropertiesSection.RootElement = function(object, emptyPlaceho |
| this.selectable = false; |
| this.toggleOnClick = true; |
| this.listItemElement.classList.add("object-properties-section-root-element"); |
| + this._linkifier = linkifier; |
| } |
| WebInspector.ObjectPropertiesSection.RootElement.prototype = { |
| @@ -194,7 +198,7 @@ WebInspector.ObjectPropertiesSection.RootElement.prototype = { |
| onpopulate: function() |
| { |
| - WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!this.treeOutline._skipProto, this._emptyPlaceholder, this._ignoreHasOwnProperty, this._extraProperties); |
| + WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!this.treeOutline._skipProto, this._linkifier, this._emptyPlaceholder, this._ignoreHasOwnProperty, this._extraProperties); |
| }, |
| __proto__: TreeElement.prototype |
| @@ -204,8 +208,9 @@ WebInspector.ObjectPropertiesSection.RootElement.prototype = { |
| * @constructor |
| * @extends {TreeElement} |
| * @param {!WebInspector.RemoteObjectProperty} property |
| + * @param {?WebInspector.Linkifier=} linkifier |
| */ |
| -WebInspector.ObjectPropertyTreeElement = function(property) |
| +WebInspector.ObjectPropertyTreeElement = function(property, linkifier) |
| { |
| this.property = property; |
| @@ -215,6 +220,8 @@ WebInspector.ObjectPropertyTreeElement = function(property) |
| this.selectable = false; |
| /** @type {!Array.<!Object>} */ |
| this._highlightChanges = []; |
| + |
|
dgozman
2016/07/07 00:44:34
nit: extra blank line?
kozy
2016/07/07 17:58:02
Done.
|
| + this._linkifier = linkifier; |
| } |
| WebInspector.ObjectPropertyTreeElement.prototype = { |
| @@ -268,7 +275,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { |
| console.assert(propertyValue); |
| var skipProto = this.treeOutline ? this.treeOutline._skipProto : true; |
| var targetValue = this.property.name !== "__proto__" ? propertyValue : this.property.parentObject; |
| - WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, skipProto, undefined, undefined, undefined, targetValue); |
| + WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, skipProto, this._linkifier, undefined, undefined, undefined, targetValue); |
| }, |
| /** |
| @@ -309,7 +316,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { |
| separatorElement.textContent = ": "; |
| if (this.property.value) { |
| - this.valueElement = WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport(this.property.value, this.property.wasThrown, this.listItemElement); |
| + this.valueElement = WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport(this.property.value, this.property.wasThrown, this.listItemElement, this._linkifier); |
| this.valueElement.addEventListener("contextmenu", this._contextMenuFired.bind(this, this.property), false); |
| } else if (this.property.getter) { |
| this.valueElement = WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this)); |
| @@ -498,12 +505,13 @@ WebInspector.ObjectPropertyTreeElement.prototype = { |
| * @param {!TreeElement} treeElement |
| * @param {!WebInspector.RemoteObject} value |
| * @param {boolean} skipProto |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @param {?string=} emptyPlaceholder |
| * @param {boolean=} flattenProtoChain |
| * @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties |
| * @param {!WebInspector.RemoteObject=} targetValue |
| */ |
| -WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, skipProto, emptyPlaceholder, flattenProtoChain, extraProperties, targetValue) |
| +WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, skipProto, linkifier, emptyPlaceholder, flattenProtoChain, extraProperties, targetValue) |
| { |
| if (value.arrayLength() > WebInspector.ObjectPropertiesSection._arrayLoadThreshold) { |
| treeElement.removeChildren(); |
| @@ -526,7 +534,7 @@ WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, |
| properties.push(extraProperties[i]); |
| WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElement, properties, internalProperties, |
| - skipProto, targetValue || value, emptyPlaceholder); |
| + skipProto, targetValue || value, linkifier, emptyPlaceholder); |
| } |
| if (flattenProtoChain) |
| @@ -541,9 +549,10 @@ WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, |
| * @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties |
| * @param {boolean} skipProto |
| * @param {?WebInspector.RemoteObject} value |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @param {?string=} emptyPlaceholder |
| */ |
| -WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNode, properties, internalProperties, skipProto, value, emptyPlaceholder) { |
| +WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNode, properties, internalProperties, skipProto, value, linkifier, emptyPlaceholder) { |
| properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties); |
| for (var i = 0; i < properties.length; ++i) { |
| @@ -575,7 +584,7 @@ WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNod |
| if (internalProperties) { |
| for (var i = 0; i < internalProperties.length; i++) { |
| internalProperties[i].parentObject = value; |
| - var treeElement = new WebInspector.ObjectPropertyTreeElement(internalProperties[i]); |
| + var treeElement = new WebInspector.ObjectPropertyTreeElement(internalProperties[i], linkifier); |
| if (internalProperties[i].name === "[[Entries]]") { |
| treeElement.setExpandable(true); |
| treeElement.expand(); |
| @@ -746,7 +755,7 @@ WebInspector.ScopeTreeElement = function(title, remoteObject) |
| WebInspector.ScopeTreeElement.prototype = { |
| onpopulate: function() |
| { |
| - WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObject, false); |
| + WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObject, false, null); |
| }, |
| __proto__: TreeElement.prototype |
| @@ -1102,25 +1111,27 @@ WebInspector.ObjectPropertiesSection.valueTextForFunctionDescription = function( |
| * @param {!WebInspector.RemoteObject} value |
| * @param {boolean} wasThrown |
| * @param {!Element=} parentElement |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @return {!Element} |
| */ |
| -WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = function(value, wasThrown, parentElement) |
| +WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = function(value, wasThrown, parentElement, linkifier) |
| { |
| if (value.customPreview()) { |
| var result = (new WebInspector.CustomPreviewComponent(value)).element; |
| result.classList.add("object-properties-section-custom-section"); |
| return result |
| } |
| - return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThrown, parentElement); |
| + return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThrown, parentElement, linkifier); |
| } |
| /** |
| * @param {!WebInspector.RemoteObject} value |
| * @param {boolean} wasThrown |
| * @param {!Element=} parentElement |
| + * @param {?WebInspector.Linkifier=} linkifier |
| * @return {!Element} |
| */ |
| -WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThrown, parentElement) |
| +WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThrown, parentElement, linkifier) |
| { |
| var valueElement = createElementWithClass("span", "value"); |
| var type = value.type; |
| @@ -1174,6 +1185,11 @@ WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr |
| valueElement.title = description || ""; |
| } |
| + if (type === "object" && subtype === "internal#location" && linkifier) { |
| + var loc = value.value; |
| + return linkifier.linkifyScriptLocation(value.target(), loc.scriptId, "", loc.lineNumber, loc.columnNumber); |
| + } |
| + |
| function mouseMove() |
| { |
| WebInspector.DOMModel.highlightObjectAsDOMNode(value); |