| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 this._viewportThrottler = new Common.Throttler(50); | 122 this._viewportThrottler = new Common.Throttler(50); |
| 123 | 123 |
| 124 this._topGroup = Console.ConsoleGroup.createTopGroup(); | 124 this._topGroup = Console.ConsoleGroup.createTopGroup(); |
| 125 this._currentGroup = this._topGroup; | 125 this._currentGroup = this._topGroup; |
| 126 | 126 |
| 127 this._promptElement = this._messagesElement.createChild('div', 'source-code'
); | 127 this._promptElement = this._messagesElement.createChild('div', 'source-code'
); |
| 128 var promptIcon = UI.Icon.create('smallicon-text-prompt', 'console-prompt-ico
n'); | 128 var promptIcon = UI.Icon.create('smallicon-text-prompt', 'console-prompt-ico
n'); |
| 129 this._promptElement.appendChild(promptIcon); | 129 this._promptElement.appendChild(promptIcon); |
| 130 this._promptElement.id = 'console-prompt'; | 130 this._promptElement.id = 'console-prompt'; |
| 131 this._promptElement.addEventListener('input', this._promptInput.bind(this),
false); | |
| 132 | 131 |
| 133 // FIXME: This is a workaround for the selection machinery bug. See crbug.co
m/410899 | 132 // FIXME: This is a workaround for the selection machinery bug. See crbug.co
m/410899 |
| 134 var selectAllFixer = this._messagesElement.createChild('div', 'console-view-
fix-select-all'); | 133 var selectAllFixer = this._messagesElement.createChild('div', 'console-view-
fix-select-all'); |
| 135 selectAllFixer.textContent = '.'; | 134 selectAllFixer.textContent = '.'; |
| 136 | 135 |
| 137 this._registerShortcuts(); | 136 this._registerShortcuts(); |
| 138 | 137 |
| 139 this._messagesElement.addEventListener('contextmenu', this._handleContextMen
uEvent.bind(this), false); | 138 this._messagesElement.addEventListener('contextmenu', this._handleContextMen
uEvent.bind(this), false); |
| 140 monitoringXHREnabledSetting.addChangeListener(this._monitoringXHREnabledSett
ingChanged, this); | 139 monitoringXHREnabledSetting.addChangeListener(this._monitoringXHREnabledSett
ingChanged, this); |
| 141 | 140 |
| 142 this._linkifier = new Components.Linkifier(); | 141 this._linkifier = new Components.Linkifier(); |
| 143 | 142 |
| 144 /** @type {!Array.<!Console.ConsoleViewMessage>} */ | 143 /** @type {!Array.<!Console.ConsoleViewMessage>} */ |
| 145 this._consoleMessages = []; | 144 this._consoleMessages = []; |
| 146 this._viewMessageSymbol = Symbol('viewMessage'); | 145 this._viewMessageSymbol = Symbol('viewMessage'); |
| 147 | 146 |
| 148 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis
tory', []); | 147 this._consoleHistorySetting = Common.settings.createLocalSetting('consoleHis
tory', []); |
| 149 | 148 |
| 150 this._prompt = new Console.ConsolePrompt(); | 149 this._prompt = new Console.ConsolePrompt(); |
| 151 this._prompt.show(this._promptElement); | 150 this._prompt.show(this._promptElement); |
| 152 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th
is), true); | 151 this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(th
is), true); |
| 152 this._prompt.addEventListener(Console.ConsolePrompt.Events.TextChanged, this
._promptTextChanged, this); |
| 153 | 153 |
| 154 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto
ryAutocompleteChanged, this); | 154 this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHisto
ryAutocompleteChanged, this); |
| 155 | 155 |
| 156 var historyData = this._consoleHistorySetting.get(); | 156 var historyData = this._consoleHistorySetting.get(); |
| 157 this._prompt.history().setHistoryData(historyData); | 157 this._prompt.history().setHistoryData(historyData); |
| 158 this._consoleHistoryAutocompleteChanged(); | 158 this._consoleHistoryAutocompleteChanged(); |
| 159 | 159 |
| 160 this._updateFilterStatus(); | 160 this._updateFilterStatus(); |
| 161 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan
ged, this); | 161 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan
ged, this); |
| 162 | 162 |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 977 |
| 978 _updateViewportStickinessForTest() { | 978 _updateViewportStickinessForTest() { |
| 979 // This method is sniffed in tests. | 979 // This method is sniffed in tests. |
| 980 } | 980 } |
| 981 | 981 |
| 982 _updateStickToBottomOnWheel() { | 982 _updateStickToBottomOnWheel() { |
| 983 this._updateStickToBottomOnMouseDown(); | 983 this._updateStickToBottomOnMouseDown(); |
| 984 this._updateStickToBottomOnMouseUp(); | 984 this._updateStickToBottomOnMouseUp(); |
| 985 } | 985 } |
| 986 | 986 |
| 987 _promptInput(event) { | 987 _promptTextChanged() { |
| 988 // Scroll to the bottom, except when the prompt is the only visible item. | 988 // Scroll to the bottom, except when the prompt is the only visible item. |
| 989 if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.it
emCount()) | 989 if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.it
emCount()) |
| 990 this._immediatelyScrollToBottom(); | 990 this._immediatelyScrollToBottom(); |
| 991 |
| 992 this._promptTextChangedForTest(); |
| 993 } |
| 994 |
| 995 _promptTextChangedForTest() { |
| 996 // This method is sniffed in tests. |
| 991 } | 997 } |
| 992 }; | 998 }; |
| 993 | 999 |
| 994 Console.ConsoleView.persistedHistorySize = 300; | 1000 Console.ConsoleView.persistedHistorySize = 300; |
| 995 | 1001 |
| 996 /** | 1002 /** |
| 997 * @unrestricted | 1003 * @unrestricted |
| 998 */ | 1004 */ |
| 999 Console.ConsoleViewFilter = class { | 1005 Console.ConsoleViewFilter = class { |
| 1000 /** | 1006 /** |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 return true; | 1285 return true; |
| 1280 } | 1286 } |
| 1281 return false; | 1287 return false; |
| 1282 } | 1288 } |
| 1283 }; | 1289 }; |
| 1284 | 1290 |
| 1285 /** | 1291 /** |
| 1286 * @typedef {{messageIndex: number, matchIndex: number}} | 1292 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1287 */ | 1293 */ |
| 1288 Console.ConsoleView.RegexMatchRange; | 1294 Console.ConsoleView.RegexMatchRange; |
| OLD | NEW |