OLD | NEW |
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 {!Element} parentElement | 9 * @param {!Element} parentElement |
10 * @param {!Protocol.Runtime.ObjectPreview} preview | 10 * @param {!Protocol.Runtime.ObjectPreview} preview |
11 */ | 11 */ |
12 appendObjectPreview(parentElement, preview) { | 12 appendObjectPreview(parentElement, preview) { |
13 var description = preview.description; | 13 var description = preview.description; |
14 if (preview.type !== 'object' || preview.subtype === 'null') { | 14 if (preview.type !== 'object' || preview.subtype === 'null') { |
15 parentElement.appendChild(this.renderPropertyPreview(preview.type, preview
.subtype, description)); | 15 parentElement.appendChild(this.renderPropertyPreview(preview.type, preview
.subtype, description)); |
16 return; | 16 return; |
17 } | 17 } |
18 if (description && preview.subtype !== 'array') { | 18 if (description && preview.subtype !== 'array') |
19 var text = preview.subtype ? description : this._abbreviateFullQualifiedCl
assName(description); | 19 parentElement.createTextChildren(description, ' '); |
20 parentElement.createTextChildren(text, ' '); | |
21 } | |
22 | 20 |
23 var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray
'; | 21 var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray
'; |
24 parentElement.createTextChild(isArray ? '[' : '{'); | 22 parentElement.createTextChild(isArray ? '[' : '{'); |
25 if (preview.entries) | 23 if (preview.entries) |
26 this._appendEntriesPreview(parentElement, preview); | 24 this._appendEntriesPreview(parentElement, preview); |
27 else if (isArray) | 25 else if (isArray) |
28 this._appendArrayPropertiesPreview(parentElement, preview); | 26 this._appendArrayPropertiesPreview(parentElement, preview); |
29 else | 27 else |
30 this._appendObjectPropertiesPreview(parentElement, preview); | 28 this._appendObjectPropertiesPreview(parentElement, preview); |
31 if (preview.overflow) | 29 if (preview.overflow) |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 return span; | 175 return span; |
178 } | 176 } |
179 | 177 |
180 if (type === 'string') { | 178 if (type === 'string') { |
181 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); | 179 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); |
182 return span; | 180 return span; |
183 } | 181 } |
184 | 182 |
185 if (type === 'object' && !subtype) { | 183 if (type === 'object' && !subtype) { |
186 span.textContent = this._abbreviateFullQualifiedClassName(description); | 184 span.textContent = this._abbreviateFullQualifiedClassName(description); |
| 185 span.title = description; |
187 return span; | 186 return span; |
188 } | 187 } |
189 | 188 |
190 span.textContent = description; | 189 span.textContent = description; |
191 return span; | 190 return span; |
192 } | 191 } |
193 }; | 192 }; |
OLD | NEW |