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

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

Issue 254833004: DevTools: [Console] use filtering to collapse and expand console groups (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update tests Created 6 years, 8 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 | Annotate | Revision Log
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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 }, 894 },
895 895
896 /** 896 /**
897 * @return {number} 897 * @return {number}
898 */ 898 */
899 nestingLevel: function() 899 nestingLevel: function()
900 { 900 {
901 return this._nestingLevel; 901 return this._nestingLevel;
902 }, 902 },
903 903
904 /** 904 resetCloseGroupDecorationCount: function()
905 * @return {number}
906 */
907 closeGroupDecorationCount: function()
908 { 905 {
909 return this._closeGroupDecorationCount; 906 this._closeGroupDecorationCount = 0;
907 this._updateCloseGroupDecorations();
910 }, 908 },
911 909
912 /** 910 incrementCloseGroupDecorationCount: function()
913 * @param {number} count
914 */
915 setCloseGroupDecorationCount: function(count)
916 { 911 {
917 this._closeGroupDecorationCount = count; 912 ++this._closeGroupDecorationCount;
918 if (!this._element) 913 this._updateCloseGroupDecorations();
919 this.toMessageElement(); 914 },
915
916 _updateCloseGroupDecorations: function()
917 {
918 if (!this._nestingLevelMarkers)
919 return;
920 for (var i = 0, n = this._nestingLevelMarkers.length; i < n; ++i) { 920 for (var i = 0, n = this._nestingLevelMarkers.length; i < n; ++i) {
921 var marker = this._nestingLevelMarkers[i]; 921 var marker = this._nestingLevelMarkers[i];
922 marker.classList.toggle("group-closed", n - i <= count); 922 marker.classList.toggle("group-closed", n - i <= this._closeGroupDec orationCount);
923 } 923 }
924 }, 924 },
925 925
926 /** 926 /**
927 * @return {!Element} 927 * @return {!Element}
928 */ 928 */
929 contentElement: function() 929 contentElement: function()
930 { 930 {
931 if (this._element) 931 if (this._element)
932 return this._element; 932 return this._element;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 */ 970 */
971 toMessageElement: function() 971 toMessageElement: function()
972 { 972 {
973 if (this._wrapperElement) 973 if (this._wrapperElement)
974 return this._wrapperElement; 974 return this._wrapperElement;
975 975
976 this._wrapperElement = document.createElementWithClass("div", "console-m essage-wrapper"); 976 this._wrapperElement = document.createElementWithClass("div", "console-m essage-wrapper");
977 this._nestingLevelMarkers = []; 977 this._nestingLevelMarkers = [];
978 for (var i = 0; i < this._nestingLevel; ++i) 978 for (var i = 0; i < this._nestingLevel; ++i)
979 this._nestingLevelMarkers.push(this._wrapperElement.createChild("div ", "nesting-level-marker")); 979 this._nestingLevelMarkers.push(this._wrapperElement.createChild("div ", "nesting-level-marker"));
980 this._updateCloseGroupDecorations();
980 this._wrapperElement.message = this; 981 this._wrapperElement.message = this;
981 982
982 this._wrapperElement.appendChild(this.contentElement()); 983 this._wrapperElement.appendChild(this.contentElement());
983 return this._wrapperElement; 984 return this._wrapperElement;
984 }, 985 },
985 986
986 _populateStackTraceTreeElement: function(parentTreeElement) 987 _populateStackTraceTreeElement: function(parentTreeElement)
987 { 988 {
988 for (var i = 0; i < this._message.stackTrace.length; i++) { 989 for (var i = 0; i < this._message.stackTrace.length; i++) {
989 var frame = this._message.stackTrace[i]; 990 var frame = this._message.stackTrace[i];
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line; 1134 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line;
1134 }, 1135 },
1135 1136
1136 get text() 1137 get text()
1137 { 1138 {
1138 return this._message.messageText; 1139 return this._message.messageText;
1139 }, 1140 },
1140 1141
1141 __proto__: WebInspector.TargetAware.prototype 1142 __proto__: WebInspector.TargetAware.prototype
1142 } 1143 }
1144
1145 /**
1146 * @constructor
1147 * @extends {WebInspector.ConsoleViewMessage}
1148 * @param {!WebInspector.ConsoleMessage} consoleMessage
1149 * @param {?WebInspector.Linkifier} linkifier
1150 * @param {number} nestingLevel
1151 */
1152 WebInspector.ConsoleGroupViewMessage = function(consoleMessage, linkifier, nesti ngLevel)
1153 {
1154 console.assert(consoleMessage.isGroupStartMessage());
1155 WebInspector.ConsoleViewMessage.call(this, consoleMessage, linkifier, nestin gLevel);
1156 this.setCollapsed(consoleMessage.type === WebInspector.ConsoleMessage.Messag eType.StartGroupCollapsed);
1157 }
1158
1159 WebInspector.ConsoleGroupViewMessage.prototype = {
1160 /**
1161 * @param {boolean} collapsed
1162 */
1163 setCollapsed: function(collapsed)
1164 {
1165 this._collapsed = collapsed;
1166 if (this._wrapperElement)
1167 this._wrapperElement.classList.toggle("collapsed", this._collapsed);
1168 },
1169
1170 /**
1171 * @return {boolean}
1172 */
1173 collapsed: function()
1174 {
1175 return this._collapsed;
1176 },
1177
1178 /**
1179 * @return {!Element}
1180 */
1181 toMessageElement: function()
1182 {
1183 if (!this._wrapperElement) {
1184 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this );
1185 this._wrapperElement.classList.toggle("collapsed", this._collapsed);
1186 }
1187 return this._wrapperElement;
1188 },
1189
1190 __proto__: WebInspector.ConsoleViewMessage.prototype
1191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698