Diff
Modified: trunk/Source/WebCore/ChangeLog (117973 => 117974)
--- trunk/Source/WebCore/ChangeLog 2012-05-22 14:48:38 UTC (rev 117973)
+++ trunk/Source/WebCore/ChangeLog 2012-05-22 15:04:49 UTC (rev 117974)
@@ -1,3 +1,32 @@
+2012-05-22 Pavel Feldman <[email protected]>
+
+ Web Inspector: make "Go to source" shortcut accessible from all panels.
+ https://bugs.webkit.org/show_bug.cgi?id=87132
+
+ Reviewed by Vsevolod Vlasov.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/AdvancedSearchController.js:
+ (WebInspector.AdvancedSearchController.prototype.handleShortcut):
+ * inspector/front-end/FilteredItemSelectionDialog.js:
+ (WebInspector.OpenResourceDialog.filterOutEmptyURLs):
+ (WebInspector.OpenResourceDialog.compareFunction):
+ (WebInspector.OpenResourceDialog):
+ (WebInspector.OpenResourceDialog.prototype.itemTitleAt):
+ (WebInspector.OpenResourceDialog.prototype.itemKeyAt):
+ (WebInspector.OpenResourceDialog.prototype.itemsCount):
+ (WebInspector.OpenResourceDialog.prototype.requestItems):
+ (WebInspector.OpenResourceDialog.prototype.selectItem):
+ (WebInspector.OpenResourceDialog.show):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype.appendApplicableItems):
+ (WebInspector.ScriptsPanel.prototype.showGoToSourceDialog):
+ * inspector/front-end/SearchController.js:
+ (WebInspector.SearchController.prototype.handleShortcut):
+ * inspector/front-end/inspector.js:
+ (WebInspector._registerShortcuts):
+ (WebInspector.documentKeyDown):
+
2012-05-22 Ilya Tikhonovsky <[email protected]>
Web Inspector: HeapSnapshot: speedUp buildAggregates.
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js (117973 => 117974)
--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js 2012-05-22 14:48:38 UTC (rev 117973)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js 2012-05-22 15:04:49 UTC (rev 117974)
@@ -50,6 +50,7 @@
WebInspector.AdvancedSearchController.prototype = {
/**
* @param {Event} event
+ * @return {boolean}
*/
handleShortcut: function(event)
{
@@ -60,7 +61,9 @@
} else
this.close();
event.consume();
+ return true;
}
+ return false;
},
_frameNavigated: function()
Modified: trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js (117973 => 117974)
--- trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js 2012-05-22 14:48:38 UTC (rev 117973)
+++ trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js 2012-05-22 15:04:49 UTC (rev 117974)
@@ -572,26 +572,27 @@
/**
* @constructor
* @implements {WebInspector.SelectionDialogContentProvider}
- * @param {Array.<WebInspector.Resource>} resources
+ * @param {WebInspector.ScriptsPanel} panel
+ * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider
*/
-WebInspector.OpenResourceDialog = function(resources)
+WebInspector.OpenResourceDialog = function(panel, uiSourceCodeProvider)
{
- // FIXME: migrate from WebInspector.Resource to WebInspector.Source (base for Resource and UISourceCode) and make this dialog OpenSource.
WebInspector.SelectionDialogContentProvider.call(this);
+ this._panel = panel;
- this.resources = resources;
+ this._uiSourceCodes = uiSourceCodeProvider.uiSourceCodes();
- function filterOutEmptyURLs(resource)
+ function filterOutEmptyURLs(uiSourceCode)
{
- return !!resource.parsedURL.lastPathComponent;
+ return !!uiSourceCode.parsedURL.lastPathComponent;
}
- this.resources = this.resources.filter(filterOutEmptyURLs);
+ this._uiSourceCodes = this._uiSourceCodes.filter(filterOutEmptyURLs);
- function compareFunction(resource1, resource2)
+ function compareFunction(uiSourceCode1, uiSourceCode2)
{
- return resource1.parsedURL.lastPathComponent.localeCompare(resource2.parsedURL.lastPathComponent);
+ return uiSourceCode1.parsedURL.lastPathComponent.localeCompare(uiSourceCode2.parsedURL.lastPathComponent);
}
- this.resources.sort(compareFunction);
+ this._uiSourceCodes.sort(compareFunction);
}
WebInspector.OpenResourceDialog.createShortcut = function()
@@ -606,7 +607,7 @@
*/
itemTitleAt: function(itemIndex)
{
- return this.resources[itemIndex].parsedURL.lastPathComponent;
+ return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent;
},
/**
@@ -615,7 +616,7 @@
*/
itemKeyAt: function(itemIndex)
{
- return this.resources[itemIndex].parsedURL.lastPathComponent;
+ return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent;
},
/**
@@ -623,7 +624,7 @@
*/
itemsCount: function()
{
- return this.resources.length;
+ return this._uiSourceCodes.length;
},
/**
@@ -631,7 +632,7 @@
*/
requestItems: function(callback)
{
- callback(0, this.resources.length, 1, 1);
+ callback(0, this._uiSourceCodes.length, 1, 1);
},
/**
@@ -639,61 +640,22 @@
*/
selectItem: function(itemIndex)
{
- // Overriden by descendants;
+ this._panel.showUISourceCode(this._uiSourceCodes[itemIndex]);
}
}
WebInspector.OpenResourceDialog.prototype.__proto__ = WebInspector.SelectionDialogContentProvider.prototype;
/**
- * @constructor
- * @extends {WebInspector.OpenResourceDialog}
* @param {WebInspector.ScriptsPanel} panel
* @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider
- */
-WebInspector.OpenScriptDialog = function(panel, uiSourceCodeProvider)
-{
- WebInspector.OpenResourceDialog.call(this, uiSourceCodeProvider.uiSourceCodes());
- this._panel = panel;
-}
-
-/**
- * @param {WebInspector.ScriptsPanel} panel
- * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider
- */
-WebInspector.OpenScriptDialog.install = function(panel, uiSourceCodeProvider, relativeToElement)
-{
- function showOpenResourceDialog()
- {
- WebInspector.OpenScriptDialog._show(panel, uiSourceCodeProvider, relativeToElement);
- }
-
- var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut();
- panel.registerShortcut(openResourceShortcut.key, showOpenResourceDialog);
-}
-
-/**
- * @param {WebInspector.ScriptsPanel} panel
- * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider
* @param {Element} relativeToElement
*/
-WebInspector.OpenScriptDialog._show = function(panel, uiSourceCodeProvider, relativeToElement)
+WebInspector.OpenResourceDialog.show = function(panel, uiSourceCodeProvider, relativeToElement)
{
if (WebInspector.Dialog.currentInstance())
return;
- var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.OpenScriptDialog(panel, uiSourceCodeProvider));
+ var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDialog(new WebInspector.OpenResourceDialog(panel, uiSourceCodeProvider));
WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog);
}
-
-WebInspector.OpenScriptDialog.prototype = {
- /**
- * @param {number} itemIndex
- */
- selectItem: function(itemIndex)
- {
- this._panel.showUISourceCode(this.resources[itemIndex]);
- }
-}
-
-WebInspector.OpenScriptDialog.prototype.__proto__ = WebInspector.OpenResourceDialog.prototype;
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (117973 => 117974)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-05-22 14:48:38 UTC (rev 117973)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-05-22 15:04:49 UTC (rev 117974)
@@ -85,7 +85,6 @@
this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previouslyViewedFiles");
this._editorContainer.show(this.editorView.mainElement);
- WebInspector.OpenScriptDialog.install(this, this._uiSourceCodeProvider, this.editorView.mainElement);
this._navigatorController = new WebInspector.NavigatorOverlayController(this, this.editorView, this._navigator.view, this._editorContainer.view);
@@ -132,9 +131,6 @@
helpSection.addKey(evaluateInConsoleShortcut.name, WebInspector.UIString("Evaluate selection in console"));
this.registerShortcut(evaluateInConsoleShortcut.key, this._evaluateSelectionInConsole.bind(this));
- var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut();
- helpSection.addKey(openResourceShortcut.name, WebInspector.UIString("Open file"));
-
var outlineShortcut = WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift);
helpSection.addKey(outlineShortcut.name, WebInspector.UIString("Go to member"));
this.registerShortcut(outlineShortcut.key, this._showOutlineDialog.bind(this));
@@ -1069,6 +1065,12 @@
contextMenu.appendItem(WebInspector.UIString("Revision history..."), this._showLocalHistory.bind(this, /** @type {WebInspector.UISourceCode} */ target));
contextMenu.appendSeparator();
}
+ },
+
+ showGoToSourceDialog: function()
+ {
+ WebInspector.inspectorView.setCurrentPanel(this);
+ WebInspector.OpenResourceDialog.show(this, this._uiSourceCodeProvider, this.editorView.mainElement);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/SearchController.js (117973 => 117974)
--- trunk/Source/WebCore/inspector/front-end/SearchController.js 2012-05-22 14:48:38 UTC (rev 117973)
+++ trunk/Source/WebCore/inspector/front-end/SearchController.js 2012-05-22 15:04:49 UTC (rev 117974)
@@ -84,6 +84,10 @@
this._performSearch("");
},
+ /**
+ * @param {Event} event
+ * @return {boolean}
+ */
handleShortcut: function(event)
{
var isMac = WebInspector.isMac();
@@ -97,7 +101,8 @@
if (isFindKey) {
this.focusSearchField();
- event.handled = true;
+ event.consume();
+ return true;
}
break;
@@ -105,7 +110,7 @@
case "F3":
if (!isMac) {
this.focusSearchField();
- event.handled = true;
+ event.consume();
}
break;
@@ -118,10 +123,12 @@
currentPanel.jumpToPreviousSearchResult();
} else if (currentPanel.jumpToNextSearchResult)
currentPanel.jumpToNextSearchResult();
- event.handled = true;
+ event.consume();
+ return true;
}
break;
}
+ return false;
},
activePanelChanged: function()
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (117973 => 117974)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2012-05-22 14:48:38 UTC (rev 117973)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2012-05-22 15:04:49 UTC (rev 117974)
@@ -687,10 +687,13 @@
section.addKey(shortcut.shortcutToString(shortcut.Keys.Esc), WebInspector.UIString("Toggle console"));
section.addKey(shortcut.shortcutToString("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search"));
-
+
var advancedSearchShortcut = WebInspector.AdvancedSearchController.createShortcut();
section.addKey(advancedSearchShortcut.name, WebInspector.UIString("Search across all sources"));
-
+
+ var openResourceShortcut = WebInspector.OpenResourceDialog.createShortcut();
+ section.addKey(openResourceShortcut.name, WebInspector.UIString("Go to source"));
+
if (WebInspector.isMac()) {
keys = [
shortcut.shortcutToString("g", shortcut.Modifiers.Meta),
@@ -730,23 +733,26 @@
}
}
- WebInspector.searchController.handleShortcut(event);
- WebInspector.advancedSearchController.handleShortcut(event);
- if (event.handled) {
- event.consume(true);
+ if (WebInspector.searchController.handleShortcut(event))
return;
- }
+ if (WebInspector.advancedSearchController.handleShortcut(event))
+ return;
- var isMac = WebInspector.isMac();
switch (event.keyIdentifier) {
+ case "U+004F": // O key
+ if (!event.shiftKey && !event.altKey && WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) {
+ WebInspector.panels.scripts.showGoToSourceDialog();
+ event.consume(true);
+ }
+ break;
case "U+0052": // R key
- if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
+ if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) {
PageAgent.reload(event.shiftKey);
event.consume(true);
}
break;
case "F5":
- if (!isMac) {
+ if (!WebInspector.isMac()) {
PageAgent.reload(event.ctrlKey || event.shiftKey);
event.consume(true);
}