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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 function writeNextChunk(stream, error) | 650 function writeNextChunk(stream, error) |
| 651 { | 651 { |
| 652 if (messageIndex >= this.itemCount() || error) { | 652 if (messageIndex >= this.itemCount() || error) { |
| 653 stream.close(); | 653 stream.close(); |
| 654 progressIndicator.done(); | 654 progressIndicator.done(); |
| 655 return; | 655 return; |
| 656 } | 656 } |
| 657 var lines = []; | 657 var lines = []; |
| 658 for (var i = 0; i < chunkSize && i + messageIndex < this.itemCount() ; ++i) { | 658 for (var i = 0; i < chunkSize && i + messageIndex < this.itemCount() ; ++i) { |
| 659 var message = this.itemElement(messageIndex + i); | 659 var message = this.itemElement(messageIndex + i); |
| 660 lines.push(message.searchableElement().deepTextContent()); | 660 lines.push(message.formattedMessage().deepTextContent()); |
|
lushnikov
2016/09/06 19:30:29
why do we still use formatMessage?
luoe
2016/09/06 21:50:29
My bad, I didn't remove formattedMessage() uses in
| |
| 661 } | 661 } |
| 662 messageIndex += i; | 662 messageIndex += i; |
| 663 stream.write(lines.join("\n") + "\n", writeNextChunk.bind(this)); | 663 stream.write(lines.join("\n") + "\n", writeNextChunk.bind(this)); |
| 664 progressIndicator.setWorked(messageIndex); | 664 progressIndicator.setWorked(messageIndex); |
| 665 } | 665 } |
| 666 | 666 |
| 667 }, | 667 }, |
| 668 | 668 |
| 669 /** | 669 /** |
| 670 * @param {!WebInspector.ConsoleViewMessage} lastMessage | 670 * @param {!WebInspector.ConsoleViewMessage} lastMessage |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1228 * @param {number} nestingLevel | 1228 * @param {number} nestingLevel |
| 1229 */ | 1229 */ |
| 1230 WebInspector.ConsoleCommand = function(message, linkifier, nestingLevel) | 1230 WebInspector.ConsoleCommand = function(message, linkifier, nestingLevel) |
| 1231 { | 1231 { |
| 1232 WebInspector.ConsoleViewMessage.call(this, message, linkifier, nestingLevel) ; | 1232 WebInspector.ConsoleViewMessage.call(this, message, linkifier, nestingLevel) ; |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 WebInspector.ConsoleCommand.prototype = { | 1235 WebInspector.ConsoleCommand.prototype = { |
| 1236 /** | 1236 /** |
| 1237 * @override | 1237 * @override |
| 1238 * @return {!Element}) | 1238 * @return {!Element} |
| 1239 */ | 1239 */ |
| 1240 searchableElement: function() | 1240 formattedMessage: function() |
| 1241 { | 1241 { |
| 1242 return this.contentElement(); | 1242 if (this._formattedMessage) |
| 1243 return this._formattedMessage; | |
| 1244 this._formattedMessage = createElementWithClass("span", "console-message -text source-code"); | |
| 1245 this._formattedMessage.textContent = this.text.replaceControlCharacters( ); | |
| 1246 return this._formattedMessage; | |
| 1243 }, | 1247 }, |
| 1244 | 1248 |
| 1245 /** | 1249 /** |
| 1246 * @override | 1250 * @override |
| 1247 * @return {!Element} | 1251 * @return {!Element} |
| 1248 */ | 1252 */ |
| 1249 contentElement: function() | 1253 contentElement: function() |
| 1250 { | 1254 { |
| 1251 if (!this._element) { | 1255 if (!this._element) { |
| 1252 this._element = createElementWithClass("div", "console-user-command" ); | 1256 this._element = createElementWithClass("div", "console-user-command" ); |
| 1253 this._element.message = this; | 1257 this._element.message = this; |
| 1258 this._element.appendChild(this.formattedMessage()); | |
| 1254 | 1259 |
| 1255 this._formattedCommand = createElementWithClass("span", "console-mes sage-text source-code"); | 1260 if (this._formattedMessage.textContent.length < WebInspector.Console Command.MaxLengthToIgnoreHighlighter) { |
| 1256 this._formattedCommand.textContent = this.text.replaceControlCharact ers(); | |
| 1257 this._element.appendChild(this._formattedCommand); | |
| 1258 | |
| 1259 if (this._formattedCommand.textContent.length < WebInspector.Console Command.MaxLengthToIgnoreHighlighter) { | |
| 1260 var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHigh lighter("text/javascript", true); | 1261 var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHigh lighter("text/javascript", true); |
| 1261 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedC ommand).then(this._updateSearch.bind(this)) | 1262 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedM essage).then(this._updateSearch.bind(this)) |
| 1262 } else { | 1263 } else { |
| 1263 this._updateSearch(); | 1264 this._updateSearch(); |
| 1264 } | 1265 } |
| 1265 } | 1266 } |
| 1266 return this._element; | 1267 return this._element; |
| 1267 }, | 1268 }, |
| 1268 | 1269 |
| 1269 _updateSearch: function() | 1270 _updateSearch: function() |
| 1270 { | 1271 { |
| 1271 this.setSearchRegex(this.searchRegex()); | 1272 this.setSearchRegex(this.searchRegex()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1412 return true; | 1413 return true; |
| 1413 } | 1414 } |
| 1414 return false; | 1415 return false; |
| 1415 } | 1416 } |
| 1416 } | 1417 } |
| 1417 | 1418 |
| 1418 /** | 1419 /** |
| 1419 * @typedef {{messageIndex: number, matchIndex: number}} | 1420 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1420 */ | 1421 */ |
| 1421 WebInspector.ConsoleView.RegexMatchRange; | 1422 WebInspector.ConsoleView.RegexMatchRange; |
| OLD | NEW |