Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 2565113002: DevTools: update console viewport scroll when prompt is resized (Closed)
Patch Set: yay Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.TextChangedEvent, this._promptTextChan ged.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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1013
1014 _updateViewportStickinessForTest() { 1014 _updateViewportStickinessForTest() {
1015 // This method is sniffed in tests. 1015 // This method is sniffed in tests.
1016 } 1016 }
1017 1017
1018 _updateStickToBottomOnWheel() { 1018 _updateStickToBottomOnWheel() {
1019 this._updateStickToBottomOnMouseDown(); 1019 this._updateStickToBottomOnMouseDown();
1020 this._updateStickToBottomOnMouseUp(); 1020 this._updateStickToBottomOnMouseUp();
1021 } 1021 }
1022 1022
1023 _promptInput(event) { 1023 _promptTextChanged() {
1024 // Scroll to the bottom, except when the prompt is the only visible item. 1024 // Scroll to the bottom, except when the prompt is the only visible item.
1025 if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.it emCount()) 1025 if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.it emCount())
1026 this._immediatelyScrollToBottom(); 1026 this._immediatelyScrollToBottom();
1027
1028 this._promptTextChangedForTest();
1029 }
1030
1031 _promptTextChangedForTest() {
1032 // This method is sniffed in tests.
1027 } 1033 }
1028 }; 1034 };
1029 1035
1030 Console.ConsoleView.persistedHistorySize = 300; 1036 Console.ConsoleView.persistedHistorySize = 300;
1031 1037
1032 /** 1038 /**
1033 * @unrestricted 1039 * @unrestricted
1034 */ 1040 */
1035 Console.ConsoleViewFilter = class { 1041 Console.ConsoleViewFilter = class {
1036 /** 1042 /**
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 return true; 1321 return true;
1316 } 1322 }
1317 return false; 1323 return false;
1318 } 1324 }
1319 }; 1325 };
1320 1326
1321 /** 1327 /**
1322 * @typedef {{messageIndex: number, matchIndex: number}} 1328 * @typedef {{messageIndex: number, matchIndex: number}}
1323 */ 1329 */
1324 Console.ConsoleView.RegexMatchRange; 1330 Console.ConsoleView.RegexMatchRange;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698