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

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

Issue 2349143006: DevTools: ConsoleViewFormatter rename _element to _contentElement, _wrapperElement to _element (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js ('k') | no next file » | 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 var marker = this._nestingLevelMarkers[i]; 940 var marker = this._nestingLevelMarkers[i];
941 marker.classList.toggle("group-closed", n - i <= this._closeGroupDec orationCount); 941 marker.classList.toggle("group-closed", n - i <= this._closeGroupDec orationCount);
942 } 942 }
943 }, 943 },
944 944
945 /** 945 /**
946 * @return {!Element} 946 * @return {!Element}
947 */ 947 */
948 contentElement: function() 948 contentElement: function()
949 { 949 {
950 if (this._element) 950 if (this._contentElement)
951 return this._element; 951 return this._contentElement;
952 952
953 var element = createElementWithClass("div", "console-message"); 953 var contentElement = createElementWithClass("div", "console-message");
954 this._element = element; 954 this._contentElement = contentElement;
955 955
956 if (this._message.type === WebInspector.ConsoleMessage.MessageType.Start Group || this._message.type === WebInspector.ConsoleMessage.MessageType.StartGro upCollapsed) 956 if (this._message.type === WebInspector.ConsoleMessage.MessageType.Start Group || this._message.type === WebInspector.ConsoleMessage.MessageType.StartGro upCollapsed)
957 element.classList.add("console-group-title"); 957 contentElement.classList.add("console-group-title");
958 958
959 element.appendChild(this.formattedMessage()); 959 contentElement.appendChild(this.formattedMessage());
960 960
961 this.updateTimestamp(WebInspector.moduleSetting("consoleTimestampsEnable d").get()); 961 this.updateTimestamp(WebInspector.moduleSetting("consoleTimestampsEnable d").get());
962 962
963 return this._element; 963 return this._contentElement;
964 }, 964 },
965 965
966 /** 966 /**
967 * @return {!Element} 967 * @return {!Element}
968 */ 968 */
969 toMessageElement: function() 969 toMessageElement: function()
970 { 970 {
971 if (this._wrapperElement) 971 if (this._element)
972 return this._wrapperElement; 972 return this._element;
973 973
974 this._wrapperElement = createElement("div"); 974 this._element = createElement("div");
975 this.updateMessageElement(); 975 this.updateMessageElement();
976 return this._wrapperElement; 976 return this._element;
977 }, 977 },
978 978
979 updateMessageElement: function() 979 updateMessageElement: function()
980 { 980 {
981 if (!this._wrapperElement) 981 if (!this._element)
982 return; 982 return;
983 983
984 this._wrapperElement.className = "console-message-wrapper"; 984 this._element.className = "console-message-wrapper";
985 this._wrapperElement.removeChildren(); 985 this._element.removeChildren();
986 986
987 this._nestingLevelMarkers = []; 987 this._nestingLevelMarkers = [];
988 for (var i = 0; i < this._nestingLevel; ++i) 988 for (var i = 0; i < this._nestingLevel; ++i)
989 this._nestingLevelMarkers.push(this._wrapperElement.createChild("div ", "nesting-level-marker")); 989 this._nestingLevelMarkers.push(this._element.createChild("div", "nes ting-level-marker"));
990 this._updateCloseGroupDecorations(); 990 this._updateCloseGroupDecorations();
991 this._wrapperElement.message = this; 991 this._element.message = this;
992 992
993 switch (this._message.level) { 993 switch (this._message.level) {
994 case WebInspector.ConsoleMessage.MessageLevel.Log: 994 case WebInspector.ConsoleMessage.MessageLevel.Log:
995 this._wrapperElement.classList.add("console-log-level"); 995 this._element.classList.add("console-log-level");
996 break; 996 break;
997 case WebInspector.ConsoleMessage.MessageLevel.Debug: 997 case WebInspector.ConsoleMessage.MessageLevel.Debug:
998 this._wrapperElement.classList.add("console-debug-level"); 998 this._element.classList.add("console-debug-level");
999 break; 999 break;
1000 case WebInspector.ConsoleMessage.MessageLevel.Warning: 1000 case WebInspector.ConsoleMessage.MessageLevel.Warning:
1001 this._wrapperElement.classList.add("console-warning-level"); 1001 this._element.classList.add("console-warning-level");
1002 break; 1002 break;
1003 case WebInspector.ConsoleMessage.MessageLevel.Error: 1003 case WebInspector.ConsoleMessage.MessageLevel.Error:
1004 this._wrapperElement.classList.add("console-error-level"); 1004 this._element.classList.add("console-error-level");
1005 break; 1005 break;
1006 case WebInspector.ConsoleMessage.MessageLevel.RevokedError: 1006 case WebInspector.ConsoleMessage.MessageLevel.RevokedError:
1007 this._wrapperElement.classList.add("console-revokedError-level"); 1007 this._element.classList.add("console-revokedError-level");
1008 break; 1008 break;
1009 case WebInspector.ConsoleMessage.MessageLevel.Info: 1009 case WebInspector.ConsoleMessage.MessageLevel.Info:
1010 this._wrapperElement.classList.add("console-info-level"); 1010 this._element.classList.add("console-info-level");
1011 break; 1011 break;
1012 } 1012 }
1013 1013
1014 this._wrapperElement.appendChild(this.contentElement()); 1014 this._element.appendChild(this.contentElement());
1015 if (this._repeatCount > 1) 1015 if (this._repeatCount > 1)
1016 this._showRepeatCountElement(); 1016 this._showRepeatCountElement();
1017 }, 1017 },
1018 1018
1019 /** 1019 /**
1020 * @return {number} 1020 * @return {number}
1021 */ 1021 */
1022 repeatCount: function() 1022 repeatCount: function()
1023 { 1023 {
1024 return this._repeatCount || 1; 1024 return this._repeatCount || 1;
(...skipping 10 matching lines...) Expand all
1035 }, 1035 },
1036 1036
1037 incrementRepeatCount: function() 1037 incrementRepeatCount: function()
1038 { 1038 {
1039 this._repeatCount++; 1039 this._repeatCount++;
1040 this._showRepeatCountElement(); 1040 this._showRepeatCountElement();
1041 }, 1041 },
1042 1042
1043 _showRepeatCountElement: function() 1043 _showRepeatCountElement: function()
1044 { 1044 {
1045 if (!this._element) 1045 if (!this._contentElement)
1046 return; 1046 return;
1047 1047
1048 if (!this._repeatCountElement) { 1048 if (!this._repeatCountElement) {
1049 this._repeatCountElement = createElementWithClass("label", "console- message-repeat-count", "dt-small-bubble"); 1049 this._repeatCountElement = createElementWithClass("label", "console- message-repeat-count", "dt-small-bubble");
1050 switch (this._message.level) { 1050 switch (this._message.level) {
1051 case WebInspector.ConsoleMessage.MessageLevel.Warning: 1051 case WebInspector.ConsoleMessage.MessageLevel.Warning:
1052 this._repeatCountElement.type = "warning"; 1052 this._repeatCountElement.type = "warning";
1053 break; 1053 break;
1054 case WebInspector.ConsoleMessage.MessageLevel.Error: 1054 case WebInspector.ConsoleMessage.MessageLevel.Error:
1055 this._repeatCountElement.type = "error"; 1055 this._repeatCountElement.type = "error";
1056 break; 1056 break;
1057 case WebInspector.ConsoleMessage.MessageLevel.Debug: 1057 case WebInspector.ConsoleMessage.MessageLevel.Debug:
1058 this._repeatCountElement.type = "debug"; 1058 this._repeatCountElement.type = "debug";
1059 break; 1059 break;
1060 default: 1060 default:
1061 this._repeatCountElement.type = "info"; 1061 this._repeatCountElement.type = "info";
1062 } 1062 }
1063 this._wrapperElement.insertBefore(this._repeatCountElement, this._el ement); 1063 this._element.insertBefore(this._repeatCountElement, this._contentEl ement);
1064 this._element.classList.add("repeated-message"); 1064 this._contentElement.classList.add("repeated-message");
1065 } 1065 }
1066 this._repeatCountElement.textContent = this._repeatCount; 1066 this._repeatCountElement.textContent = this._repeatCount;
1067 }, 1067 },
1068 1068
1069 get text() 1069 get text()
1070 { 1070 {
1071 return this._message.messageText; 1071 return this._message.messageText;
1072 }, 1072 },
1073 1073
1074 /** 1074 /**
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 this.setCollapsed(consoleMessage.type === WebInspector.ConsoleMessage.Messag eType.StartGroupCollapsed); 1223 this.setCollapsed(consoleMessage.type === WebInspector.ConsoleMessage.Messag eType.StartGroupCollapsed);
1224 } 1224 }
1225 1225
1226 WebInspector.ConsoleGroupViewMessage.prototype = { 1226 WebInspector.ConsoleGroupViewMessage.prototype = {
1227 /** 1227 /**
1228 * @param {boolean} collapsed 1228 * @param {boolean} collapsed
1229 */ 1229 */
1230 setCollapsed: function(collapsed) 1230 setCollapsed: function(collapsed)
1231 { 1231 {
1232 this._collapsed = collapsed; 1232 this._collapsed = collapsed;
1233 if (this._wrapperElement) 1233 if (this._element)
1234 this._wrapperElement.classList.toggle("collapsed", this._collapsed); 1234 this._element.classList.toggle("collapsed", this._collapsed);
1235 }, 1235 },
1236 1236
1237 /** 1237 /**
1238 * @return {boolean} 1238 * @return {boolean}
1239 */ 1239 */
1240 collapsed: function() 1240 collapsed: function()
1241 { 1241 {
1242 return this._collapsed; 1242 return this._collapsed;
1243 }, 1243 },
1244 1244
1245 /** 1245 /**
1246 * @override 1246 * @override
1247 * @return {!Element} 1247 * @return {!Element}
1248 */ 1248 */
1249 toMessageElement: function() 1249 toMessageElement: function()
1250 { 1250 {
1251 if (!this._wrapperElement) { 1251 if (!this._element) {
1252 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); 1252 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this );
1253 this._wrapperElement.classList.toggle("collapsed", this._collapsed); 1253 this._element.classList.toggle("collapsed", this._collapsed);
1254 } 1254 }
1255 return this._wrapperElement; 1255 return this._element;
1256 }, 1256 },
1257 1257
1258 __proto__: WebInspector.ConsoleViewMessage.prototype 1258 __proto__: WebInspector.ConsoleViewMessage.prototype
1259 } 1259 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698