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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 WebInspector.ObjectPropertyTreeElement = function(property) | 208 WebInspector.ObjectPropertyTreeElement = function(property) |
| 209 { | 209 { |
| 210 this.property = property; | 210 this.property = property; |
| 211 | 211 |
| 212 // Pass an empty title, the title gets made later in onattach. | 212 // Pass an empty title, the title gets made later in onattach. |
| 213 TreeElement.call(this); | 213 TreeElement.call(this); |
| 214 this.toggleOnClick = true; | 214 this.toggleOnClick = true; |
| 215 this.selectable = false; | 215 this.selectable = false; |
| 216 /** @type {!Array.<!Object>} */ | 216 /** @type {!Array.<!Object>} */ |
| 217 this._highlightChanges = []; | 217 this._highlightChanges = []; |
| 218 | |
| 219 this._linkifier = new WebInspector.Linkifier(); | |
|
dgozman
2016/07/06 19:25:12
Let's pass linkifier from the user of ObjectProper
kozy
2016/07/06 22:38:41
Done.
| |
| 218 } | 220 } |
| 219 | 221 |
| 220 WebInspector.ObjectPropertyTreeElement.prototype = { | 222 WebInspector.ObjectPropertyTreeElement.prototype = { |
| 221 /** | 223 /** |
| 222 * @param {!RegExp} regex | 224 * @param {!RegExp} regex |
| 223 * @param {string=} additionalCssClassName | 225 * @param {string=} additionalCssClassName |
| 224 * @return {boolean} | 226 * @return {boolean} |
| 225 */ | 227 */ |
| 226 setSearchRegex: function(regex, additionalCssClassName) { | 228 setSearchRegex: function(regex, additionalCssClassName) { |
| 227 var cssClasses = WebInspector.highlightedSearchResultClassName; | 229 var cssClasses = WebInspector.highlightedSearchResultClassName; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 if (this.property.synthetic) | 304 if (this.property.synthetic) |
| 303 this.nameElement.classList.add("synthetic-property"); | 305 this.nameElement.classList.add("synthetic-property"); |
| 304 | 306 |
| 305 this._updatePropertyPath(); | 307 this._updatePropertyPath(); |
| 306 this.nameElement.addEventListener("contextmenu", this._contextMenuFired. bind(this, this.property), false); | 308 this.nameElement.addEventListener("contextmenu", this._contextMenuFired. bind(this, this.property), false); |
| 307 | 309 |
| 308 var separatorElement = createElementWithClass("span", "object-properties -section-separator"); | 310 var separatorElement = createElementWithClass("span", "object-properties -section-separator"); |
| 309 separatorElement.textContent = ": "; | 311 separatorElement.textContent = ": "; |
| 310 | 312 |
| 311 if (this.property.value) { | 313 if (this.property.value) { |
| 312 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, this._linkifier); |
| 313 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property), false); | 315 this.valueElement.addEventListener("contextmenu", this._contextMenuF ired.bind(this, this.property), false); |
| 314 } else if (this.property.getter) { | 316 } else if (this.property.getter) { |
| 315 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)); |
| 316 } else { | 318 } else { |
| 317 this.valueElement = createElementWithClass("span", "object-value-und efined"); | 319 this.valueElement = createElementWithClass("span", "object-value-und efined"); |
| 318 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); | 320 this.valueElement.textContent = WebInspector.UIString("<unreadable>" ); |
| 319 this.valueElement.title = WebInspector.UIString("No property getter" ); | 321 this.valueElement.title = WebInspector.UIString("No property getter" ); |
| 320 } | 322 } |
| 321 | 323 |
| 322 this.listItemElement.removeChildren(); | 324 this.listItemElement.removeChildren(); |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1095 matches = /[^(]*(\([^)]*)/.exec(text); | 1097 matches = /[^(]*(\([^)]*)/.exec(text); |
| 1096 } | 1098 } |
| 1097 var match = matches ? matches[1] : null; | 1099 var match = matches ? matches[1] : null; |
| 1098 return match ? match.replace(/\n/g, " ") + ")" : (text || ""); | 1100 return match ? match.replace(/\n/g, " ") + ")" : (text || ""); |
| 1099 } | 1101 } |
| 1100 | 1102 |
| 1101 /** | 1103 /** |
| 1102 * @param {!WebInspector.RemoteObject} value | 1104 * @param {!WebInspector.RemoteObject} value |
| 1103 * @param {boolean} wasThrown | 1105 * @param {boolean} wasThrown |
| 1104 * @param {!Element=} parentElement | 1106 * @param {!Element=} parentElement |
| 1107 * @param {!WebInspector.Linkifier=} linkifier | |
| 1105 * @return {!Element} | 1108 * @return {!Element} |
| 1106 */ | 1109 */ |
| 1107 WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = funct ion(value, wasThrown, parentElement) | 1110 WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = funct ion(value, wasThrown, parentElement, linkifier) |
| 1108 { | 1111 { |
| 1109 if (value.customPreview()) { | 1112 if (value.customPreview()) { |
| 1110 var result = (new WebInspector.CustomPreviewComponent(value)).element; | 1113 var result = (new WebInspector.CustomPreviewComponent(value)).element; |
| 1111 result.classList.add("object-properties-section-custom-section"); | 1114 result.classList.add("object-properties-section-custom-section"); |
| 1112 return result | 1115 return result |
| 1113 } | 1116 } |
| 1114 return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThr own, parentElement); | 1117 return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThr own, parentElement, linkifier); |
| 1115 } | 1118 } |
| 1116 | 1119 |
| 1117 /** | 1120 /** |
| 1118 * @param {!WebInspector.RemoteObject} value | 1121 * @param {!WebInspector.RemoteObject} value |
| 1119 * @param {boolean} wasThrown | 1122 * @param {boolean} wasThrown |
| 1120 * @param {!Element=} parentElement | 1123 * @param {!Element=} parentElement |
| 1124 * @param {!WebInspector.Linkifier=} linkifier | |
| 1121 * @return {!Element} | 1125 * @return {!Element} |
| 1122 */ | 1126 */ |
| 1123 WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr own, parentElement) | 1127 WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr own, parentElement, linkifier) |
| 1124 { | 1128 { |
| 1125 var valueElement = createElementWithClass("span", "value"); | 1129 var valueElement = createElementWithClass("span", "value"); |
| 1126 var type = value.type; | 1130 var type = value.type; |
| 1127 var subtype = value.subtype; | 1131 var subtype = value.subtype; |
| 1128 var description = value.description; | 1132 var description = value.description; |
| 1129 var prefix; | 1133 var prefix; |
| 1130 var valueText; | 1134 var valueText; |
| 1131 var suffix; | 1135 var suffix; |
| 1132 if (wasThrown) { | 1136 if (wasThrown) { |
| 1133 prefix = "[Exception: "; | 1137 prefix = "[Exception: "; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1167 | 1171 |
| 1168 if (type === "object" && subtype === "node" && description) { | 1172 if (type === "object" && subtype === "node" && description) { |
| 1169 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(valueElement, description); | 1173 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(valueElement, description); |
| 1170 valueElement.addEventListener("click", mouseClick, false); | 1174 valueElement.addEventListener("click", mouseClick, false); |
| 1171 valueElement.addEventListener("mousemove", mouseMove, false); | 1175 valueElement.addEventListener("mousemove", mouseMove, false); |
| 1172 valueElement.addEventListener("mouseleave", mouseLeave, false); | 1176 valueElement.addEventListener("mouseleave", mouseLeave, false); |
| 1173 } else { | 1177 } else { |
| 1174 valueElement.title = description || ""; | 1178 valueElement.title = description || ""; |
| 1175 } | 1179 } |
| 1176 | 1180 |
| 1181 if (type === "object" && subtype === "internal#location" && linkifier) { | |
| 1182 var loc = value.value; | |
| 1183 return linkifier.linkifyScriptLocation(value.target(), loc.scriptId, "", loc.lineNumber, loc.columnNumber); | |
| 1184 } | |
| 1185 | |
| 1177 function mouseMove() | 1186 function mouseMove() |
| 1178 { | 1187 { |
| 1179 WebInspector.DOMModel.highlightObjectAsDOMNode(value); | 1188 WebInspector.DOMModel.highlightObjectAsDOMNode(value); |
| 1180 } | 1189 } |
| 1181 | 1190 |
| 1182 function mouseLeave() | 1191 function mouseLeave() |
| 1183 { | 1192 { |
| 1184 WebInspector.DOMModel.hideDOMNodeHighlight(); | 1193 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 1185 } | 1194 } |
| 1186 | 1195 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1363 | 1372 |
| 1364 result = currentName + (result ? "." + result : ""); | 1373 result = currentName + (result ? "." + result : ""); |
| 1365 current = current.parent; | 1374 current = current.parent; |
| 1366 } | 1375 } |
| 1367 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; | 1376 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; |
| 1368 result = treeOutlineId + (result ? ":" + result : ""); | 1377 result = treeOutlineId + (result ? ":" + result : ""); |
| 1369 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; | 1378 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; |
| 1370 return result; | 1379 return result; |
| 1371 } | 1380 } |
| 1372 } | 1381 } |
| OLD | NEW |