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

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

Issue 2723773003: DevTools: restore array lengths for long arrays (Closed)
Patch Set: Created 3 years, 9 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 ObjectUI.RemoteObjectPreviewFormatter = class { 7 ObjectUI.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 14 matching lines...) Expand all
25 */ 25 */
26 appendObjectPreview(parentElement, preview, isEntry) { 26 appendObjectPreview(parentElement, preview, isEntry) {
27 const previewExperimentEnabled = Runtime.experiments.isEnabled('objectPrevie ws'); 27 const previewExperimentEnabled = Runtime.experiments.isEnabled('objectPrevie ws');
28 var description = preview.description; 28 var description = preview.description;
29 if (preview.type !== 'object' || preview.subtype === 'null' || (previewExper imentEnabled && isEntry)) { 29 if (preview.type !== 'object' || preview.subtype === 'null' || (previewExper imentEnabled && isEntry)) {
30 parentElement.appendChild(this.renderPropertyPreview(preview.type, preview .subtype, description)); 30 parentElement.appendChild(this.renderPropertyPreview(preview.type, preview .subtype, description));
31 return; 31 return;
32 } 32 }
33 const isArrayOrTypedArray = preview.subtype === 'array' || preview.subtype = == 'typedarray'; 33 const isArrayOrTypedArray = preview.subtype === 'array' || preview.subtype = == 'typedarray';
34 if (description) { 34 if (description) {
35 if (previewExperimentEnabled) { 35 const size = SDK.RemoteObject.arrayLength(preview) || SDK.RemoteObject.map OrSetEntriesCount(preview);
lushnikov 2017/02/28 22:21:08 value of mapOrSetEntriesCount is never used the v
luoe 2017/02/28 22:32:57 Done.
36 // Hide the description for plain objects and plain arrays. 36 var text = preview.subtype === 'typedarray' ? SDK.RemoteObject.arrayNameFr omDescription(description) : '';
lushnikov 2017/02/28 22:21:08 this should go under isArrayOrTypedArray as well
luoe 2017/02/28 22:32:57 Done.
37 const plainObjectDescription = 'Object'; 37 if (isArrayOrTypedArray) {
38 const size = SDK.RemoteObject.arrayLength(preview) || SDK.RemoteObject.m apOrSetEntriesCount(preview); 38 text += size > 1 ? ('(' + size + ')') : '';
39 var text = preview.subtype === 'typedarray' ? SDK.RemoteObject.arrayName FromDescription(description) : ''; 39 } else {
40 if (isArrayOrTypedArray) 40 var hideObjectKeyword = previewExperimentEnabled && description === 'Obj ect';
lushnikov 2017/02/28 22:21:08 hideDescription?
luoe 2017/02/28 22:32:57 Done.
41 text += size > 1 ? ('(' + size + ')') : ''; 41 text = hideObjectKeyword ? '' : description;
42 else
43 text = description === plainObjectDescription ? '' : description;
44 if (text.length > 0)
45 parentElement.createChild('span', 'object-description').textContent = text + ' ';
46 } else if (preview.subtype !== 'array') {
47 parentElement.createTextChildren(description, ' ');
48 } 42 }
43 if (text.length > 0)
44 parentElement.createChild('span', 'object-description').textContent = te xt + ' ';
49 } 45 }
50 46
51 parentElement.createTextChild(isArrayOrTypedArray ? '[' : '{'); 47 parentElement.createTextChild(isArrayOrTypedArray ? '[' : '{');
52 if (preview.entries) 48 if (preview.entries)
53 this._appendEntriesPreview(parentElement, preview); 49 this._appendEntriesPreview(parentElement, preview);
54 else if (isArrayOrTypedArray) 50 else if (isArrayOrTypedArray)
55 this._appendArrayPropertiesPreview(parentElement, preview); 51 this._appendArrayPropertiesPreview(parentElement, preview);
56 else 52 else
57 this._appendObjectPropertiesPreview(parentElement, preview); 53 this._appendObjectPropertiesPreview(parentElement, preview);
58 if (preview.overflow) 54 if (preview.overflow)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (type === 'object' && !subtype) { 237 if (type === 'object' && !subtype) {
242 span.textContent = this._abbreviateFullQualifiedClassName(description); 238 span.textContent = this._abbreviateFullQualifiedClassName(description);
243 span.title = description; 239 span.title = description;
244 return span; 240 return span;
245 } 241 }
246 242
247 span.textContent = description; 243 span.textContent = description;
248 return span; 244 return span;
249 } 245 }
250 }; 246 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698