Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1185 contentElement: function() | 1185 contentElement: function() |
| 1186 { | 1186 { |
| 1187 if (!this._element) { | 1187 if (!this._element) { |
| 1188 this._element = createElementWithClass("div", "console-user-command" ); | 1188 this._element = createElementWithClass("div", "console-user-command" ); |
| 1189 this._element.message = this; | 1189 this._element.message = this; |
| 1190 | 1190 |
| 1191 this._formattedCommand = createElementWithClass("span", "console-mes sage-text source-code"); | 1191 this._formattedCommand = createElementWithClass("span", "console-mes sage-text source-code"); |
| 1192 this._formattedCommand.textContent = this.text.replaceControlCharact ers(); | 1192 this._formattedCommand.textContent = this.text.replaceControlCharact ers(); |
| 1193 this._element.appendChild(this._formattedCommand); | 1193 this._element.appendChild(this._formattedCommand); |
| 1194 | 1194 |
| 1195 var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighligh ter("text/javascript", true); | 1195 if (this._formattedCommand.textContent.length < WebInspector.Console Command.MaxLengthToIgnoreHighlighter) { |
| 1196 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedComma nd).then(this._updateSearch.bind(this)) | 1196 var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHigh lighter("text/javascript", true); |
| 1197 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedC ommand).then(this._updateSearch.bind(this)) | |
| 1198 } else { | |
| 1199 this._updateSearch.bind(this); | |
|
dgozman
2016/06/14 08:55:04
this._updateSearch();
luoe
2016/06/14 18:29:54
Done.
| |
| 1200 } | |
| 1197 } | 1201 } |
| 1198 return this._element; | 1202 return this._element; |
| 1199 }, | 1203 }, |
| 1200 | 1204 |
| 1201 _updateSearch: function() | 1205 _updateSearch: function() |
| 1202 { | 1206 { |
| 1203 this.setSearchRegex(this.searchRegex()); | 1207 this.setSearchRegex(this.searchRegex()); |
| 1204 }, | 1208 }, |
| 1205 | 1209 |
| 1206 __proto__: WebInspector.ConsoleViewMessage.prototype | 1210 __proto__: WebInspector.ConsoleViewMessage.prototype |
| 1207 } | 1211 } |
| 1208 | 1212 |
| 1209 /** | 1213 /** |
| 1214 * The maximum length before strings are considered too long for syntax highligh ting. | |
| 1215 * @const | |
| 1216 * @type {number} | |
| 1217 */ | |
| 1218 WebInspector.ConsoleCommand.MaxLengthToIgnoreHighlighter = 10000; | |
| 1219 | |
| 1220 /** | |
| 1210 * @constructor | 1221 * @constructor |
| 1211 * @extends {WebInspector.ConsoleViewMessage} | 1222 * @extends {WebInspector.ConsoleViewMessage} |
| 1212 * @param {!WebInspector.ConsoleMessage} message | 1223 * @param {!WebInspector.ConsoleMessage} message |
| 1213 * @param {!WebInspector.Linkifier} linkifier | 1224 * @param {!WebInspector.Linkifier} linkifier |
| 1214 * @param {number} nestingLevel | 1225 * @param {number} nestingLevel |
| 1215 */ | 1226 */ |
| 1216 WebInspector.ConsoleCommandResult = function(message, linkifier, nestingLevel) | 1227 WebInspector.ConsoleCommandResult = function(message, linkifier, nestingLevel) |
| 1217 { | 1228 { |
| 1218 WebInspector.ConsoleViewMessage.call(this, message, linkifier, nestingLevel) ; | 1229 WebInspector.ConsoleViewMessage.call(this, message, linkifier, nestingLevel) ; |
| 1219 } | 1230 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1329 return true; | 1340 return true; |
| 1330 } | 1341 } |
| 1331 return false; | 1342 return false; |
| 1332 } | 1343 } |
| 1333 } | 1344 } |
| 1334 | 1345 |
| 1335 /** | 1346 /** |
| 1336 * @typedef {{messageIndex: number, matchIndex: number}} | 1347 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1337 */ | 1348 */ |
| 1338 WebInspector.ConsoleView.RegexMatchRange; | 1349 WebInspector.ConsoleView.RegexMatchRange; |
| OLD | NEW |