OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 InspectorFrontendHost.closeWindow(); | 581 InspectorFrontendHost.closeWindow(); |
582 } | 582 } |
583 | 583 |
584 WebInspector.documentClick = function(event) | 584 WebInspector.documentClick = function(event) |
585 { | 585 { |
586 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a"); | 586 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a"); |
587 if (!anchor || anchor.target === "_blank") | 587 if (!anchor || anchor.target === "_blank") |
588 return; | 588 return; |
589 | 589 |
590 // Prevent the link from navigating, since we don't do any navigation by fol
lowing links normally. | 590 // Prevent the link from navigating, since we don't do any navigation by fol
lowing links normally. |
591 event.consume(); | 591 event.consume(true); |
592 | 592 |
593 function followLink() | 593 function followLink() |
594 { | 594 { |
595 if (WebInspector.isBeingEdited(event.target) || WebInspector._showAnchor
Location(anchor)) | 595 if (WebInspector.isBeingEdited(event.target) || WebInspector._showAnchor
Location(anchor)) |
596 return; | 596 return; |
597 | 597 |
598 const profileMatch = WebInspector.ProfileType.URLRegExp.exec(anchor.href
); | 598 const profileMatch = WebInspector.ProfileType.URLRegExp.exec(anchor.href
); |
599 if (profileMatch) { | 599 if (profileMatch) { |
600 WebInspector.showProfileForURL(anchor.href); | 600 WebInspector.showProfileForURL(anchor.href); |
601 return; | 601 return; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 section.addKey(goToShortcut.name, WebInspector.UIString("Go to line")); | 678 section.addKey(goToShortcut.name, WebInspector.UIString("Go to line")); |
679 } | 679 } |
680 | 680 |
681 WebInspector.documentKeyDown = function(event) | 681 WebInspector.documentKeyDown = function(event) |
682 { | 682 { |
683 const helpKey = WebInspector.isMac() ? "U+003F" : "U+00BF"; // "?" for both
platforms | 683 const helpKey = WebInspector.isMac() ? "U+003F" : "U+00BF"; // "?" for both
platforms |
684 | 684 |
685 if (event.keyIdentifier === "F1" || | 685 if (event.keyIdentifier === "F1" || |
686 (event.keyIdentifier === helpKey && event.shiftKey && (!WebInspector.isB
eingEdited(event.target) || event.metaKey))) { | 686 (event.keyIdentifier === helpKey && event.shiftKey && (!WebInspector.isB
eingEdited(event.target) || event.metaKey))) { |
687 WebInspector.shortcutsScreen.show(); | 687 WebInspector.shortcutsScreen.show(); |
688 event.consume(); | 688 event.consume(true); |
689 return; | 689 return; |
690 } | 690 } |
691 | 691 |
692 if (WebInspector.currentFocusElement() && WebInspector.currentFocusElement()
.handleKeyEvent) { | 692 if (WebInspector.currentFocusElement() && WebInspector.currentFocusElement()
.handleKeyEvent) { |
693 WebInspector.currentFocusElement().handleKeyEvent(event); | 693 WebInspector.currentFocusElement().handleKeyEvent(event); |
694 if (event.handled) { | 694 if (event.handled) { |
695 event.consume(); | 695 event.consume(true); |
696 return; | 696 return; |
697 } | 697 } |
698 } | 698 } |
699 | 699 |
700 if (WebInspector.inspectorView.currentPanel()) { | 700 if (WebInspector.inspectorView.currentPanel()) { |
701 WebInspector.inspectorView.currentPanel().handleShortcut(event); | 701 WebInspector.inspectorView.currentPanel().handleShortcut(event); |
702 if (event.handled) { | 702 if (event.handled) { |
703 event.consume(); | 703 event.consume(true); |
704 return; | 704 return; |
705 } | 705 } |
706 } | 706 } |
707 | 707 |
708 WebInspector.searchController.handleShortcut(event); | 708 WebInspector.searchController.handleShortcut(event); |
709 WebInspector.advancedSearchController.handleShortcut(event); | 709 WebInspector.advancedSearchController.handleShortcut(event); |
710 if (event.handled) { | 710 if (event.handled) { |
711 event.consume(); | 711 event.consume(true); |
712 return; | 712 return; |
713 } | 713 } |
714 | 714 |
715 var isMac = WebInspector.isMac(); | 715 var isMac = WebInspector.isMac(); |
716 switch (event.keyIdentifier) { | 716 switch (event.keyIdentifier) { |
717 case "U+0052": // R key | 717 case "U+0052": // R key |
718 if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) { | 718 if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) { |
719 PageAgent.reload(event.shiftKey); | 719 PageAgent.reload(event.shiftKey); |
720 event.consume(); | 720 event.consume(true); |
721 } | 721 } |
722 break; | 722 break; |
723 case "F5": | 723 case "F5": |
724 if (!isMac) { | 724 if (!isMac) { |
725 PageAgent.reload(event.ctrlKey || event.shiftKey); | 725 PageAgent.reload(event.ctrlKey || event.shiftKey); |
726 event.consume(); | 726 event.consume(true); |
727 } | 727 } |
728 break; | 728 break; |
729 } | 729 } |
730 | 730 |
731 var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(e
vent) && | 731 var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(e
vent) && |
732 !event.shiftKey && | 732 !event.shiftKey && |
733 !event.altKey && | 733 !event.altKey && |
734 !InspectorFrontendHost.isStub; | 734 !InspectorFrontendHost.isStub; |
735 switch (event.keyCode) { | 735 switch (event.keyCode) { |
736 case 107: // + | 736 case 107: // + |
737 case 187: // + | 737 case 187: // + |
738 if (isValidZoomShortcut) { | 738 if (isValidZoomShortcut) { |
739 WebInspector._zoomIn(); | 739 WebInspector._zoomIn(); |
740 event.consume(); | 740 event.consume(true); |
741 } | 741 } |
742 break; | 742 break; |
743 case 109: // - | 743 case 109: // - |
744 case 189: // - | 744 case 189: // - |
745 if (isValidZoomShortcut) { | 745 if (isValidZoomShortcut) { |
746 WebInspector._zoomOut(); | 746 WebInspector._zoomOut(); |
747 event.consume(); | 747 event.consume(true); |
748 } | 748 } |
749 break; | 749 break; |
750 case 48: // 0 | 750 case 48: // 0 |
751 if (isValidZoomShortcut) { | 751 if (isValidZoomShortcut) { |
752 WebInspector._resetZoom(); | 752 WebInspector._resetZoom(); |
753 event.consume(); | 753 event.consume(true); |
754 } | 754 } |
755 break; | 755 break; |
756 } | 756 } |
757 } | 757 } |
758 | 758 |
759 WebInspector.postDocumentKeyDown = function(event) | 759 WebInspector.postDocumentKeyDown = function(event) |
760 { | 760 { |
761 if (event.handled) | 761 if (event.handled) |
762 return; | 762 return; |
763 | 763 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 WebInspector.frontendReused = function() | 1003 WebInspector.frontendReused = function() |
1004 { | 1004 { |
1005 this.resourceTreeModel.frontendReused(); | 1005 this.resourceTreeModel.frontendReused(); |
1006 } | 1006 } |
1007 | 1007 |
1008 WebInspector._toolbarItemClicked = function(event) | 1008 WebInspector._toolbarItemClicked = function(event) |
1009 { | 1009 { |
1010 var toolbarItem = event.currentTarget; | 1010 var toolbarItem = event.currentTarget; |
1011 WebInspector.inspectorView.setCurrentPanel(toolbarItem.panel); | 1011 WebInspector.inspectorView.setCurrentPanel(toolbarItem.panel); |
1012 } | 1012 } |
OLD | NEW |