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

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

Issue 2536073002: DevTools: [Console] migrate message level icons to UI.Icon (Closed)
Patch Set: Created 4 years 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 | third_party/WebKit/Source/devtools/front_end/console/consoleView.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
41 this._message = consoleMessage; 41 this._message = consoleMessage;
42 this._linkifier = linkifier; 42 this._linkifier = linkifier;
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 {?UI.DataGrid} */ 47 /** @type {?UI.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} */
52 this._messageLevelIcon = null;
51 } 53 }
52 54
53 /** 55 /**
54 * @return {?SDK.Target} 56 * @return {?SDK.Target}
55 */ 57 */
56 _target() { 58 _target() {
57 return this.consoleMessage().target(); 59 return this.consoleMessage().target();
58 } 60 }
59 61
60 /** 62 /**
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 } 932 }
931 933
932 /** 934 /**
933 * @return {!Element} 935 * @return {!Element}
934 */ 936 */
935 contentElement() { 937 contentElement() {
936 if (this._contentElement) 938 if (this._contentElement)
937 return this._contentElement; 939 return this._contentElement;
938 940
939 var contentElement = createElementWithClass('div', 'console-message'); 941 var contentElement = createElementWithClass('div', 'console-message');
942 if (this._messageLevelIcon)
943 contentElement.appendChild(this._messageLevelIcon);
940 this._contentElement = contentElement; 944 this._contentElement = contentElement;
941 if (this._message.type === SDK.ConsoleMessage.MessageType.StartGroup || 945 if (this._message.type === SDK.ConsoleMessage.MessageType.StartGroup ||
942 this._message.type === SDK.ConsoleMessage.MessageType.StartGroupCollapse d) 946 this._message.type === SDK.ConsoleMessage.MessageType.StartGroupCollapse d)
943 contentElement.classList.add('console-group-title'); 947 contentElement.classList.add('console-group-title');
944 948
945 var formattedMessage; 949 var formattedMessage;
946 var consoleMessage = this._message; 950 var consoleMessage = this._message;
947 var target = consoleMessage.target(); 951 var target = consoleMessage.target();
948 var shouldIncludeTrace = 952 var shouldIncludeTrace =
949 !!consoleMessage.stackTrace && (consoleMessage.source === SDK.ConsoleMes sage.MessageSource.Network || 953 !!consoleMessage.stackTrace && (consoleMessage.source === SDK.ConsoleMes sage.MessageSource.Network ||
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 988
985 this._nestingLevelMarkers = []; 989 this._nestingLevelMarkers = [];
986 for (var i = 0; i < this._nestingLevel; ++i) 990 for (var i = 0; i < this._nestingLevel; ++i)
987 this._nestingLevelMarkers.push(this._element.createChild('div', 'nesting-l evel-marker')); 991 this._nestingLevelMarkers.push(this._element.createChild('div', 'nesting-l evel-marker'));
988 this._updateCloseGroupDecorations(); 992 this._updateCloseGroupDecorations();
989 this._element.message = this; 993 this._element.message = this;
990 994
991 switch (this._message.level) { 995 switch (this._message.level) {
992 case SDK.ConsoleMessage.MessageLevel.Log: 996 case SDK.ConsoleMessage.MessageLevel.Log:
993 this._element.classList.add('console-log-level'); 997 this._element.classList.add('console-log-level');
998 this._updateMessageLevelIcon('');
994 break; 999 break;
995 case SDK.ConsoleMessage.MessageLevel.Debug: 1000 case SDK.ConsoleMessage.MessageLevel.Debug:
996 this._element.classList.add('console-debug-level'); 1001 this._element.classList.add('console-debug-level');
1002 this._updateMessageLevelIcon('');
997 break; 1003 break;
998 case SDK.ConsoleMessage.MessageLevel.Warning: 1004 case SDK.ConsoleMessage.MessageLevel.Warning:
999 this._element.classList.add('console-warning-level'); 1005 this._element.classList.add('console-warning-level');
1006 this._updateMessageLevelIcon('smallicon-warning');
1000 break; 1007 break;
1001 case SDK.ConsoleMessage.MessageLevel.Error: 1008 case SDK.ConsoleMessage.MessageLevel.Error:
1002 this._element.classList.add('console-error-level'); 1009 this._element.classList.add('console-error-level');
1010 this._updateMessageLevelIcon('smallicon-error');
1003 break; 1011 break;
1004 case SDK.ConsoleMessage.MessageLevel.RevokedError: 1012 case SDK.ConsoleMessage.MessageLevel.RevokedError:
1005 this._element.classList.add('console-revokedError-level'); 1013 this._element.classList.add('console-revokedError-level');
1014 this._updateMessageLevelIcon('smallicon-revoked-error');
1006 break; 1015 break;
1007 case SDK.ConsoleMessage.MessageLevel.Info: 1016 case SDK.ConsoleMessage.MessageLevel.Info:
1008 this._element.classList.add('console-info-level'); 1017 this._element.classList.add('console-info-level');
1018 this._updateMessageLevelIcon('smallicon-info');
1009 break; 1019 break;
1010 } 1020 }
1011 1021
1012 this._element.appendChild(this.contentElement()); 1022 this._element.appendChild(this.contentElement());
1013 if (this._repeatCount > 1) 1023 if (this._repeatCount > 1)
1014 this._showRepeatCountElement(); 1024 this._showRepeatCountElement();
1015 } 1025 }
1016 1026
1017 /** 1027 /**
1028 * @param {string} iconType
1029 */
1030 _updateMessageLevelIcon(iconType) {
1031 if (!iconType && !this._messageLevelIcon)
1032 return;
1033 if (iconType && !this._messageLevelIcon) {
1034 this._messageLevelIcon = UI.Icon.create('', 'message-level-icon');
1035 if (this._contentElement)
1036 this._contentElement.insertBefore(this._messageLevelIcon, this._contentE lement.firstChild);
1037 }
1038 this._messageLevelIcon.setIconType(iconType);
1039 }
1040
1041 /**
1018 * @return {number} 1042 * @return {number}
1019 */ 1043 */
1020 repeatCount() { 1044 repeatCount() {
1021 return this._repeatCount || 1; 1045 return this._repeatCount || 1;
1022 } 1046 }
1023 1047
1024 resetIncrementRepeatCount() { 1048 resetIncrementRepeatCount() {
1025 this._repeatCount = 1; 1049 this._repeatCount = 1;
1026 if (!this._repeatCountElement) 1050 if (!this._repeatCountElement)
1027 return; 1051 return;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 * @return {!Element} 1256 * @return {!Element}
1233 */ 1257 */
1234 toMessageElement() { 1258 toMessageElement() {
1235 if (!this._element) { 1259 if (!this._element) {
1236 super.toMessageElement(); 1260 super.toMessageElement();
1237 this._element.classList.toggle('collapsed', this._collapsed); 1261 this._element.classList.toggle('collapsed', this._collapsed);
1238 } 1262 }
1239 return this._element; 1263 return this._element;
1240 } 1264 }
1241 }; 1265 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/console/consoleView.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698