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

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

Issue 2605693003: DevTools: introduce object previews experiment (Closed)
Patch Set: fix rebase Created 3 years, 11 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 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Components.RemoteObjectPreviewFormatter = class { 7 Components.RemoteObjectPreviewFormatter = class {
8 /** 8 /**
9 * @param {!Protocol.Runtime.PropertyPreview} a 9 * @param {!Protocol.Runtime.PropertyPreview} a
10 * @param {!Protocol.Runtime.PropertyPreview} b 10 * @param {!Protocol.Runtime.PropertyPreview} b
(...skipping 10 matching lines...) Expand all
21 /** 21 /**
22 * @param {!Element} parentElement 22 * @param {!Element} parentElement
23 * @param {!Protocol.Runtime.ObjectPreview} preview 23 * @param {!Protocol.Runtime.ObjectPreview} preview
24 */ 24 */
25 appendObjectPreview(parentElement, preview) { 25 appendObjectPreview(parentElement, preview) {
26 var description = preview.description; 26 var description = preview.description;
27 if (preview.type !== 'object' || preview.subtype === 'null') { 27 if (preview.type !== 'object' || preview.subtype === 'null') {
28 parentElement.appendChild(this.renderPropertyPreview(preview.type, preview .subtype, description)); 28 parentElement.appendChild(this.renderPropertyPreview(preview.type, preview .subtype, description));
29 return; 29 return;
30 } 30 }
31 if (description && preview.subtype !== 'array') 31 if (description) {
32 parentElement.createTextChildren(description, ' '); 32 if (Runtime.experiments.isEnabled('objectPreviews')) {
33 var text = '';
34 if (preview.subtype === 'typedarray' || preview.subtype === 'map' || pre view.subtype === 'set')
35 text = description.replace(/\[([0-9]+)\]|\(([0-9]+)\)/, '');
dgozman 2017/01/13 02:55:41 - Why do we do this? - Can description contains [5
luoe 2017/01/13 23:20:12 Motivation: I want "arr = new Uint16Array([9])" to
36 else if (preview.subtype !== 'array')
37 text = description;
38 var size = SDK.RemoteObject.arrayLength(preview) || SDK.RemoteObject.map OrSetEntriesCount(preview);
39 if (size > 1)
40 text += '(' + size + ')';
41 if (text.length > 0)
42 parentElement.createChild('span', 'object-description').textContent = text + ' ';
43 } else if (preview.subtype !== 'array') {
44 parentElement.createTextChildren(description, ' ');
45 }
46 }
33 47
34 var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray '; 48 var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray ';
35 parentElement.createTextChild(isArray ? '[' : '{'); 49 parentElement.createTextChild(isArray ? '[' : '{');
36 if (preview.entries) 50 if (preview.entries)
37 this._appendEntriesPreview(parentElement, preview); 51 this._appendEntriesPreview(parentElement, preview);
38 else if (isArray) 52 else if (isArray)
39 this._appendArrayPropertiesPreview(parentElement, preview); 53 this._appendArrayPropertiesPreview(parentElement, preview);
40 else 54 else
41 this._appendObjectPropertiesPreview(parentElement, preview); 55 this._appendObjectPropertiesPreview(parentElement, preview);
42 if (preview.overflow) 56 if (preview.overflow)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (type === 'object' && !subtype) { 239 if (type === 'object' && !subtype) {
226 span.textContent = this._abbreviateFullQualifiedClassName(description); 240 span.textContent = this._abbreviateFullQualifiedClassName(description);
227 span.title = description; 241 span.title = description;
228 return span; 242 return span;
229 } 243 }
230 244
231 span.textContent = description; 245 span.textContent = description;
232 return span; 246 return span;
233 } 247 }
234 }; 248 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698