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

Side by Side 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, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-focus-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 * @override 300 * @override
301 */ 301 */
302 wasShown() { 302 wasShown() {
303 this._viewport.refresh(); 303 this._viewport.refresh();
304 } 304 }
305 305
306 /** 306 /**
307 * @override 307 * @override
308 */ 308 */
309 focus() { 309 focus() {
310 if (this._prompt.hasFocus()) 310 if (!this._prompt.hasFocus())
311 return; 311 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.
312 // Set caret position before setting focus in order to avoid scrolling
313 // by focus().
314 this._prompt.moveCaretToEndOfPrompt();
315 this._prompt.focus();
316 } 312 }
317 313
318 /** 314 /**
319 * @override 315 * @override
320 */ 316 */
321 restoreScrollPositions() { 317 restoreScrollPositions() {
322 if (this._viewport.stickToBottom()) 318 if (this._viewport.stickToBottom())
323 this._immediatelyScrollToBottom(); 319 this._immediatelyScrollToBottom();
324 else 320 else
325 super.restoreScrollPositions(); 321 super.restoreScrollPositions();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 this._updateFilterStatus(); 655 this._updateFilterStatus();
660 this._searchableView.updateSearchMatchesCount(this._regexMatchRanges.length) ; 656 this._searchableView.updateSearchMatchesCount(this._regexMatchRanges.length) ;
661 this._viewport.invalidate(); 657 this._viewport.invalidate();
662 } 658 }
663 659
664 /** 660 /**
665 * @param {!Event} event 661 * @param {!Event} event
666 */ 662 */
667 _messagesClicked(event) { 663 _messagesClicked(event) {
668 var targetElement = event.deepElementFromPoint(); 664 var targetElement = event.deepElementFromPoint();
669 if (!targetElement || targetElement.isComponentSelectionCollapsed()) 665 if (!targetElement || targetElement.isComponentSelectionCollapsed()) {
670 this.focus(); 666 this.focus();
667
668 // Restore scroll position, since moving caret may trigger scroll.
669 var top = this._messagesElement.scrollTop;
670 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.
671 this._messagesElement.scrollTop = top;
672 }
671 var groupMessage = event.target.enclosingNodeOrSelfWithClass('console-group- title'); 673 var groupMessage = event.target.enclosingNodeOrSelfWithClass('console-group- title');
672 if (!groupMessage) 674 if (!groupMessage)
673 return; 675 return;
674 var consoleGroupViewMessage = groupMessage.parentElement.message; 676 var consoleGroupViewMessage = groupMessage.parentElement.message;
675 consoleGroupViewMessage.setCollapsed(!consoleGroupViewMessage.collapsed()); 677 consoleGroupViewMessage.setCollapsed(!consoleGroupViewMessage.collapsed());
676 this._updateMessageList(); 678 this._updateMessageList();
677 } 679 }
678 680
679 _registerShortcuts() { 681 _registerShortcuts() {
680 this._shortcuts = {}; 682 this._shortcuts = {};
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 return true; 1274 return true;
1273 } 1275 }
1274 return false; 1276 return false;
1275 } 1277 }
1276 }; 1278 };
1277 1279
1278 /** 1280 /**
1279 * @typedef {{messageIndex: number, matchIndex: number}} 1281 * @typedef {{messageIndex: number, matchIndex: number}}
1280 */ 1282 */
1281 Console.ConsoleView.RegexMatchRange; 1283 Console.ConsoleView.RegexMatchRange;
OLDNEW
« 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