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

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

Issue 2840663002: DevTools: clicking in console messages should not jump to bottom (Closed)
Patch Set: move caret only on click, not focus Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-focus-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 be61b1a8bbe8206cb165e078dad479ca8235a504..8160c78ee8d452f06b8a93ac164008ee9d422e77 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -307,12 +307,8 @@ Console.ConsoleView = class extends UI.VBox {
* @override
*/
focus() {
- if (this._prompt.hasFocus())
- return;
- // Set caret position before setting focus in order to avoid scrolling
- // by focus().
- this._prompt.moveCaretToEndOfPrompt();
- this._prompt.focus();
+ if (!this._prompt.hasFocus())
+ this._prompt.focus();
pfeldman 2017/04/25 18:50:17 I think we still reset scroll position here, not?
luoe 2017/04/25 23:00:34 No, only the moveCaretToEndOfPrompt did.
}
/**
@@ -666,8 +662,14 @@ Console.ConsoleView = class extends UI.VBox {
*/
_messagesClicked(event) {
var targetElement = event.deepElementFromPoint();
- if (!targetElement || targetElement.isComponentSelectionCollapsed())
+ if (!targetElement || targetElement.isComponentSelectionCollapsed()) {
this.focus();
+
+ // Restore scroll position, since moving caret may trigger scroll.
+ var top = this._messagesElement.scrollTop;
+ this._prompt.moveCaretToEndOfPrompt();
pfeldman 2017/04/25 18:50:17 Why moving caret to end of prompt is necessary?
luoe 2017/04/25 23:00:34 Please see above.
+ this._messagesElement.scrollTop = top;
+ }
var groupMessage = event.target.enclosingNodeOrSelfWithClass('console-group-title');
if (!groupMessage)
return;
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-focus-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698