| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th
is), true); | 138 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th
is), true); |
| 139 | 139 |
| 140 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto
ryAutocomplete'); | 140 this._consoleHistoryAutocompleteSetting = Common.moduleSetting('consoleHisto
ryAutocomplete'); |
| 141 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto
ryAutocompleteChanged, this); | 141 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto
ryAutocompleteChanged, this); |
| 142 | 142 |
| 143 var historyData = this._consoleHistorySetting.get(); | 143 var historyData = this._consoleHistorySetting.get(); |
| 144 this._prompt.history().setHistoryData(historyData); | 144 this._prompt.history().setHistoryData(historyData); |
| 145 this._consoleHistoryAutocompleteChanged(); | 145 this._consoleHistoryAutocompleteChanged(); |
| 146 | 146 |
| 147 this._updateFilterStatus(); | 147 this._updateFilterStatus(); |
| 148 Common.moduleSetting('consoleTimestampsEnabled').addChangeListener(this._con
soleTimestampsSettingChanged, this); | 148 Common.moduleSetting('consoleTimestampFormat').addChangeListener(this._conso
leTimestampsSettingChanged, this); |
| 149 | 149 |
| 150 this._registerWithMessageSink(); | 150 this._registerWithMessageSink(); |
| 151 SDK.targetManager.observeTargets(this); | 151 SDK.targetManager.observeTargets(this); |
| 152 | 152 |
| 153 this._initConsoleMessages(); | 153 this._initConsoleMessages(); |
| 154 | 154 |
| 155 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont
extChanged, this); | 155 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont
extChanged, this); |
| 156 | 156 |
| 157 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto
mOnMouseDown.bind(this), false); | 157 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto
mOnMouseDown.bind(this), false); |
| 158 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO
nMouseUp.bind(this), false); | 158 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO
nMouseUp.bind(this), false); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 var consoleMessage = new SDK.ConsoleMessage( | 316 var consoleMessage = new SDK.ConsoleMessage( |
| 317 null, SDK.ConsoleMessage.MessageSource.Other, level, message.text, undef
ined, undefined, undefined, undefined, | 317 null, SDK.ConsoleMessage.MessageSource.Other, level, message.text, undef
ined, undefined, undefined, undefined, |
| 318 undefined, undefined, undefined, message.timestamp); | 318 undefined, undefined, undefined, message.timestamp); |
| 319 this._addConsoleMessage(consoleMessage); | 319 this._addConsoleMessage(consoleMessage); |
| 320 } | 320 } |
| 321 | 321 |
| 322 /** | 322 /** |
| 323 * @param {!Common.Event} event | 323 * @param {!Common.Event} event |
| 324 */ | 324 */ |
| 325 _consoleTimestampsSettingChanged(event) { | 325 _consoleTimestampsSettingChanged(event) { |
| 326 var enabled = /** @type {boolean} */ (event.data); | 326 var enabled = /** @type {!Console.ConsoleViewMessage.TimestampFormat} */ (ev
ent.data); |
| 327 this._updateMessageList(); | 327 this._updateMessageList(); |
| 328 this._consoleMessages.forEach(function(viewMessage) { | 328 this._consoleMessages.forEach(function(viewMessage) { |
| 329 viewMessage.updateTimestamp(enabled); | 329 viewMessage.updateTimestamp(enabled); |
| 330 }); | 330 }); |
| 331 } | 331 } |
| 332 | 332 |
| 333 _executionContextChanged() { | 333 _executionContextChanged() { |
| 334 this._prompt.clearAutocomplete(); | 334 this._prompt.clearAutocomplete(); |
| 335 if (!this._showAllMessagesCheckbox.checked()) | 335 if (!this._showAllMessagesCheckbox.checked()) |
| 336 this._updateMessageList(); | 336 this._updateMessageList(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 progressIndicator.setWorked(messageIndex); | 674 progressIndicator.setWorked(messageIndex); |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| 678 /** | 678 /** |
| 679 * @param {!Console.ConsoleViewMessage} lastMessage | 679 * @param {!Console.ConsoleViewMessage} lastMessage |
| 680 * @param {?Console.ConsoleViewMessage=} viewMessage | 680 * @param {?Console.ConsoleViewMessage=} viewMessage |
| 681 * @return {boolean} | 681 * @return {boolean} |
| 682 */ | 682 */ |
| 683 _tryToCollapseMessages(lastMessage, viewMessage) { | 683 _tryToCollapseMessages(lastMessage, viewMessage) { |
| 684 if (!Common.moduleSetting('consoleTimestampsEnabled').get() && viewMessage &
& | 684 var timestampFormat = Common.moduleSetting('consoleTimestampFormat').get(); |
| 685 !lastMessage.consoleMessage().isGroupMessage() && | 685 var timestampsShown = timestampFormat !== Console.ConsoleViewMessage.Timesta
mpFormat.None; |
| 686 if (!timestampsShown && viewMessage && !lastMessage.consoleMessage().isGroup
Message() && |
| 686 lastMessage.consoleMessage().isEqual(viewMessage.consoleMessage())) { | 687 lastMessage.consoleMessage().isEqual(viewMessage.consoleMessage())) { |
| 687 viewMessage.incrementRepeatCount(); | 688 viewMessage.incrementRepeatCount(); |
| 688 return true; | 689 return true; |
| 689 } | 690 } |
| 690 | 691 |
| 691 return false; | 692 return false; |
| 692 } | 693 } |
| 693 | 694 |
| 694 _updateMessageList() { | 695 _updateMessageList() { |
| 695 this._topGroup = Console.ConsoleGroup.createTopGroup(); | 696 this._topGroup = Console.ConsoleGroup.createTopGroup(); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 this._formattedCommand = createElementWithClass('span', 'source-code'); | 1214 this._formattedCommand = createElementWithClass('span', 'source-code'); |
| 1214 this._formattedCommand.textContent = this.text.replaceControlCharacters(); | 1215 this._formattedCommand.textContent = this.text.replaceControlCharacters(); |
| 1215 this._contentElement.appendChild(this._formattedCommand); | 1216 this._contentElement.appendChild(this._formattedCommand); |
| 1216 | 1217 |
| 1217 if (this._formattedCommand.textContent.length < Console.ConsoleCommand.Max
LengthToIgnoreHighlighter) { | 1218 if (this._formattedCommand.textContent.length < Console.ConsoleCommand.Max
LengthToIgnoreHighlighter) { |
| 1218 var javascriptSyntaxHighlighter = new UI.DOMSyntaxHighlighter('text/java
script', true); | 1219 var javascriptSyntaxHighlighter = new UI.DOMSyntaxHighlighter('text/java
script', true); |
| 1219 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand).
then(this._updateSearch.bind(this)); | 1220 javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand).
then(this._updateSearch.bind(this)); |
| 1220 } else { | 1221 } else { |
| 1221 this._updateSearch(); | 1222 this._updateSearch(); |
| 1222 } | 1223 } |
| 1224 |
| 1225 this.updateTimestamp(Common.moduleSetting('consoleTimestampFormat').get())
; |
| 1223 } | 1226 } |
| 1224 return this._contentElement; | 1227 return this._contentElement; |
| 1225 } | 1228 } |
| 1226 | 1229 |
| 1227 _updateSearch() { | 1230 _updateSearch() { |
| 1228 this.setSearchRegex(this.searchRegex()); | 1231 this.setSearchRegex(this.searchRegex()); |
| 1229 } | 1232 } |
| 1230 }; | 1233 }; |
| 1231 | 1234 |
| 1232 /** | 1235 /** |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1253 * @override | 1256 * @override |
| 1254 * @return {!Element} | 1257 * @return {!Element} |
| 1255 */ | 1258 */ |
| 1256 contentElement() { | 1259 contentElement() { |
| 1257 var element = super.contentElement(); | 1260 var element = super.contentElement(); |
| 1258 element.classList.add('console-user-command-result'); | 1261 element.classList.add('console-user-command-result'); |
| 1259 if (this.consoleMessage().level === SDK.ConsoleMessage.MessageLevel.Log) { | 1262 if (this.consoleMessage().level === SDK.ConsoleMessage.MessageLevel.Log) { |
| 1260 var icon = UI.Icon.create('smallicon-command-result', 'command-result-icon
'); | 1263 var icon = UI.Icon.create('smallicon-command-result', 'command-result-icon
'); |
| 1261 element.insertBefore(icon, element.firstChild); | 1264 element.insertBefore(icon, element.firstChild); |
| 1262 } | 1265 } |
| 1263 this.updateTimestamp(false); | |
| 1264 return element; | 1266 return element; |
| 1265 } | 1267 } |
| 1266 }; | 1268 }; |
| 1267 | 1269 |
| 1268 /** | 1270 /** |
| 1269 * @unrestricted | 1271 * @unrestricted |
| 1270 */ | 1272 */ |
| 1271 Console.ConsoleGroup = class { | 1273 Console.ConsoleGroup = class { |
| 1272 /** | 1274 /** |
| 1273 * @param {?Console.ConsoleGroup} parentGroup | 1275 * @param {?Console.ConsoleGroup} parentGroup |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 return true; | 1336 return true; |
| 1335 } | 1337 } |
| 1336 return false; | 1338 return false; |
| 1337 } | 1339 } |
| 1338 }; | 1340 }; |
| 1339 | 1341 |
| 1340 /** | 1342 /** |
| 1341 * @typedef {{messageIndex: number, matchIndex: number}} | 1343 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1342 */ | 1344 */ |
| 1343 Console.ConsoleView.RegexMatchRange; | 1345 Console.ConsoleView.RegexMatchRange; |
| OLD | NEW |