| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 for (var i = 0; i < abbreviatedDescription.length - 1; ++i) | 42 for (var i = 0; i < abbreviatedDescription.length - 1; ++i) |
| 43 abbreviatedDescription[i] = abbreviatedDescription[i].trimMiddle(3); | 43 abbreviatedDescription[i] = abbreviatedDescription[i].trimMiddle(3); |
| 44 return abbreviatedDescription.join('.'); | 44 return abbreviatedDescription.join('.'); |
| 45 } | 45 } |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @param {!Element} parentElement | 48 * @param {!Element} parentElement |
| 49 * @param {!Protocol.Runtime.ObjectPreview} preview | 49 * @param {!Protocol.Runtime.ObjectPreview} preview |
| 50 */ | 50 */ |
| 51 _appendObjectPropertiesPreview(parentElement, preview) { | 51 _appendObjectPropertiesPreview(parentElement, preview) { |
| 52 var properties = preview.properties.slice().stableSort(compareFunctionsLast)
; | 52 var properties = preview.properties.filter(p => p.type !== 'accessor').stabl
eSort(compareFunctionsLast); |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * @param {!Protocol.Runtime.PropertyPreview} a | 55 * @param {!Protocol.Runtime.PropertyPreview} a |
| 56 * @param {!Protocol.Runtime.PropertyPreview} b | 56 * @param {!Protocol.Runtime.PropertyPreview} b |
| 57 */ | 57 */ |
| 58 function compareFunctionsLast(a, b) { | 58 function compareFunctionsLast(a, b) { |
| 59 if (a.type !== 'function' && b.type === 'function') | 59 if (a.type !== 'function' && b.type === 'function') |
| 60 return -1; | 60 return -1; |
| 61 if (a.type === 'function' && b.type !== 'function') | 61 if (a.type === 'function' && b.type !== 'function') |
| 62 return 1; | 62 return 1; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 /** | 160 /** |
| 161 * @param {string} type | 161 * @param {string} type |
| 162 * @param {string=} subtype | 162 * @param {string=} subtype |
| 163 * @param {string=} description | 163 * @param {string=} description |
| 164 * @return {!Element} | 164 * @return {!Element} |
| 165 */ | 165 */ |
| 166 renderPropertyPreview(type, subtype, description) { | 166 renderPropertyPreview(type, subtype, description) { |
| 167 var span = createElementWithClass('span', 'object-value-' + (subtype || type
)); | 167 var span = createElementWithClass('span', 'object-value-' + (subtype || type
)); |
| 168 description = description || ''; | 168 description = description || ''; |
| 169 | 169 |
| 170 if (type === 'accessor') { |
| 171 span.textContent = '(...)'; |
| 172 span.title = Common.UIString('The property is computed with a getter'); |
| 173 return span; |
| 174 } |
| 175 |
| 170 if (type === 'function') { | 176 if (type === 'function') { |
| 171 span.textContent = 'function'; | 177 span.textContent = 'function'; |
| 172 return span; | 178 return span; |
| 173 } | 179 } |
| 174 | 180 |
| 175 if (type === 'object' && subtype === 'node' && description) { | 181 if (type === 'object' && subtype === 'node' && description) { |
| 176 Components.DOMPresentationUtils.createSpansForNodeTitle(span, description)
; | 182 Components.DOMPresentationUtils.createSpansForNodeTitle(span, description)
; |
| 177 return span; | 183 return span; |
| 178 } | 184 } |
| 179 | 185 |
| 180 if (type === 'string') { | 186 if (type === 'string') { |
| 181 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); | 187 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); |
| 182 return span; | 188 return span; |
| 183 } | 189 } |
| 184 | 190 |
| 185 if (type === 'object' && !subtype) { | 191 if (type === 'object' && !subtype) { |
| 186 span.textContent = this._abbreviateFullQualifiedClassName(description); | 192 span.textContent = this._abbreviateFullQualifiedClassName(description); |
| 187 return span; | 193 return span; |
| 188 } | 194 } |
| 189 | 195 |
| 190 span.textContent = description; | 196 span.textContent = description; |
| 191 return span; | 197 return span; |
| 192 } | 198 } |
| 193 }; | 199 }; |
| OLD | NEW |