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

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

Issue 2676773002: DevTools: restore the style of expandable titles on console object previews (Closed)
Patch Set: a 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 /* 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperti es); 46 object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperti es);
47 this.appendChild(this._objectTreeElement); 47 this.appendChild(this._objectTreeElement);
48 if (typeof title === 'string' || !title) { 48 if (typeof title === 'string' || !title) {
49 this.titleElement = this.element.createChild('span'); 49 this.titleElement = this.element.createChild('span');
50 this.titleElement.textContent = title || ''; 50 this.titleElement.textContent = title || '';
51 } else { 51 } else {
52 this.titleElement = title; 52 this.titleElement = title;
53 this.element.appendChild(title); 53 this.element.appendChild(title);
54 } 54 }
55 55
56 if (object.description && Components.ObjectPropertiesSection._needsAlternate Title(object)) {
57 this.expandedTitleElement = createElement('span');
58 this.expandedTitleElement.createTextChild(object.description);
59
60 var note = this.expandedTitleElement.createChild('span', 'object-state-not e');
61 note.classList.add('info-note');
62 note.title = Common.UIString('Value below was evaluated just now.');
63 }
64
65 this.element._section = this; 56 this.element._section = this;
66 this.registerRequiredCSS('components/objectValue.css'); 57 this.registerRequiredCSS('components/objectValue.css');
67 this.registerRequiredCSS('components/objectPropertiesSection.css'); 58 this.registerRequiredCSS('components/objectPropertiesSection.css');
68 this.rootElement().childrenListElement.classList.add('source-code', 'object- properties-section'); 59 this.rootElement().childrenListElement.classList.add('source-code', 'object- properties-section');
69 } 60 }
70 61
71 /** 62 /**
72 * @param {!SDK.RemoteObject} object 63 * @param {!SDK.RemoteObject} object
73 * @param {!Components.Linkifier=} linkifier 64 * @param {!Components.Linkifier=} linkifier
74 * @param {boolean=} skipProto 65 * @param {boolean=} skipProto
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 var numberParts = description.split('e'); 320 var numberParts = description.split('e');
330 valueElement.createChild('span', 'object-value-scientific-notation-mantiss a').textContent = numberParts[0]; 321 valueElement.createChild('span', 'object-value-scientific-notation-mantiss a').textContent = numberParts[0];
331 valueElement.createChild('span', 'object-value-scientific-notation-exponen t').textContent = 'e' + numberParts[1]; 322 valueElement.createChild('span', 'object-value-scientific-notation-exponen t').textContent = 'e' + numberParts[1];
332 valueElement.classList.add('object-value-scientific-notation-number'); 323 valueElement.classList.add('object-value-scientific-notation-number');
333 valueElement.title = description || ''; 324 valueElement.title = description || '';
334 return valueElement; 325 return valueElement;
335 } 326 }
336 } 327 }
337 328
338 /** 329 /**
339 * @param {!SDK.RemoteObject} object
340 * @return {boolean}
341 */
342 static _needsAlternateTitle(object) {
343 return object && object.hasChildren && !object.customPreview() && object.sub type !== 'node' &&
344 object.type !== 'function' && (object.type !== 'object' || object.previe w);
345 }
346
347 /**
348 * @param {!SDK.RemoteObject} func 330 * @param {!SDK.RemoteObject} func
349 * @param {!Element} element 331 * @param {!Element} element
350 * @param {boolean} linkify 332 * @param {boolean} linkify
351 * @param {boolean=} includePreview 333 * @param {boolean=} includePreview
352 */ 334 */
353 static formatObjectAsFunction(func, element, linkify, includePreview) { 335 static formatObjectAsFunction(func, element, linkify, includePreview) {
354 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails); 336 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails);
355 337
356 /** 338 /**
357 * @param {?SDK.DebuggerModel.FunctionDetails} response 339 * @param {?SDK.DebuggerModel.FunctionDetails} response
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 this.selectable = false; 421 this.selectable = false;
440 this.toggleOnClick = true; 422 this.toggleOnClick = true;
441 this.listItemElement.classList.add('object-properties-section-root-element') ; 423 this.listItemElement.classList.add('object-properties-section-root-element') ;
442 this._linkifier = linkifier; 424 this._linkifier = linkifier;
443 } 425 }
444 426
445 /** 427 /**
446 * @override 428 * @override
447 */ 429 */
448 onexpand() { 430 onexpand() {
449 if (this.treeOutline) { 431 if (this.treeOutline)
450 this.treeOutline.element.classList.add('expanded'); 432 this.treeOutline.element.classList.add('expanded');
451 this._showExpandedTitleElement(true);
452 }
453 } 433 }
454 434
455 /** 435 /**
456 * @override 436 * @override
457 */ 437 */
458 oncollapse() { 438 oncollapse() {
459 if (this.treeOutline) { 439 if (this.treeOutline)
460 this.treeOutline.element.classList.remove('expanded'); 440 this.treeOutline.element.classList.remove('expanded');
461 this._showExpandedTitleElement(false);
462 }
463 } 441 }
464 442
465 /** 443 /**
466 * @param {boolean} value
467 */
468 _showExpandedTitleElement(value) {
469 if (!this.treeOutline.expandedTitleElement)
470 return;
471 if (value)
472 this.treeOutline.element.replaceChild(this.treeOutline.expandedTitleElemen t, this.treeOutline.titleElement);
473 else
474 this.treeOutline.element.replaceChild(this.treeOutline.titleElement, this. treeOutline.expandedTitleElement);
475 }
476
477 /**
478 * @override 444 * @override
479 * @param {!Event} e 445 * @param {!Event} e
480 * @return {boolean} 446 * @return {boolean}
481 */ 447 */
482 ondblclick(e) { 448 ondblclick(e) {
483 return true; 449 return true;
484 } 450 }
485 451
486 /** 452 /**
487 * @override 453 * @override
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 this.listItemElement.replaceChild(this.expandedValueElement, this.valueEle ment); 726 this.listItemElement.replaceChild(this.expandedValueElement, this.valueEle ment);
761 else 727 else
762 this.listItemElement.replaceChild(this.valueElement, this.expandedValueEle ment); 728 this.listItemElement.replaceChild(this.valueElement, this.expandedValueEle ment);
763 } 729 }
764 730
765 /** 731 /**
766 * @param {!SDK.RemoteObject} value 732 * @param {!SDK.RemoteObject} value
767 * @return {?Element} 733 * @return {?Element}
768 */ 734 */
769 _createExpandedValueElement(value) { 735 _createExpandedValueElement(value) {
770 if (!Components.ObjectPropertiesSection._needsAlternateTitle(value)) 736 var needsAlternateValue = value.hasChildren && !value.customPreview() && val ue.subtype !== 'node' &&
737 value.type !== 'function' && (value.type !== 'object' || value.preview);
738 if (!needsAlternateValue)
771 return null; 739 return null;
772 740
773 var valueElement = createElementWithClass('span', 'value'); 741 var valueElement = createElementWithClass('span', 'value');
774 valueElement.setTextContentTruncatedIfNeeded(value.description || ''); 742 valueElement.setTextContentTruncatedIfNeeded(value.description || '');
775 valueElement.classList.add('object-value-' + (value.subtype || value.type)); 743 valueElement.classList.add('object-value-' + (value.subtype || value.type));
776 valueElement.title = value.description || ''; 744 valueElement.title = value.description || '';
777 return valueElement; 745 return valueElement;
778 } 746 }
779 747
780 update() { 748 update() {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 } 1345 }
1378 var treeOutlineId = treeElement.treeOutline[Components.ObjectPropertiesSecti onExpandController._treeOutlineId]; 1346 var treeOutlineId = treeElement.treeOutline[Components.ObjectPropertiesSecti onExpandController._treeOutlineId];
1379 result = treeOutlineId + (result ? ':' + result : ''); 1347 result = treeOutlineId + (result ? ':' + result : '');
1380 treeElement[Components.ObjectPropertiesSectionExpandController._cachedPathSy mbol] = result; 1348 treeElement[Components.ObjectPropertiesSectionExpandController._cachedPathSy mbol] = result;
1381 return result; 1349 return result;
1382 } 1350 }
1383 }; 1351 };
1384 1352
1385 Components.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('c achedPath'); 1353 Components.ObjectPropertiesSectionExpandController._cachedPathSymbol = Symbol('c achedPath');
1386 Components.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('tree OutlineId'); 1354 Components.ObjectPropertiesSectionExpandController._treeOutlineId = Symbol('tree OutlineId');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698