OLD | NEW |
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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 // String.format does treat formattedResult like a Builder, result is an
object. | 864 // String.format does treat formattedResult like a Builder, result is an
object. |
865 return String.format(format, parameters, formatters, formattedResult, ap
pend); | 865 return String.format(format, parameters, formatters, formattedResult, ap
pend); |
866 }, | 866 }, |
867 | 867 |
868 /** | 868 /** |
869 * @return {boolean} | 869 * @return {boolean} |
870 */ | 870 */ |
871 matchesFilterRegex: function(regexObject) | 871 matchesFilterRegex: function(regexObject) |
872 { | 872 { |
873 regexObject.lastIndex = 0; | 873 regexObject.lastIndex = 0; |
874 var text = this.searchableElement().deepTextContent(); | 874 var text = this.formattedMessage().deepTextContent(); |
875 if (this._anchorElement) | |
876 text += " " + this._anchorElement.textContent; | |
877 return regexObject.test(text); | 875 return regexObject.test(text); |
878 }, | 876 }, |
879 | 877 |
880 /** | 878 /** |
881 * @param {boolean} show | 879 * @param {boolean} show |
882 */ | 880 */ |
883 updateTimestamp: function(show) | 881 updateTimestamp: function(show) |
884 { | 882 { |
885 if (!this._formattedMessage) | 883 if (!this._formattedMessage) |
886 return; | 884 return; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 setSearchRegex: function(regex) | 1170 setSearchRegex: function(regex) |
1173 { | 1171 { |
1174 if (this._searchHiglightNodeChanges && this._searchHiglightNodeChanges.l
ength) | 1172 if (this._searchHiglightNodeChanges && this._searchHiglightNodeChanges.l
ength) |
1175 WebInspector.revertDomChanges(this._searchHiglightNodeChanges); | 1173 WebInspector.revertDomChanges(this._searchHiglightNodeChanges); |
1176 this._searchRegex = regex; | 1174 this._searchRegex = regex; |
1177 this._searchHighlightNodes = []; | 1175 this._searchHighlightNodes = []; |
1178 this._searchHiglightNodeChanges = []; | 1176 this._searchHiglightNodeChanges = []; |
1179 if (!this._searchRegex) | 1177 if (!this._searchRegex) |
1180 return; | 1178 return; |
1181 | 1179 |
1182 var text = this.searchableElement().deepTextContent(); | 1180 var text = this.formattedMessage().deepTextContent(); |
1183 var match; | 1181 var match; |
1184 this._searchRegex.lastIndex = 0; | 1182 this._searchRegex.lastIndex = 0; |
1185 var sourceRanges = []; | 1183 var sourceRanges = []; |
1186 while ((match = this._searchRegex.exec(text)) && match[0]) | 1184 while ((match = this._searchRegex.exec(text)) && match[0]) |
1187 sourceRanges.push(new WebInspector.SourceRange(match.index, match[0]
.length)); | 1185 sourceRanges.push(new WebInspector.SourceRange(match.index, match[0]
.length)); |
1188 | 1186 |
1189 if (sourceRanges.length && this.searchableElement()) | 1187 if (sourceRanges.length && this.formattedMessage()) |
1190 this._searchHighlightNodes = WebInspector.highlightSearchResults(thi
s.searchableElement(), sourceRanges, this._searchHiglightNodeChanges); | 1188 this._searchHighlightNodes = WebInspector.highlightSearchResults(thi
s.formattedMessage(), sourceRanges, this._searchHiglightNodeChanges); |
1191 }, | 1189 }, |
1192 | 1190 |
1193 /** | 1191 /** |
1194 * @return {?RegExp} | 1192 * @return {?RegExp} |
1195 */ | 1193 */ |
1196 searchRegex: function() | 1194 searchRegex: function() |
1197 { | 1195 { |
1198 return this._searchRegex; | 1196 return this._searchRegex; |
1199 }, | 1197 }, |
1200 | 1198 |
1201 /** | 1199 /** |
1202 * @return {number} | 1200 * @return {number} |
1203 */ | 1201 */ |
1204 searchCount: function() | 1202 searchCount: function() |
1205 { | 1203 { |
1206 return this._searchHighlightNodes.length; | 1204 return this._searchHighlightNodes.length; |
1207 }, | 1205 }, |
1208 | 1206 |
1209 /** | 1207 /** |
1210 * @return {!Element} | 1208 * @return {!Element} |
1211 */ | 1209 */ |
1212 searchHighlightNode: function(index) | 1210 searchHighlightNode: function(index) |
1213 { | 1211 { |
1214 return this._searchHighlightNodes[index]; | 1212 return this._searchHighlightNodes[index]; |
1215 }, | 1213 }, |
1216 | 1214 |
1217 /** | 1215 /** |
1218 * @return {!Element} | |
1219 */ | |
1220 searchableElement: function() | |
1221 { | |
1222 this.formattedMessage(); | |
1223 return this._messageElement; | |
1224 }, | |
1225 | |
1226 /** | |
1227 * @param {string} string | 1216 * @param {string} string |
1228 * @return {?Element} | 1217 * @return {?Element} |
1229 */ | 1218 */ |
1230 _tryFormatAsError: function(string) | 1219 _tryFormatAsError: function(string) |
1231 { | 1220 { |
1232 /** | 1221 /** |
1233 * @param {string} prefix | 1222 * @param {string} prefix |
1234 */ | 1223 */ |
1235 function startsWith(prefix) | 1224 function startsWith(prefix) |
1236 { | 1225 { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 { | 1334 { |
1346 if (!this._wrapperElement) { | 1335 if (!this._wrapperElement) { |
1347 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this
); | 1336 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this
); |
1348 this._wrapperElement.classList.toggle("collapsed", this._collapsed); | 1337 this._wrapperElement.classList.toggle("collapsed", this._collapsed); |
1349 } | 1338 } |
1350 return this._wrapperElement; | 1339 return this._wrapperElement; |
1351 }, | 1340 }, |
1352 | 1341 |
1353 __proto__: WebInspector.ConsoleViewMessage.prototype | 1342 __proto__: WebInspector.ConsoleViewMessage.prototype |
1354 } | 1343 } |
OLD | NEW |