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

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

Issue 2712513002: DevTools: extract ObjectUI module from Components (Closed)
Patch Set: fix build.gn Created 3 years, 10 months 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
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 Components.RemoteObjectPreviewFormatter = class { 7 ObjectUI.RemoteObjectPreviewFormatter = class {
8 /** 8 /**
9 * @param {!Protocol.Runtime.PropertyPreview} a 9 * @param {!Protocol.Runtime.PropertyPreview} a
10 * @param {!Protocol.Runtime.PropertyPreview} b 10 * @param {!Protocol.Runtime.PropertyPreview} b
11 * @return {number} 11 * @return {number}
12 */ 12 */
13 static _objectPropertyComparator(a, b) { 13 static _objectPropertyComparator(a, b) {
14 if (a.type !== 'function' && b.type === 'function') 14 if (a.type !== 'function' && b.type === 'function')
15 return -1; 15 return -1;
16 if (a.type === 'function' && b.type !== 'function') 16 if (a.type === 'function' && b.type !== 'function')
17 return 1; 17 return 1;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 abbreviatedDescription[i] = abbreviatedDescription[i].trimMiddle(3); 70 abbreviatedDescription[i] = abbreviatedDescription[i].trimMiddle(3);
71 return abbreviatedDescription.join('.'); 71 return abbreviatedDescription.join('.');
72 } 72 }
73 73
74 /** 74 /**
75 * @param {!Element} parentElement 75 * @param {!Element} parentElement
76 * @param {!Protocol.Runtime.ObjectPreview} preview 76 * @param {!Protocol.Runtime.ObjectPreview} preview
77 */ 77 */
78 _appendObjectPropertiesPreview(parentElement, preview) { 78 _appendObjectPropertiesPreview(parentElement, preview) {
79 var properties = preview.properties.filter(p => p.type !== 'accessor') 79 var properties = preview.properties.filter(p => p.type !== 'accessor')
80 .stableSort(Components.RemoteObjectPreviewFormatter._ob jectPropertyComparator); 80 .stableSort(ObjectUI.RemoteObjectPreviewFormatter._obje ctPropertyComparator);
81 for (var i = 0; i < properties.length; ++i) { 81 for (var i = 0; i < properties.length; ++i) {
82 if (i > 0) 82 if (i > 0)
83 parentElement.createTextChild(', '); 83 parentElement.createTextChild(', ');
84 84
85 var property = properties[i]; 85 var property = properties[i];
86 parentElement.appendChild(this._renderDisplayName(property.name)); 86 parentElement.appendChild(this._renderDisplayName(property.name));
87 parentElement.createTextChild(': '); 87 parentElement.createTextChild(': ');
88 parentElement.appendChild(this._renderPropertyPreviewOrAccessor([property] )); 88 parentElement.appendChild(this._renderPropertyPreviewOrAccessor([property] ));
89 } 89 }
90 } 90 }
91 91
92 /** 92 /**
93 * @param {!Element} parentElement 93 * @param {!Element} parentElement
94 * @param {!Protocol.Runtime.ObjectPreview} preview 94 * @param {!Protocol.Runtime.ObjectPreview} preview
95 */ 95 */
96 _appendArrayPropertiesPreview(parentElement, preview) { 96 _appendArrayPropertiesPreview(parentElement, preview) {
97 var arrayLength = SDK.RemoteObject.arrayLength(preview); 97 var arrayLength = SDK.RemoteObject.arrayLength(preview);
98 var indexProperties = preview.properties.filter(p => toArrayIndex(p.name) != = -1).stableSort(arrayEntryComparator); 98 var indexProperties = preview.properties.filter(p => toArrayIndex(p.name) != = -1).stableSort(arrayEntryComparator);
99 var otherProperties = preview.properties.filter(p => toArrayIndex(p.name) == = -1) 99 var otherProperties = preview.properties.filter(p => toArrayIndex(p.name) == = -1)
100 .stableSort(Components.RemoteObjectPreviewFormatte r._objectPropertyComparator); 100 .stableSort(ObjectUI.RemoteObjectPreviewFormatter. _objectPropertyComparator);
101 101
102 /** 102 /**
103 * @param {!Protocol.Runtime.PropertyPreview} a 103 * @param {!Protocol.Runtime.PropertyPreview} a
104 * @param {!Protocol.Runtime.PropertyPreview} b 104 * @param {!Protocol.Runtime.PropertyPreview} b
105 * @return {number} 105 * @return {number}
106 */ 106 */
107 function arrayEntryComparator(a, b) { 107 function arrayEntryComparator(a, b) {
108 return toArrayIndex(a.name) - toArrayIndex(b.name); 108 return toArrayIndex(a.name) - toArrayIndex(b.name);
109 } 109 }
110 110
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (type === 'object' && !subtype) { 241 if (type === 'object' && !subtype) {
242 span.textContent = this._abbreviateFullQualifiedClassName(description); 242 span.textContent = this._abbreviateFullQualifiedClassName(description);
243 span.title = description; 243 span.title = description;
244 return span; 244 return span;
245 } 245 }
246 246
247 span.textContent = description; 247 span.textContent = description;
248 return span; 248 return span;
249 } 249 }
250 }; 250 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698