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

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

Issue 2866363003: DevTools: format keys in object previews using sans serif. (Closed)
Patch Set: removed the test Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 var textAfterPrefix; 145 var textAfterPrefix;
146 if (isClass) { 146 if (isClass) {
147 textAfterPrefix = text.substring('class'.length); 147 textAfterPrefix = text.substring('class'.length);
148 var classNameMatch = /^[^{\s]+/.exec(textAfterPrefix.trim()); 148 var classNameMatch = /^[^{\s]+/.exec(textAfterPrefix.trim());
149 var className = defaultName; 149 var className = defaultName;
150 if (classNameMatch) 150 if (classNameMatch)
151 className = classNameMatch[0].trim() || defaultName; 151 className = classNameMatch[0].trim() || defaultName;
152 addElements('class', textAfterPrefix, className); 152 addElements('class', textAfterPrefix, className);
153 } else if (isAsync) { 153 } else if (isAsync) {
154 textAfterPrefix = text.substring('async function'.length); 154 textAfterPrefix = text.substring('async function'.length);
155 addElements('async function', textAfterPrefix, nameAndArguments(textAfterP refix)); 155 addElements('async \u0192', textAfterPrefix, nameAndArguments(textAfterPre fix));
156 } else if (isGenerator) { 156 } else if (isGenerator) {
157 textAfterPrefix = text.substring('function*'.length); 157 textAfterPrefix = text.substring('function*'.length);
158 addElements('function*', textAfterPrefix, nameAndArguments(textAfterPrefix )); 158 addElements('\u0192*', textAfterPrefix, nameAndArguments(textAfterPrefix)) ;
159 } else if (isGeneratorShorthand) { 159 } else if (isGeneratorShorthand) {
160 textAfterPrefix = text.substring('*'.length); 160 textAfterPrefix = text.substring('*'.length);
161 addElements('function*', textAfterPrefix, nameAndArguments(textAfterPrefix )); 161 addElements('\u0192*', textAfterPrefix, nameAndArguments(textAfterPrefix)) ;
162 } else if (isBasic) { 162 } else if (isBasic) {
163 textAfterPrefix = text.substring('function'.length); 163 textAfterPrefix = text.substring('function'.length);
164 addElements('function', textAfterPrefix, nameAndArguments(textAfterPrefix) ); 164 addElements('\u0192', textAfterPrefix, nameAndArguments(textAfterPrefix));
165 } else if (isArrow) { 165 } else if (isArrow) {
166 const maxArrowFunctionCharacterLength = 60; 166 const maxArrowFunctionCharacterLength = 60;
167 var abbreviation = text; 167 var abbreviation = text;
168 if (defaultName) 168 if (defaultName)
169 abbreviation = defaultName + '()'; 169 abbreviation = defaultName + '()';
170 else if (text.length > maxArrowFunctionCharacterLength) 170 else if (text.length > maxArrowFunctionCharacterLength)
171 abbreviation = text.substring(0, firstArrowIndex + 2) + ' {\u2026}'; 171 abbreviation = text.substring(0, firstArrowIndex + 2) + ' {\u2026}';
172 addElements('', text, abbreviation); 172 addElements('', text, abbreviation);
173 } else { 173 } else {
174 addElements('function', text, nameAndArguments(text)); 174 addElements('\u0192', text, nameAndArguments(text));
175 } 175 }
176 valueElement.title = description || ''; 176 valueElement.title = description || '';
177 return valueElement; 177 return valueElement;
178 178
179 /** 179 /**
180 * @param {string} contents 180 * @param {string} contents
181 * @return {string} 181 * @return {string}
182 */ 182 */
183 function nameAndArguments(contents) { 183 function nameAndArguments(contents) {
184 var startOfArgumentsIndex = contents.indexOf('('); 184 var startOfArgumentsIndex = contents.indexOf('(');
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 * @param {!SDK.RemoteObject} value 731 * @param {!SDK.RemoteObject} value
732 * @return {?Element} 732 * @return {?Element}
733 */ 733 */
734 _createExpandedValueElement(value) { 734 _createExpandedValueElement(value) {
735 var needsAlternateValue = value.hasChildren && !value.customPreview() && val ue.subtype !== 'node' && 735 var needsAlternateValue = value.hasChildren && !value.customPreview() && val ue.subtype !== 'node' &&
736 value.type !== 'function' && (value.type !== 'object' || value.preview); 736 value.type !== 'function' && (value.type !== 'object' || value.preview);
737 if (!needsAlternateValue) 737 if (!needsAlternateValue)
738 return null; 738 return null;
739 739
740 var valueElement = createElementWithClass('span', 'value'); 740 var valueElement = createElementWithClass('span', 'value');
741 valueElement.setTextContentTruncatedIfNeeded(value.description || ''); 741 if (value.description === 'Object')
742 valueElement.textContent = '';
743 else
744 valueElement.setTextContentTruncatedIfNeeded(value.description || '');
742 valueElement.classList.add('object-value-' + (value.subtype || value.type)); 745 valueElement.classList.add('object-value-' + (value.subtype || value.type));
743 valueElement.title = value.description || ''; 746 valueElement.title = value.description || '';
744 return valueElement; 747 return valueElement;
745 } 748 }
746 749
747 update() { 750 update() {
748 this.nameElement = ObjectUI.ObjectPropertiesSection.createNameElement(this.p roperty.name); 751 this.nameElement = ObjectUI.ObjectPropertiesSection.createNameElement(this.p roperty.name);
749 if (!this.property.enumerable) 752 if (!this.property.enumerable)
750 this.nameElement.classList.add('object-properties-section-dimmed'); 753 this.nameElement.classList.add('object-properties-section-dimmed');
751 if (this.property.synthetic) 754 if (this.property.synthetic)
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 var title = options.title; 1371 var title = options.title;
1369 var section = new ObjectUI.ObjectPropertiesSection(object, title); 1372 var section = new ObjectUI.ObjectPropertiesSection(object, title);
1370 if (!title) 1373 if (!title)
1371 section.titleLessMode(); 1374 section.titleLessMode();
1372 if (options.expanded) 1375 if (options.expanded)
1373 section.expand(); 1376 section.expand();
1374 section.editable = !!options.editable; 1377 section.editable = !!options.editable;
1375 return Promise.resolve(section.element); 1378 return Promise.resolve(section.element);
1376 } 1379 }
1377 }; 1380 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698