Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js

Issue 1899893003: [Devtools] JSONView implements Searchable interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 applyHighlight: function(regex, additionalCssClassName) {
lushnikov 2016/04/22 19:43:00 setSearchRegex: .. to be consistent with ConsoleV
allada 2016/04/25 23:48:49 Done.
226 var nameRanges = [];
227 var valueRanges = [];
228 if (additionalCssClassName)
229 var cssClasses = [additionalCssClassName, WebInspector.highlightedSe archResultClassName];
230 else
231 var cssClasses = [WebInspector.highlightedSearchResultClassName];
232
233 this.revertHighlightChanges();
234
235 var nameContent = this.nameElement.textContent;
236 regex.lastIndex = 0;
237 var match = regex.exec(nameContent);
238 while (match) {
lushnikov 2016/04/22 19:43:00 this could be extracted
allada 2016/04/25 23:48:49 Done.
239 nameRanges.push(new WebInspector.SourceRange(match.index, match[0].l ength));
240 match = regex.exec(nameContent);
241 }
242 var className = WebInspector.highlightedSearchResultClassName;
243 if (nameRanges.length)
244 WebInspector.highlightRangesWithStyleClass(this.nameElement, nameRan ges, cssClasses.join(" "), this._highlightChanges);
245
246 var valueType = this.property.value.type;
247 if (valueType !== "object" && valueType !== "array") {
248 var valueContent = this.valueElement.textContent;
249 regex.lastIndex = 0;
250 match = regex.exec(valueContent);
251 while (match) {
252 valueRanges.push(new WebInspector.SourceRange(match.index, match [0].length));
253 match = regex.exec(valueContent);
254 }
255 if (valueRanges.length)
256 WebInspector.highlightRangesWithStyleClass(this.valueElement, va lueRanges, cssClasses.join(" "), this._highlightChanges);
257 }
258
259 return !!this._highlightChanges.length;
260 },
261
262 revertHighlightChanges: function()
263 {
264 WebInspector.revertDomChanges(this._highlightChanges);
265 this._highlightChanges = [];
266 },
267
219 onpopulate: function() 268 onpopulate: function()
220 { 269 {
221 var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.prop erty.value); 270 var propertyValue = /** @type {!WebInspector.RemoteObject} */ (this.prop erty.value);
222 console.assert(propertyValue); 271 console.assert(propertyValue);
223 var skipProto = this.treeOutline ? this.treeOutline._skipProto : true; 272 var skipProto = this.treeOutline ? this.treeOutline._skipProto : true;
224 var targetValue = this.property.name !== '__proto__' ? propertyValue : t his.property.parentObject; 273 var targetValue = this.property.name !== '__proto__' ? propertyValue : t his.property.parentObject;
225 WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, sk ipProto, undefined, undefined, undefined, targetValue); 274 WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, sk ipProto, undefined, undefined, undefined, targetValue);
226 }, 275 },
227 276
228 /** 277 /**
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1387
1339 result = currentName + (result ? "." + result : ""); 1388 result = currentName + (result ? "." + result : "");
1340 current = current.parent; 1389 current = current.parent;
1341 } 1390 }
1342 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; 1391 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId];
1343 result = treeOutlineId + (result ? ":" + result : ""); 1392 result = treeOutlineId + (result ? ":" + result : "");
1344 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; 1393 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result;
1345 return result; 1394 return result;
1346 } 1395 }
1347 } 1396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698