| 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 WebInspector.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 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 abbreviatedDescription[i] = abbreviatedDescription[i].trimMiddle(3); | 35 abbreviatedDescription[i] = abbreviatedDescription[i].trimMiddle(3); |
| 36 return abbreviatedDescription.join('.'); | 36 return abbreviatedDescription.join('.'); |
| 37 } | 37 } |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * @param {!Element} parentElement | 40 * @param {!Element} parentElement |
| 41 * @param {!Protocol.Runtime.ObjectPreview} preview | 41 * @param {!Protocol.Runtime.ObjectPreview} preview |
| 42 */ | 42 */ |
| 43 _appendPropertiesPreview(parentElement, preview) { | 43 _appendPropertiesPreview(parentElement, preview) { |
| 44 var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray
'; | 44 var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray
'; |
| 45 var arrayLength = WebInspector.RemoteObject.arrayLength(preview); | 45 var arrayLength = SDK.RemoteObject.arrayLength(preview); |
| 46 var properties = preview.properties; | 46 var properties = preview.properties; |
| 47 if (isArray) | 47 if (isArray) |
| 48 properties = properties.slice().stableSort(compareIndexesFirst); | 48 properties = properties.slice().stableSort(compareIndexesFirst); |
| 49 else | 49 else |
| 50 properties = properties.slice().stableSort(compareFunctionsLast); | 50 properties = properties.slice().stableSort(compareFunctionsLast); |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * @param {!Protocol.Runtime.PropertyPreview} a | 53 * @param {!Protocol.Runtime.PropertyPreview} a |
| 54 * @param {!Protocol.Runtime.PropertyPreview} b | 54 * @param {!Protocol.Runtime.PropertyPreview} b |
| 55 */ | 55 */ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 renderPropertyPreview(type, subtype, description) { | 146 renderPropertyPreview(type, subtype, description) { |
| 147 var span = createElementWithClass('span', 'object-value-' + (subtype || type
)); | 147 var span = createElementWithClass('span', 'object-value-' + (subtype || type
)); |
| 148 description = description || ''; | 148 description = description || ''; |
| 149 | 149 |
| 150 if (type === 'function') { | 150 if (type === 'function') { |
| 151 span.textContent = 'function'; | 151 span.textContent = 'function'; |
| 152 return span; | 152 return span; |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (type === 'object' && subtype === 'node' && description) { | 155 if (type === 'object' && subtype === 'node' && description) { |
| 156 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(span, descriptio
n); | 156 Components.DOMPresentationUtils.createSpansForNodeTitle(span, description)
; |
| 157 return span; | 157 return span; |
| 158 } | 158 } |
| 159 | 159 |
| 160 if (type === 'string') { | 160 if (type === 'string') { |
| 161 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); | 161 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); |
| 162 return span; | 162 return span; |
| 163 } | 163 } |
| 164 | 164 |
| 165 if (type === 'object' && !subtype) { | 165 if (type === 'object' && !subtype) { |
| 166 span.textContent = this._abbreviateFullQualifiedClassName(description); | 166 span.textContent = this._abbreviateFullQualifiedClassName(description); |
| 167 return span; | 167 return span; |
| 168 } | 168 } |
| 169 | 169 |
| 170 span.textContent = description; | 170 span.textContent = description; |
| 171 return span; | 171 return span; |
| 172 } | 172 } |
| 173 }; | 173 }; |
| OLD | NEW |