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