Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 if (!this._showSettingsPaneSetting.get()) | 108 if (!this._showSettingsPaneSetting.get()) |
| 109 settingsPane.element.classList.add('hidden'); | 109 settingsPane.element.classList.add('hidden'); |
| 110 this._showSettingsPaneSetting.addChangeListener( | 110 this._showSettingsPaneSetting.addChangeListener( |
| 111 () => settingsPane.element.classList.toggle('hidden', !this._showSetting sPaneSetting.get())); | 111 () => settingsPane.element.classList.toggle('hidden', !this._showSetting sPaneSetting.get())); |
| 112 | 112 |
| 113 this._viewport = new Console.ConsoleViewport(this); | 113 this._viewport = new Console.ConsoleViewport(this); |
| 114 this._viewport.setStickToBottom(true); | 114 this._viewport.setStickToBottom(true); |
| 115 this._viewport.contentElement().classList.add('console-group', 'console-grou p-messages'); | 115 this._viewport.contentElement().classList.add('console-group', 'console-grou p-messages'); |
| 116 this._contentsElement.appendChild(this._viewport.element); | 116 this._contentsElement.appendChild(this._viewport.element); |
| 117 this._messagesElement = this._viewport.element; | 117 this._messagesElement = this._viewport.element; |
| 118 this._messagesElement.tabIndex = -1; | |
|
luoe
2017/04/24 22:28:33
Currently on ToT, using up/down/pageup/pagedown ke
| |
| 118 this._messagesElement.id = 'console-messages'; | 119 this._messagesElement.id = 'console-messages'; |
| 119 this._messagesElement.classList.add('monospace'); | 120 this._messagesElement.classList.add('monospace'); |
| 120 this._messagesElement.addEventListener('click', this._messagesClicked.bind(t his), true); | 121 this._messagesElement.addEventListener('click', this._messagesClicked.bind(t his), true); |
| 121 | 122 |
| 122 this._viewportThrottler = new Common.Throttler(50); | 123 this._viewportThrottler = new Common.Throttler(50); |
| 123 | 124 |
| 124 this._topGroup = Console.ConsoleGroup.createTopGroup(); | 125 this._topGroup = Console.ConsoleGroup.createTopGroup(); |
| 125 this._currentGroup = this._topGroup; | 126 this._currentGroup = this._topGroup; |
| 126 | 127 |
| 127 this._promptElement = this._messagesElement.createChild('div', 'source-code' ); | 128 this._promptElement = this._messagesElement.createChild('div', 'source-code' ); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 wasShown() { | 303 wasShown() { |
| 303 this._viewport.refresh(); | 304 this._viewport.refresh(); |
| 304 } | 305 } |
| 305 | 306 |
| 306 /** | 307 /** |
| 307 * @override | 308 * @override |
| 308 */ | 309 */ |
| 309 focus() { | 310 focus() { |
| 310 if (this._prompt.hasFocus()) | 311 if (this._prompt.hasFocus()) |
| 311 return; | 312 return; |
| 312 // Set caret position before setting focus in order to avoid scrolling | |
| 313 // by focus(). | |
|
luoe
2017/04/24 22:28:33
This is no longer the case. Calling moveCaretToEn
| |
| 314 this._prompt.moveCaretToEndOfPrompt(); | 313 this._prompt.moveCaretToEndOfPrompt(); |
| 315 this._prompt.focus(); | 314 this._prompt.focus(); |
| 316 } | 315 } |
| 317 | 316 |
| 318 /** | 317 /** |
| 319 * @override | 318 * @override |
| 320 */ | 319 */ |
| 321 restoreScrollPositions() { | 320 restoreScrollPositions() { |
| 322 if (this._viewport.stickToBottom()) | 321 if (this._viewport.stickToBottom()) |
| 323 this._immediatelyScrollToBottom(); | 322 this._immediatelyScrollToBottom(); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 this._updateFilterStatus(); | 658 this._updateFilterStatus(); |
| 660 this._searchableView.updateSearchMatchesCount(this._regexMatchRanges.length) ; | 659 this._searchableView.updateSearchMatchesCount(this._regexMatchRanges.length) ; |
| 661 this._viewport.invalidate(); | 660 this._viewport.invalidate(); |
| 662 } | 661 } |
| 663 | 662 |
| 664 /** | 663 /** |
| 665 * @param {!Event} event | 664 * @param {!Event} event |
| 666 */ | 665 */ |
| 667 _messagesClicked(event) { | 666 _messagesClicked(event) { |
| 668 var targetElement = event.deepElementFromPoint(); | 667 var targetElement = event.deepElementFromPoint(); |
| 669 if (!targetElement || targetElement.isComponentSelectionCollapsed()) | 668 if (!targetElement || this._viewport.element.isScrolledToBottom()) |
| 670 this.focus(); | 669 this.focus(); |
|
luoe
2017/04/24 22:28:33
I think we still need to keep 2 paths. When you c
| |
| 670 else if (targetElement.isComponentSelectionCollapsed()) | |
| 671 this._prompt.focus(); | |
| 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 Loading... | |
| 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; |
| OLD | NEW |