| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 this._viewportThrottler = new Common.Throttler(50); | 123 this._viewportThrottler = new Common.Throttler(50); |
| 124 | 124 |
| 125 this._topGroup = Console.ConsoleGroup.createTopGroup(); | 125 this._topGroup = Console.ConsoleGroup.createTopGroup(); |
| 126 this._currentGroup = this._topGroup; | 126 this._currentGroup = this._topGroup; |
| 127 | 127 |
| 128 this._promptElement = this._messagesElement.createChild('div', 'source-code'
); | 128 this._promptElement = this._messagesElement.createChild('div', 'source-code'
); |
| 129 var promptIcon = UI.Icon.create('smallicon-text-prompt', 'console-prompt-ico
n'); | 129 var promptIcon = UI.Icon.create('smallicon-text-prompt', 'console-prompt-ico
n'); |
| 130 this._promptElement.appendChild(promptIcon); | 130 this._promptElement.appendChild(promptIcon); |
| 131 this._promptElement.id = 'console-prompt'; | 131 this._promptElement.id = 'console-prompt'; |
| 132 this._promptElement.addEventListener('input', this._promptInput.bind(this),
false); | |
| 133 | 132 |
| 134 // FIXME: This is a workaround for the selection machinery bug. See crbug.co
m/410899 | 133 // FIXME: This is a workaround for the selection machinery bug. See crbug.co
m/410899 |
| 135 var selectAllFixer = this._messagesElement.createChild('div', 'console-view-
fix-select-all'); | 134 var selectAllFixer = this._messagesElement.createChild('div', 'console-view-
fix-select-all'); |
| 136 selectAllFixer.textContent = '.'; | 135 selectAllFixer.textContent = '.'; |
| 137 | 136 |
| 138 this._registerShortcuts(); | 137 this._registerShortcuts(); |
| 139 | 138 |
| 140 this._messagesElement.addEventListener('contextmenu', this._handleContextMen
uEvent.bind(this), false); | 139 this._messagesElement.addEventListener('contextmenu', this._handleContextMen
uEvent.bind(this), false); |
| 141 monitoringXHREnabledSetting.addChangeListener(this._monitoringXHREnabledSett
ingChanged, this); | 140 monitoringXHREnabledSetting.addChangeListener(this._monitoringXHREnabledSett
ingChanged, this); |
| 142 | 141 |
| 143 this._linkifier = new Components.Linkifier(); | 142 this._linkifier = new Components.Linkifier(); |
| 144 | 143 |
| 145 /** @type {!Array.<!Console.ConsoleViewMessage>} */ | 144 /** @type {!Array.<!Console.ConsoleViewMessage>} */ |
| 146 this._consoleMessages = []; | 145 this._consoleMessages = []; |
| 147 this._viewMessageSymbol = Symbol('viewMessage'); | 146 this._viewMessageSymbol = Symbol('viewMessage'); |
| 148 | 147 |
| 149 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis
tory', []); | 148 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis
tory', []); |
| 150 | 149 |
| 151 this._prompt = new Console.ConsolePrompt(); | 150 this._prompt = new Console.ConsolePrompt(); |
| 152 this._prompt.show(this._promptElement); | 151 this._prompt.show(this._promptElement); |
| 153 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th
is), true); | 152 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th
is), true); |
| 153 this._prompt.on(Console.ConsolePrompt.ContentChangedEvent, this._promptConte
ntChanged.bind(this), this); |
| 154 | 154 |
| 155 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto
ryAutocompleteChanged, this); | 155 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto
ryAutocompleteChanged, this); |
| 156 | 156 |
| 157 var historyData = this._consoleHistorySetting.get(); | 157 var historyData = this._consoleHistorySetting.get(); |
| 158 this._prompt.history().setHistoryData(historyData); | 158 this._prompt.history().setHistoryData(historyData); |
| 159 this._consoleHistoryAutocompleteChanged(); | 159 this._consoleHistoryAutocompleteChanged(); |
| 160 | 160 |
| 161 this._updateFilterStatus(); | 161 this._updateFilterStatus(); |
| 162 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan
ged, this); | 162 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan
ged, this); |
| 163 | 163 |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 | 1019 |
| 1020 _updateViewportStickinessForTest() { | 1020 _updateViewportStickinessForTest() { |
| 1021 // This method is sniffed in tests. | 1021 // This method is sniffed in tests. |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 _updateStickToBottomOnWheel() { | 1024 _updateStickToBottomOnWheel() { |
| 1025 this._updateStickToBottomOnMouseDown(); | 1025 this._updateStickToBottomOnMouseDown(); |
| 1026 this._updateStickToBottomOnMouseUp(); | 1026 this._updateStickToBottomOnMouseUp(); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 _promptInput(event) { | 1029 _promptContentChanged() { |
| 1030 // Scroll to the bottom, except when the prompt is the only visible item. | 1030 // Scroll to the bottom, except when the prompt is the only visible item. |
| 1031 if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.it
emCount()) | 1031 if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.it
emCount()) |
| 1032 this._immediatelyScrollToBottom(); | 1032 this._immediatelyScrollToBottom(); |
| 1033 |
| 1034 this._promptContentChangedForTest(); |
| 1035 } |
| 1036 |
| 1037 _promptContentChangedForTest() { |
| 1038 // This method is sniffed in tests. |
| 1033 } | 1039 } |
| 1034 }; | 1040 }; |
| 1035 | 1041 |
| 1036 Console.ConsoleView.persistedHistorySize = 300; | 1042 Console.ConsoleView.persistedHistorySize = 300; |
| 1037 | 1043 |
| 1038 /** | 1044 /** |
| 1039 * @unrestricted | 1045 * @unrestricted |
| 1040 */ | 1046 */ |
| 1041 Console.ConsoleViewFilter = class { | 1047 Console.ConsoleViewFilter = class { |
| 1042 /** | 1048 /** |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 return true; | 1327 return true; |
| 1322 } | 1328 } |
| 1323 return false; | 1329 return false; |
| 1324 } | 1330 } |
| 1325 }; | 1331 }; |
| 1326 | 1332 |
| 1327 /** | 1333 /** |
| 1328 * @typedef {{messageIndex: number, matchIndex: number}} | 1334 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1329 */ | 1335 */ |
| 1330 Console.ConsoleView.RegexMatchRange; | 1336 Console.ConsoleView.RegexMatchRange; |
| OLD | NEW |