Web Inspector: Improve focus switching in scripts panel.
authorvsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 15:05:58 +0000 (15:05 +0000)
committervsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 15:05:58 +0000 (15:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76628

Reviewed by Pavel Feldman.

* inspector/front-end/Dialog.js:
(WebInspector.Dialog.prototype._hide):
* inspector/front-end/FilteredItemSelectionDialog.js:
(WebInspector.FilteredItemSelectionDialog.prototype.onEnter):
(WebInspector.JavaScriptOutlineDialog.prototype.selectItem):
* inspector/front-end/ScriptsNavigator.js:
(WebInspector.ScriptsNavigator.prototype.get defaultFocusedElement):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._showSourceLine):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/Dialog.js
Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js
Source/WebCore/inspector/front-end/ScriptsNavigator.js
Source/WebCore/inspector/front-end/ScriptsPanel.js

index d75a65e..6f0d90c 100644 (file)
@@ -1,5 +1,22 @@
 2012-01-19  Vsevolod Vlasov  <vsevik@chromium.org>
 
+        Web Inspector: Improve focus switching in scripts panel.
+        https://bugs.webkit.org/show_bug.cgi?id=76628
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/Dialog.js:
+        (WebInspector.Dialog.prototype._hide):
+        * inspector/front-end/FilteredItemSelectionDialog.js:
+        (WebInspector.FilteredItemSelectionDialog.prototype.onEnter):
+        (WebInspector.JavaScriptOutlineDialog.prototype.selectItem):
+        * inspector/front-end/ScriptsNavigator.js:
+        (WebInspector.ScriptsNavigator.prototype.get defaultFocusedElement):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._showSourceLine):
+
+2012-01-19  Vsevolod Vlasov  <vsevik@chromium.org>
+
         Web Inspector: Add isSelfOrAnsector and isSelfOrDescendant methods to utilities.
         https://bugs.webkit.org/show_bug.cgi?id=76618
 
index 05a12dd..76d3fda 100644 (file)
@@ -100,7 +100,8 @@ WebInspector.Dialog.prototype = {
 
         this._delegate.willHide();
 
-        WebInspector.setCurrentFocusElement(this._previousFocusElement);
+        if (this._element.isSelfOrAncestor(document.activeElement))
+            WebInspector.setCurrentFocusElement(this._previousFocusElement);
         delete WebInspector.Dialog._instance;
         document.body.removeChild(this._glassPaneElement);
         window.removeEventListener("resize", this._windowResizeHandler, true);
index 2f76121..8433e9a 100644 (file)
@@ -108,6 +108,8 @@ WebInspector.FilteredItemSelectionDialog.prototype = {
 
     onEnter: function()
     {
+        if (!this._selectedElement)
+            return;
         this._delegate.selectItem(this._elementIndexes.get(this._selectedElement));
     },
 
@@ -561,6 +563,7 @@ WebInspector.JavaScriptOutlineDialog.prototype = {
         var lineNumber = this._functionItems[itemIndex].line;
         if (!isNaN(lineNumber) && lineNumber >= 0)
             this._view.highlightLine(lineNumber);
+        this._view.focus();
         delete WebInspector.JavaScriptOutlineDialog._instance;
     },
 
index 2f68f20..b07d0cd 100644 (file)
@@ -81,7 +81,7 @@ WebInspector.ScriptsNavigator.prototype = {
      */
     get defaultFocusedElement()
     {
-        return this._navigatorScriptsTreeElement
+        return this._navigatorScriptsTreeElement;
     },
 
     /**
@@ -128,7 +128,7 @@ WebInspector.ScriptsNavigator.prototype = {
         this._tabbedPane.selectTab(uiSourceCode.isContentScript ? WebInspector.ScriptsNavigator.ContentScriptsTab : WebInspector.ScriptsNavigator.ScriptsTab);
 
         var scriptTreeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
-        scriptTreeElement.revealAndSelect();
+        scriptTreeElement.revealAndSelect(true);
     },
 
     /**
index b1805f8..d5c3249 100644 (file)
@@ -477,6 +477,7 @@ WebInspector.ScriptsPanel.prototype = {
         var sourceFrame = this._showAndRevealInFileSelector(uiSourceCode);
         if (typeof lineNumber === "number")
             sourceFrame.highlightLine(lineNumber);
+        sourceFrame.focus();
     },
 
     /**