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 6ce99dc00c1f1c94d3aad73d8a81079a16be65ce..2cd94705379e48aa91256b11df17656e0917a9b2 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js |
| @@ -213,9 +213,54 @@ WebInspector.ObjectPropertyTreeElement = function(property) |
| TreeElement.call(this); |
| this.toggleOnClick = true; |
| this.selectable = false; |
| + this._highlightChanges = []; |
|
lushnikov
2016/05/06 18:46:25
let's annotate
allada
2016/05/06 19:31:50
Done.
|
| } |
| WebInspector.ObjectPropertyTreeElement.prototype = { |
| + /** |
| + * @param {!RegExp} regex |
| + * @param {string=} additionalCssClassName |
| + * @return {boolean} |
| + */ |
| + setSearchRegex: function(regex, additionalCssClassName) { |
| + var cssClasses = WebInspector.highlightedSearchResultClassName; |
| + if (additionalCssClassName) |
| + cssClasses += " " + additionalCssClassName; |
| + this.revertHighlightChanges(); |
| + |
| + this._applySearch(regex, this.nameElement, cssClasses); |
| + var valueType = this.property.value.type; |
| + if (valueType !== "object" && valueType !== "array") |
| + this._applySearch(regex, this.valueElement, cssClasses); |
| + |
| + return !!this._highlightChanges.length; |
| + }, |
| + |
| + /** |
| + * @param {!RegExp} regex |
| + * @param {!Element} element |
| + * @param {string} cssClassName |
| + */ |
| + _applySearch: function(regex, element, cssClassName) |
| + { |
| + var ranges = []; |
| + var content = element.textContent; |
| + regex.lastIndex = 0; |
| + var match = regex.exec(content); |
| + while (match) { |
| + ranges.push(new WebInspector.SourceRange(match.index, match[0].length)); |
| + match = regex.exec(content); |
| + } |
| + if (ranges.length) |
| + WebInspector.highlightRangesWithStyleClass(element, ranges, cssClassName, this._highlightChanges); |
| + }, |
| + |
| + revertHighlightChanges: function() |
| + { |
| + WebInspector.revertDomChanges(this._highlightChanges); |
| + this._highlightChanges = []; |
| + }, |
| + |
| onpopulate: function() |
| { |
| var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.property.value); |