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

Side by Side Diff: Source/WebCore/inspector/front-end/InspectorView.js

Issue 9965056: Merge 112539 - Web Inspector: "go to the previous panel" shortcut is painful to maintain (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 WebInspector.settings.lastActivePanel.set(panelName); 81 WebInspector.settings.lastActivePanel.set(panelName);
82 this._pushToHistory(panelName); 82 this._pushToHistory(panelName);
83 WebInspector.userMetrics.panelShown(panelName); 83 WebInspector.userMetrics.panelShown(panelName);
84 } 84 }
85 } 85 }
86 }, 86 },
87 87
88 _keyDown: function(event) 88 _keyDown: function(event)
89 { 89 {
90 switch (event.keyIdentifier) { 90 switch (event.keyIdentifier) {
91 case "Left":
92 var isBackKey = !event.shiftKey && WebInspector.KeyboardShortcut .eventHasCtrlOrMeta(event) && !WebInspector.isBeingEdited(event.target);
93 if (isBackKey && this._canGoBackInHistory()) {
94 this._goBackInHistory();
95 event.preventDefault();
96 }
97 break;
98
99 case "Right":
100 var isForwardKey = !event.shiftKey && WebInspector.KeyboardShort cut.eventHasCtrlOrMeta(event) && !WebInspector.isBeingEdited(event.target);
101 if (isForwardKey && this._canGoForwardInHistory()) {
102 this._goForwardInHistory();
103 event.preventDefault();
104 }
105 break;
106
107 // Windows and Mac have two different definitions of [, so accept bo th. 91 // Windows and Mac have two different definitions of [, so accept bo th.
108 case "U+005B": 92 case "U+005B":
109 case "U+00DB": // [ key 93 case "U+00DB": // [ key
110 var isRotateLeft = WebInspector.KeyboardShortcut.eventHasCtrlOrM eta(event) && !event.shiftKey && !event.altKey; 94 var isRotateLeft = WebInspector.KeyboardShortcut.eventHasCtrlOrM eta(event) && !event.shiftKey && !event.altKey;
111 if (isRotateLeft) { 95 if (isRotateLeft) {
112 var index = this._panelOrder.indexOf(this.currentPanel()); 96 var index = this._panelOrder.indexOf(this.currentPanel());
113 index = (index === 0) ? this._panelOrder.length - 1 : index - 1; 97 index = (index === 0) ? this._panelOrder.length - 1 : index - 1;
114 this._panelOrder[index].toolbarItem.click(); 98 this._panelOrder[index].toolbarItem.click();
115 event.preventDefault(); 99 event.consume();
100 return;
101 }
102
103 var isGoBack = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta( event) && event.altKey;
104 if (isGoBack && this._canGoBackInHistory()) {
105 this._goBackInHistory();
106 event.consume();
116 } 107 }
117 break; 108 break;
118 109
119 // Windows and Mac have two different definitions of ], so accept bo th. 110 // Windows and Mac have two different definitions of ], so accept bo th.
120 case "U+005D": 111 case "U+005D":
121 case "U+00DD": // ] key 112 case "U+00DD": // ] key
122 var isRotateRight = WebInspector.KeyboardShortcut.eventHasCtrlOr Meta(event) && !event.shiftKey && !event.altKey; 113 var isRotateRight = WebInspector.KeyboardShortcut.eventHasCtrlOr Meta(event) && !event.shiftKey && !event.altKey;
123 if (isRotateRight) { 114 if (isRotateRight) {
124 var index = this._panelOrder.indexOf(this.currentPanel()); 115 var index = this._panelOrder.indexOf(this.currentPanel());
125 index = (index + 1) % this._panelOrder.length; 116 index = (index + 1) % this._panelOrder.length;
126 this._panelOrder[index].toolbarItem.click(); 117 this._panelOrder[index].toolbarItem.click();
127 event.preventDefault(); 118 event.consume();
119 return;
128 } 120 }
129 121
122 var isGoForward = WebInspector.KeyboardShortcut.eventHasCtrlOrMe ta(event) && event.altKey;
123 if (isGoForward && this._canGoForwardInHistory()) {
124 this._goForwardInHistory();
125 event.consume();
126 }
130 break; 127 break;
131 } 128 }
132 }, 129 },
133 130
134 _canGoBackInHistory: function() 131 _canGoBackInHistory: function()
135 { 132 {
136 return this._historyIterator > 0; 133 return this._historyIterator > 0;
137 }, 134 },
138 135
139 _goBackInHistory: function() 136 _goBackInHistory: function()
(...skipping 26 matching lines...) Expand all
166 this._historyIterator = this._history.length - 1; 163 this._historyIterator = this._history.length - 1;
167 } 164 }
168 } 165 }
169 166
170 WebInspector.InspectorView.prototype.__proto__ = WebInspector.View.prototype; 167 WebInspector.InspectorView.prototype.__proto__ = WebInspector.View.prototype;
171 168
172 /** 169 /**
173 * @type {WebInspector.InspectorView} 170 * @type {WebInspector.InspectorView}
174 */ 171 */
175 WebInspector.inspectorView = null; 172 WebInspector.inspectorView = null;
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/front-end/ConsoleView.js ('k') | Source/WebCore/inspector/front-end/ScriptsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698