Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 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 = SDK.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.filter(p => p.type !== 'accessor').stableSort(comp areFunctionsLast); |
| 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 */ |
| 56 function compareFunctionsLast(a, b) { | 56 function compareFunctionsLast(a, b) { |
| 57 if (a.type !== 'function' && b.type === 'function') | 57 if (a.type !== 'function' && b.type === 'function') |
| 58 return -1; | 58 return -1; |
| 59 if (a.type === 'function' && b.type !== 'function') | 59 if (a.type === 'function' && b.type !== 'function') |
| 60 return 1; | 60 return 1; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 /** | 140 /** |
| 141 * @param {string} type | 141 * @param {string} type |
| 142 * @param {string=} subtype | 142 * @param {string=} subtype |
| 143 * @param {string=} description | 143 * @param {string=} description |
| 144 * @return {!Element} | 144 * @return {!Element} |
| 145 */ | 145 */ |
| 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 === 'accessor') { | |
| 151 span.textContent = '(...)'; | |
|
dgozman
2016/11/24 00:38:49
Let's make this clickable when we can.
dgozman
2016/12/05 23:16:51
Let's just have a tooltip with explanation.
luoe
2016/12/06 01:30:44
Added as "The property is computed with a getter"
| |
| 152 return span; | |
| 153 } | |
| 154 | |
| 150 if (type === 'function') { | 155 if (type === 'function') { |
| 151 span.textContent = 'function'; | 156 span.textContent = 'function'; |
| 152 return span; | 157 return span; |
| 153 } | 158 } |
| 154 | 159 |
| 155 if (type === 'object' && subtype === 'node' && description) { | 160 if (type === 'object' && subtype === 'node' && description) { |
| 156 Components.DOMPresentationUtils.createSpansForNodeTitle(span, description) ; | 161 Components.DOMPresentationUtils.createSpansForNodeTitle(span, description) ; |
| 157 return span; | 162 return span; |
| 158 } | 163 } |
| 159 | 164 |
| 160 if (type === 'string') { | 165 if (type === 'string') { |
| 161 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); | 166 span.createTextChildren('"', description.replace(/\n/g, '\u21B5'), '"'); |
| 162 return span; | 167 return span; |
| 163 } | 168 } |
| 164 | 169 |
| 165 if (type === 'object' && !subtype) { | 170 if (type === 'object' && !subtype) { |
| 166 span.textContent = this._abbreviateFullQualifiedClassName(description); | 171 span.textContent = this._abbreviateFullQualifiedClassName(description); |
| 167 return span; | 172 return span; |
| 168 } | 173 } |
| 169 | 174 |
| 170 span.textContent = description; | 175 span.textContent = description; |
| 171 return span; | 176 return span; |
| 172 } | 177 } |
| 173 }; | 178 }; |
| OLD | NEW |