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

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

Issue 2629073004: ac (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js b/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js
index 30cb1a700ee91cca76392ab33f5162e37f90aa55..1eff924ae65596a0dcc053a1075f377812627247 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js
@@ -28,8 +28,22 @@ Components.RemoteObjectPreviewFormatter = class {
parentElement.appendChild(this.renderPropertyPreview(preview.type, preview.subtype, description));
return;
}
- if (description && preview.subtype !== 'array')
- parentElement.createTextChildren(description, ' ');
+ if (description) {
+ if (Runtime.experiments.isEnabled('objectPreviews')) {
+ var text = '';
+ if (preview.subtype === 'typedarray' || preview.subtype === 'map' || preview.subtype === 'set')
+ text = description.replace(/\[([0-9]+)\]|\(([0-9]+)\)/, '');
+ else if (preview.subtype !== 'array')
+ text = description;
+ var size = SDK.RemoteObject.arrayLength(preview) || SDK.RemoteObject.mapOrSetEntriesCount(preview);
+ if (size > 1)
+ text += '(' + size + ')';
+ if (text.length > 0)
+ parentElement.createChild('span', 'object-description').textContent = text + ' ';
+ } else if (preview.subtype !== 'array') {
+ parentElement.createTextChildren(description, ' ');
+ }
+ }
var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray';
parentElement.createTextChild(isArray ? '[' : '{');

Powered by Google App Engine
This is Rietveld 408576698