| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 * @param {!WebInspector.RemoteObjectProperty} property | 206 * @param {!WebInspector.RemoteObjectProperty} property |
| 207 */ | 207 */ |
| 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>} */ |
| 217 this._highlightChanges = []; |
| 216 } | 218 } |
| 217 | 219 |
| 218 WebInspector.ObjectPropertyTreeElement.prototype = { | 220 WebInspector.ObjectPropertyTreeElement.prototype = { |
| 221 /** |
| 222 * @param {!RegExp} regex |
| 223 * @param {string=} additionalCssClassName |
| 224 * @return {boolean} |
| 225 */ |
| 226 setSearchRegex: function(regex, additionalCssClassName) { |
| 227 var cssClasses = WebInspector.highlightedSearchResultClassName; |
| 228 if (additionalCssClassName) |
| 229 cssClasses += " " + additionalCssClassName; |
| 230 this.revertHighlightChanges(); |
| 231 |
| 232 this._applySearch(regex, this.nameElement, cssClasses); |
| 233 var valueType = this.property.value.type; |
| 234 if (valueType !== "object" && valueType !== "array") |
| 235 this._applySearch(regex, this.valueElement, cssClasses); |
| 236 |
| 237 return !!this._highlightChanges.length; |
| 238 }, |
| 239 |
| 240 /** |
| 241 * @param {!RegExp} regex |
| 242 * @param {!Element} element |
| 243 * @param {string} cssClassName |
| 244 */ |
| 245 _applySearch: function(regex, element, cssClassName) |
| 246 { |
| 247 var ranges = []; |
| 248 var content = element.textContent; |
| 249 regex.lastIndex = 0; |
| 250 var match = regex.exec(content); |
| 251 while (match) { |
| 252 ranges.push(new WebInspector.SourceRange(match.index, match[0].lengt
h)); |
| 253 match = regex.exec(content); |
| 254 } |
| 255 if (ranges.length) |
| 256 WebInspector.highlightRangesWithStyleClass(element, ranges, cssClass
Name, this._highlightChanges); |
| 257 }, |
| 258 |
| 259 revertHighlightChanges: function() |
| 260 { |
| 261 WebInspector.revertDomChanges(this._highlightChanges); |
| 262 this._highlightChanges = []; |
| 263 }, |
| 264 |
| 219 onpopulate: function() | 265 onpopulate: function() |
| 220 { | 266 { |
| 221 var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.prop
erty.value); | 267 var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.prop
erty.value); |
| 222 console.assert(propertyValue); | 268 console.assert(propertyValue); |
| 223 var skipProto = this.treeOutline ? this.treeOutline._skipProto : true; | 269 var skipProto = this.treeOutline ? this.treeOutline._skipProto : true; |
| 224 var targetValue = this.property.name !== "__proto__" ? propertyValue : t
his.property.parentObject; | 270 var targetValue = this.property.name !== "__proto__" ? propertyValue : t
his.property.parentObject; |
| 225 WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, sk
ipProto, undefined, undefined, undefined, targetValue); | 271 WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, sk
ipProto, undefined, undefined, undefined, targetValue); |
| 226 }, | 272 }, |
| 227 | 273 |
| 228 /** | 274 /** |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 | 1384 |
| 1339 result = currentName + (result ? "." + result : ""); | 1385 result = currentName + (result ? "." + result : ""); |
| 1340 current = current.parent; | 1386 current = current.parent; |
| 1341 } | 1387 } |
| 1342 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie
sSectionExpandController._treeOutlineId]; | 1388 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie
sSectionExpandController._treeOutlineId]; |
| 1343 result = treeOutlineId + (result ? ":" + result : ""); | 1389 result = treeOutlineId + (result ? ":" + result : ""); |
| 1344 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached
PathSymbol] = result; | 1390 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached
PathSymbol] = result; |
| 1345 return result; | 1391 return result; |
| 1346 } | 1392 } |
| 1347 } | 1393 } |
| OLD | NEW |