| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 * @override | 303 * @override |
| 304 */ | 304 */ |
| 305 wasShown() { | 305 wasShown() { |
| 306 this._viewport.refresh(); | 306 this._viewport.refresh(); |
| 307 } | 307 } |
| 308 | 308 |
| 309 /** | 309 /** |
| 310 * @override | 310 * @override |
| 311 */ | 311 */ |
| 312 focus() { | 312 focus() { |
| 313 if (this._prompt.hasFocus()) | 313 if (!this._prompt.hasFocus()) |
| 314 return; | 314 this._prompt.focus(); |
| 315 // Set caret position before setting focus in order to avoid scrolling | |
| 316 // by focus(). | |
| 317 this._prompt.moveCaretToEndOfPrompt(); | |
| 318 this._prompt.focus(); | |
| 319 } | 315 } |
| 320 | 316 |
| 321 /** | 317 /** |
| 322 * @override | 318 * @override |
| 323 */ | 319 */ |
| 324 restoreScrollPositions() { | 320 restoreScrollPositions() { |
| 325 if (this._viewport.stickToBottom()) | 321 if (this._viewport.stickToBottom()) |
| 326 this._immediatelyScrollToBottom(); | 322 this._immediatelyScrollToBottom(); |
| 327 else | 323 else |
| 328 super.restoreScrollPositions(); | 324 super.restoreScrollPositions(); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 SDK.targetManager.targets().forEach(function(target) { | 668 SDK.targetManager.targets().forEach(function(target) { |
| 673 target.networkAgent().setMonitoringXHREnabled(enabled); | 669 target.networkAgent().setMonitoringXHREnabled(enabled); |
| 674 }); | 670 }); |
| 675 } | 671 } |
| 676 | 672 |
| 677 /** | 673 /** |
| 678 * @param {!Event} event | 674 * @param {!Event} event |
| 679 */ | 675 */ |
| 680 _messagesClicked(event) { | 676 _messagesClicked(event) { |
| 681 var targetElement = event.deepElementFromPoint(); | 677 var targetElement = event.deepElementFromPoint(); |
| 682 if (!targetElement || targetElement.isComponentSelectionCollapsed()) | 678 |
| 679 // Do not focus prompt if messages have selection. |
| 680 if (!targetElement || targetElement.isComponentSelectionCollapsed()) { |
| 681 var clickedOutsideMessageList = event.target === this._messagesElement; |
| 682 if (clickedOutsideMessageList) |
| 683 this._prompt.moveCaretToEndOfPrompt(); |
| 683 this.focus(); | 684 this.focus(); |
| 685 } |
| 684 var groupMessage = event.target.enclosingNodeOrSelfWithClass('console-group-
title'); | 686 var groupMessage = event.target.enclosingNodeOrSelfWithClass('console-group-
title'); |
| 685 if (!groupMessage) | 687 if (!groupMessage) |
| 686 return; | 688 return; |
| 687 var consoleGroupViewMessage = groupMessage.parentElement.message; | 689 var consoleGroupViewMessage = groupMessage.parentElement.message; |
| 688 consoleGroupViewMessage.setCollapsed(!consoleGroupViewMessage.collapsed()); | 690 consoleGroupViewMessage.setCollapsed(!consoleGroupViewMessage.collapsed()); |
| 689 this._updateMessageList(); | 691 this._updateMessageList(); |
| 690 } | 692 } |
| 691 | 693 |
| 692 _registerShortcuts() { | 694 _registerShortcuts() { |
| 693 this._shortcuts = {}; | 695 this._shortcuts = {}; |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 return true; | 1287 return true; |
| 1286 } | 1288 } |
| 1287 return false; | 1289 return false; |
| 1288 } | 1290 } |
| 1289 }; | 1291 }; |
| 1290 | 1292 |
| 1291 /** | 1293 /** |
| 1292 * @typedef {{messageIndex: number, matchIndex: number}} | 1294 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1293 */ | 1295 */ |
| 1294 Console.ConsoleView.RegexMatchRange; | 1296 Console.ConsoleView.RegexMatchRange; |
| OLD | NEW |