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

Unified 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: SourcesTE listen to same event 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
index 6c7014df126c7c0ae4d4b72e0b9e30017ba82389..a7e9a4c0ba028df330e08e9f9b9c445485b252fc 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -129,7 +129,6 @@ Console.ConsoleView = class extends UI.VBox {
var promptIcon = UI.Icon.create('smallicon-text-prompt', 'console-prompt-icon');
this._promptElement.appendChild(promptIcon);
this._promptElement.id = 'console-prompt';
- this._promptElement.addEventListener('input', this._promptInput.bind(this), false);
// FIXME: This is a workaround for the selection machinery bug. See crbug.com/410899
var selectAllFixer = this._messagesElement.createChild('div', 'console-view-fix-select-all');
@@ -151,6 +150,7 @@ Console.ConsoleView = class extends UI.VBox {
this._prompt = new Console.ConsolePrompt();
this._prompt.show(this._promptElement);
this._prompt.element.addEventListener('keydown', this._promptKeyDown.bind(this), true);
+ this._prompt.on(Console.ConsolePrompt.ContentChangedEvent, this._promptContentChanged.bind(this), this);
this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHistoryAutocompleteChanged, this);
@@ -1026,10 +1026,16 @@ Console.ConsoleView = class extends UI.VBox {
this._updateStickToBottomOnMouseUp();
}
- _promptInput(event) {
+ _promptContentChanged() {
// Scroll to the bottom, except when the prompt is the only visible item.
if (this.itemCount() !== 0 && this._viewport.firstVisibleIndex() !== this.itemCount())
this._immediatelyScrollToBottom();
+
+ this._promptContentChangedForTest();
+ }
+
+ _promptContentChangedForTest() {
+ // This method is sniffed in tests.
}
};

Powered by Google App Engine
This is Rietveld 408576698