Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js

Issue 2486953002: DevTools: sort functions last in object previews (Closed)
Patch Set: ac Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (a.type === 'function' && b.type !== 'function')
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
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 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698