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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 2623143002: DevTools: insert console message decorations in order
Patch Set: ac Created 3 years, 11 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 this._repeatCount = 1; 43 this._repeatCount = 1;
44 this._closeGroupDecorationCount = 0; 44 this._closeGroupDecorationCount = 0;
45 this._nestingLevel = nestingLevel; 45 this._nestingLevel = nestingLevel;
46 46
47 /** @type {?DataGrid.DataGrid} */ 47 /** @type {?DataGrid.DataGrid} */
48 this._dataGrid = null; 48 this._dataGrid = null;
49 this._previewFormatter = new Components.RemoteObjectPreviewFormatter(); 49 this._previewFormatter = new Components.RemoteObjectPreviewFormatter();
50 this._searchRegex = null; 50 this._searchRegex = null;
51 /** @type {?UI.Icon} */ 51 /** @type {?UI.Icon} */
52 this._messageLevelIcon = null; 52 this._messageLevelIcon = null;
53 /** @type {!Element|undefined} */
54 this._contextLabelElement;
53 } 55 }
54 56
55 /** 57 /**
56 * @return {?SDK.Target} 58 * @return {?SDK.Target}
57 */ 59 */
58 _target() { 60 _target() {
59 return this.consoleMessage().target(); 61 return this.consoleMessage().target();
60 } 62 }
61 63
62 /** 64 /**
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 818 }
817 819
818 /** 820 /**
819 * @param {boolean} show 821 * @param {boolean} show
820 */ 822 */
821 updateTimestamp(show) { 823 updateTimestamp(show) {
822 if (!this._contentElement) 824 if (!this._contentElement)
823 return; 825 return;
824 826
825 if (show && !this.timestampElement) { 827 if (show && !this.timestampElement) {
828 var timeStampText = (new Date(this._message.timestamp)).toConsoleTime() + ' ';
826 this.timestampElement = createElementWithClass('span', 'console-timestamp' ); 829 this.timestampElement = createElementWithClass('span', 'console-timestamp' );
827 this.timestampElement.textContent = (new Date(this._message.timestamp)).to ConsoleTime() + ' '; 830 this.timestampElement.title = timeStampText;
831 this.timestampElement.createChild('span', 'console-timestamp-visible').tex tContent = timeStampText;
828 this._contentElement.insertBefore(this.timestampElement, this._contentElem ent.firstChild); 832 this._contentElement.insertBefore(this.timestampElement, this._contentElem ent.firstChild);
829 return; 833 return;
830 } 834 }
831 835
832 if (!show && this.timestampElement) { 836 if (!show && this.timestampElement) {
833 this.timestampElement.remove(); 837 this.timestampElement.remove();
834 delete this.timestampElement; 838 delete this.timestampElement;
835 } 839 }
836 } 840 }
837 841
842 updateContextLabel() {
843 var target = this._target();
844 if (!this._contentElement || !target)
845 return;
846 if (!this._contextLabelElement) {
847 this._contextLabelElement = createElementWithClass('span', 'console-contex t-label');
848 this._contentElement.insertBefore(this._contextLabelElement, this._content Element.firstChild);
849 }
850
851 // Messages without titles include worker messages with source != 'worker', no workerId, or uncaught errors.
852 var labelText = '';
853 var messageContext = target.runtimeModel.executionContext(this._message.exec utionContextId);
854 if (messageContext && messageContext !== UI.context.flavor(SDK.ExecutionCont ext))
855 labelText = Console.ConsoleContextSelector.titleForContext(messageContext, false /* formatForSelector */);
856 this._contextLabelElement.textContent = labelText ? labelText + ' ' : labelT ext;
857 this._contextLabelElement.title = labelText;
858 }
859
838 /** 860 /**
839 * @return {number} 861 * @return {number}
840 */ 862 */
841 nestingLevel() { 863 nestingLevel() {
842 return this._nestingLevel; 864 return this._nestingLevel;
843 } 865 }
844 866
845 resetCloseGroupDecorationCount() { 867 resetCloseGroupDecorationCount() {
846 if (!this._closeGroupDecorationCount) 868 if (!this._closeGroupDecorationCount)
847 return; 869 return;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 consoleMessage.type === SDK.ConsoleMessa ge.MessageType.Trace || 910 consoleMessage.type === SDK.ConsoleMessa ge.MessageType.Trace ||
889 consoleMessage.level === SDK.ConsoleMess age.MessageLevel.Warning); 911 consoleMessage.level === SDK.ConsoleMess age.MessageLevel.Warning);
890 if (target && shouldIncludeTrace) 912 if (target && shouldIncludeTrace)
891 formattedMessage = this._buildMessageWithStackTrace(consoleMessage, target , this._linkifier); 913 formattedMessage = this._buildMessageWithStackTrace(consoleMessage, target , this._linkifier);
892 else if (this._message.type === SDK.ConsoleMessage.MessageType.Table) 914 else if (this._message.type === SDK.ConsoleMessage.MessageType.Table)
893 formattedMessage = this._buildTableMessage(this._message); 915 formattedMessage = this._buildTableMessage(this._message);
894 else 916 else
895 formattedMessage = this._buildMessage(consoleMessage); 917 formattedMessage = this._buildMessage(consoleMessage);
896 contentElement.appendChild(formattedMessage); 918 contentElement.appendChild(formattedMessage);
897 919
920 this.updateContextLabel();
898 this.updateTimestamp(Common.moduleSetting('consoleTimestampsEnabled').get()) ; 921 this.updateTimestamp(Common.moduleSetting('consoleTimestampsEnabled').get()) ;
899 return this._contentElement; 922 return this._contentElement;
900 } 923 }
901 924
902 /** 925 /**
903 * @return {!Element} 926 * @return {!Element}
904 */ 927 */
905 toMessageElement() { 928 toMessageElement() {
906 if (this._element) 929 if (this._element)
907 return this._element; 930 return this._element;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 toMessageElement() { 1231 toMessageElement() {
1209 if (!this._element) { 1232 if (!this._element) {
1210 super.toMessageElement(); 1233 super.toMessageElement();
1211 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); 1234 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon');
1212 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); 1235 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild);
1213 this.setCollapsed(this._collapsed); 1236 this.setCollapsed(this._collapsed);
1214 } 1237 }
1215 return this._element; 1238 return this._element;
1216 } 1239 }
1217 }; 1240 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698