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 WebInspector.RemoteObjectPreviewFormatter = class { | 7 WebInspector.RemoteObjectPreviewFormatter = class { |
| 8 /** | 8 /** |
| 9 * @param {!Element} parentElement | 9 * @param {!Element} parentElement |
| 10 * @param {!RuntimeAgent.ObjectPreview} preview | 10 * @param {!RuntimeAgent.ObjectPreview} preview |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 /** | 39 /** |
| 40 * @param {!Element} parentElement | 40 * @param {!Element} parentElement |
| 41 * @param {!RuntimeAgent.ObjectPreview} preview | 41 * @param {!RuntimeAgent.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 = WebInspector.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 | |
| 50 properties = properties.slice().stableSort(compareFunctionsLast); | |
| 49 | 51 |
| 50 /** | 52 /** |
| 51 * @param {!RuntimeAgent.PropertyPreview} a | 53 * @param {!RuntimeAgent.PropertyPreview} a |
| 54 * @param {!RuntimeAgent.PropertyPreview} b | |
| 55 */ | |
| 56 function compareFunctionsLast(a, b) { | |
| 57 if (a.type !== 'function' && b.type === 'function') | |
| 58 return -1; | |
| 59 else if (a.type === 'function' && b.type !== 'function') | |
|
lushnikov
2016/11/10 04:06:58
style: no "else"
luoe
2016/11/10 17:33:53
Done.
| |
| 60 return 1; | |
| 61 return 0; | |
| 62 } | |
| 63 | |
| 64 /** | |
| 65 * @param {!RuntimeAgent.PropertyPreview} a | |
| 52 * @param {!RuntimeAgent.PropertyPreview} b | 66 * @param {!RuntimeAgent.PropertyPreview} b |
| 53 */ | 67 */ |
| 54 function compareIndexesFirst(a, b) { | 68 function compareIndexesFirst(a, b) { |
| 55 var index1 = toArrayIndex(a.name); | 69 var index1 = toArrayIndex(a.name); |
| 56 var index2 = toArrayIndex(b.name); | 70 var index2 = toArrayIndex(b.name); |
| 57 if (index1 < 0) | 71 if (index1 < 0) |
| 58 return index2 < 0 ? 0 : 1; | 72 return index2 < 0 ? 0 : 1; |
| 59 return index2 < 0 ? -1 : index1 - index2; | 73 return index2 < 0 ? -1 : index1 - index2; |
| 60 } | 74 } |
| 61 | 75 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 | 164 |
| 151 if (type === 'object' && !subtype) { | 165 if (type === 'object' && !subtype) { |
| 152 span.textContent = this._abbreviateFullQualifiedClassName(description); | 166 span.textContent = this._abbreviateFullQualifiedClassName(description); |
| 153 return span; | 167 return span; |
| 154 } | 168 } |
| 155 | 169 |
| 156 span.textContent = description; | 170 span.textContent = description; |
| 157 return span; | 171 return span; |
| 158 } | 172 } |
| 159 }; | 173 }; |
| OLD | NEW |