Changeset 117974 in webkit
- Timestamp:
- May 22, 2012 8:04:49 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117973 r117974 1 2012-05-22 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: make "Go to source" shortcut accessible from all panels. 4 https://bugs.webkit.org/show_bug.cgi?id=87132 5 6 Reviewed by Vsevolod Vlasov. 7 8 * English.lproj/localizedStrings.js: 9 * inspector/front-end/AdvancedSearchController.js: 10 (WebInspector.AdvancedSearchController.prototype.handleShortcut): 11 * inspector/front-end/FilteredItemSelectionDialog.js: 12 (WebInspector.OpenResourceDialog.filterOutEmptyURLs): 13 (WebInspector.OpenResourceDialog.compareFunction): 14 (WebInspector.OpenResourceDialog): 15 (WebInspector.OpenResourceDialog.prototype.itemTitleAt): 16 (WebInspector.OpenResourceDialog.prototype.itemKeyAt): 17 (WebInspector.OpenResourceDialog.prototype.itemsCount): 18 (WebInspector.OpenResourceDialog.prototype.requestItems): 19 (WebInspector.OpenResourceDialog.prototype.selectItem): 20 (WebInspector.OpenResourceDialog.show): 21 * inspector/front-end/ScriptsPanel.js: 22 (WebInspector.ScriptsPanel.prototype.appendApplicableItems): 23 (WebInspector.ScriptsPanel.prototype.showGoToSourceDialog): 24 * inspector/front-end/SearchController.js: 25 (WebInspector.SearchController.prototype.handleShortcut): 26 * inspector/front-end/inspector.js: 27 (WebInspector._registerShortcuts): 28 (WebInspector.documentKeyDown): 29 1 30 2012-05-22 Ilya Tikhonovsky <loislo@chromium.org> 2 31 -
trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js
r117750 r117974 51 51 /** 52 52 * @param {Event} event 53 * @return {boolean} 53 54 */ 54 55 handleShortcut: function(event) … … 61 62 this.close(); 62 63 event.consume(); 64 return true; 63 65 } 66 return false; 64 67 }, 65 68 -
trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js
r117462 r117974 573 573 * @constructor 574 574 * @implements {WebInspector.SelectionDialogContentProvider} 575 * @param {Array.<WebInspector.Resource>} resources 575 * @param {WebInspector.ScriptsPanel} panel 576 * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider 576 577 */ 577 WebInspector.OpenResourceDialog = function( resources)578 WebInspector.OpenResourceDialog = function(panel, uiSourceCodeProvider) 578 579 { 579 // FIXME: migrate from WebInspector.Resource to WebInspector.Source (base for Resource and UISourceCode) and make this dialog OpenSource.580 580 WebInspector.SelectionDialogContentProvider.call(this); 581 582 this.resources = resources; 583 584 function filterOutEmptyURLs(resource) 585 { 586 return !!resource.parsedURL.lastPathComponent; 581 this._panel = panel; 582 583 this._uiSourceCodes = uiSourceCodeProvider.uiSourceCodes(); 584 585 function filterOutEmptyURLs(uiSourceCode) 586 { 587 return !!uiSourceCode.parsedURL.lastPathComponent; 587 588 } 588 this. resources = this.resources.filter(filterOutEmptyURLs);589 590 function compareFunction( resource1, resource2)591 { 592 return resource1.parsedURL.lastPathComponent.localeCompare(resource2.parsedURL.lastPathComponent);589 this._uiSourceCodes = this._uiSourceCodes.filter(filterOutEmptyURLs); 590 591 function compareFunction(uiSourceCode1, uiSourceCode2) 592 { 593 return uiSourceCode1.parsedURL.lastPathComponent.localeCompare(uiSourceCode2.parsedURL.lastPathComponent); 593 594 } 594 this. resources.sort(compareFunction);595 this._uiSourceCodes.sort(compareFunction); 595 596 } 596 597 … … 607 608 itemTitleAt: function(itemIndex) 608 609 { 609 return this. resources[itemIndex].parsedURL.lastPathComponent;610 return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent; 610 611 }, 611 612 … … 616 617 itemKeyAt: function(itemIndex) 617 618 { 618 return this. resources[itemIndex].parsedURL.lastPathComponent;619 return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent; 619 620 }, 620 621 … … 624 625 itemsCount: function() 625 626 { 626 return this. resources.length;627 return this._uiSourceCodes.length; 627 628 }, 628 629 … … 632 633 requestItems: function(callback) 633 634 { 634 callback(0, this. resources.length, 1, 1);635 callback(0, this._uiSourceCodes.length, 1, 1); 635 636 }, 636 637 … … 640 641 selectItem: function(itemIndex) 641 642 { 642 // Overriden by descendants;643 this._panel.showUISourceCode(this._uiSourceCodes[itemIndex]); 643 644 } 644 645 } 645 646 646 647 WebInspector.OpenResourceDialog.prototype.__proto__ = WebInspector.SelectionDialogContentProvider.prototype; 647 648 /**649 * @constructor650 * @extends {WebInspector.OpenResourceDialog}651 * @param {WebInspector.ScriptsPanel} panel652 * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider653 */654 WebInspector.OpenScriptDialog = function(panel, uiSourceCodeProvider)655 {656 WebInspector.OpenResourceDialog.call(this, uiSourceCodeProvider.uiSourceCodes());657 this._panel = panel;658 }659 660 /**661 * @param {WebInspector.ScriptsPanel} panel662 * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider663 */664 WebInspector.OpenScriptDialog.install = function(panel, uiSourceCodeProvider, relativeToElement)665 {666 function showOpenResourceDialog()667 {668 WebInspector.OpenScriptDialog._show(panel, uiSourceCodeProvider, relativeToElement);669 }670 671 var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut();672 panel.registerShortcut(openResourceShortcut.key, showOpenResourceDialog);673 }674 648 675 649 /** … … 678 652 * @param {Element} relativeToElement 679 653 */ 680 WebInspector.Open ScriptDialog._show = function(panel, uiSourceCodeProvider, relativeToElement)654 WebInspector.OpenResourceDialog.show = function(panel, uiSourceCodeProvider, relativeToElement) 681 655 { 682 656 if (WebInspector.Dialog.currentInstance()) 683 657 return; 684 658 685 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.Open ScriptDialog(panel, uiSourceCodeProvider));659 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.OpenResourceDialog(panel, uiSourceCodeProvider)); 686 660 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); 687 661 } 688 689 WebInspector.OpenScriptDialog.prototype = {690 /**691 * @param {number} itemIndex692 */693 selectItem: function(itemIndex)694 {695 this._panel.showUISourceCode(this.resources[itemIndex]);696 }697 }698 699 WebInspector.OpenScriptDialog.prototype.__proto__ = WebInspector.OpenResourceDialog.prototype; -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r117917 r117974 86 86 this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previouslyViewedFiles"); 87 87 this._editorContainer.show(this.editorView.mainElement); 88 WebInspector.OpenScriptDialog.install(this, this._uiSourceCodeProvider, this.editorView.mainElement);89 88 90 89 this._navigatorController = new WebInspector.NavigatorOverlayController(this, this.editorView, this._navigator.view, this._editorContainer.view); … … 132 131 helpSection.addKey(evaluateInConsoleShortcut.name, WebInspector.UIString("Evaluate selection in console")); 133 132 this.registerShortcut(evaluateInConsoleShortcut.key, this._evaluateSelectionInConsole.bind(this)); 134 135 var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut();136 helpSection.addKey(openResourceShortcut.name, WebInspector.UIString("Open file"));137 133 138 134 var outlineShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift); … … 1070 1066 contextMenu.appendSeparator(); 1071 1067 } 1068 }, 1069 1070 showGoToSourceDialog: function() 1071 { 1072 WebInspector.inspectorView.setCurrentPanel(this); 1073 WebInspector.OpenResourceDialog.show(this, this._uiSourceCodeProvider, this.editorView.mainElement); 1072 1074 } 1073 1075 } -
trunk/Source/WebCore/inspector/front-end/SearchController.js
r116672 r117974 85 85 }, 86 86 87 /** 88 * @param {Event} event 89 * @return {boolean} 90 */ 87 91 handleShortcut: function(event) 88 92 { … … 98 102 if (isFindKey) { 99 103 this.focusSearchField(); 100 event.handled = true; 104 event.consume(); 105 return true; 101 106 } 102 107 break; … … 106 111 if (!isMac) { 107 112 this.focusSearchField(); 108 event. handled = true;113 event.consume(); 109 114 } 110 115 break; … … 119 124 } else if (currentPanel.jumpToNextSearchResult) 120 125 currentPanel.jumpToNextSearchResult(); 121 event.handled = true; 126 event.consume(); 127 return true; 122 128 } 123 129 break; 124 130 } 131 return false; 125 132 }, 126 133 -
trunk/Source/WebCore/inspector/front-end/inspector.js
r117799 r117974 688 688 section.addKey(shortcut.shortcutToString(shortcut.Keys.Esc), WebInspector.UIString("Toggle console")); 689 689 section.addKey(shortcut.shortcutToString("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search")); 690 690 691 691 var advancedSearchShortcut = WebInspector.AdvancedSearchController.createShortcut(); 692 692 section.addKey(advancedSearchShortcut.name, WebInspector.UIString("Search across all sources")); 693 693 694 var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut(); 695 section.addKey(openResourceShortcut.name, WebInspector.UIString("Go to source")); 696 694 697 if (WebInspector.isMac()) { 695 698 keys = [ … … 731 734 } 732 735 733 WebInspector.searchController.handleShortcut(event); 734 WebInspector.advancedSearchController.handleShortcut(event); 735 if (event.handled) { 736 event.consume(true); 737 return; 738 } 739 740 var isMac = WebInspector.isMac(); 736 if (WebInspector.searchController.handleShortcut(event)) 737 return; 738 if (WebInspector.advancedSearchController.handleShortcut(event)) 739 return; 740 741 741 switch (event.keyIdentifier) { 742 case "U+004F": // O key 743 if (!event.shiftKey && !event.altKey && WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) { 744 WebInspector.panels.scripts.showGoToSourceDialog(); 745 event.consume(true); 746 } 747 break; 742 748 case "U+0052": // R key 743 if ( (event.metaKey && isMac) || (event.ctrlKey && !isMac)) {749 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) { 744 750 PageAgent.reload(event.shiftKey); 745 751 event.consume(true); … … 747 753 break; 748 754 case "F5": 749 if (! isMac) {755 if (!WebInspector.isMac()) { 750 756 PageAgent.reload(event.ctrlKey || event.shiftKey); 751 757 event.consume(true);
Note: See TracChangeset
for help on using the changeset viewer.