Focus the DOM tree in the Web Inspector when a node is inspected.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Sep 2008 20:57:55 +0000 (20:57 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Sep 2008 20:57:55 +0000 (20:57 +0000)
        So when the search field has focus, the focus moves to the tree,
        allowing the arrow keys work. This can happen when using the new
        find in page feature.

        https://bugs.webkit.org/show_bug.cgi?id=21251

        Reviewed by Geoff Garen.

        * page/inspector/ElementsPanel.js:
        (WebInspector.ElementsPanel): Set currentFocusElement to
        the main-panels element if the panel is visible.
        (WebInspector.ElementsPanel.prototype.updateBreadcrumb):
        Remove a set of currentFocusElement since this moved.
        * page/inspector/inspector.js:
        (WebInspector.set currentFocusElement): Always focus the element.
        This ensures that when focus changes in the page and we don't
        catch it, we will still focus the elements even if we think it
        was already focused.

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

WebCore/ChangeLog
WebCore/page/inspector/ElementsPanel.js
WebCore/page/inspector/inspector.js

index f645810..51c9e01 100644 (file)
@@ -1,5 +1,27 @@
 2008-09-30  Timothy Hatcher  <timothy@apple.com>
 
 2008-09-30  Timothy Hatcher  <timothy@apple.com>
 
+        Focus the DOM tree in the Web Inspector when a node is inspected.
+        So when the search field has focus, the focus moves to the tree,
+        allowing the arrow keys work. This can happen when using the new
+        find in page feature.
+
+        https://bugs.webkit.org/show_bug.cgi?id=21251
+
+        Reviewed by Geoff Garen.
+
+        * page/inspector/ElementsPanel.js:
+        (WebInspector.ElementsPanel): Set currentFocusElement to
+        the main-panels element if the panel is visible.
+        (WebInspector.ElementsPanel.prototype.updateBreadcrumb):
+        Remove a set of currentFocusElement since this moved.
+        * page/inspector/inspector.js:
+        (WebInspector.set currentFocusElement): Always focus the element.
+        This ensures that when focus changes in the page and we don't
+        catch it, we will still focus the elements even if we think it
+        was already focused.
+
+2008-09-30  Timothy Hatcher  <timothy@apple.com>
+
         Make the Web Inspector's toolbar icons darker when the mouse is
         pressed on them. This matches the standard NSToolbar look.
 
         Make the Web Inspector's toolbar icons darker when the mouse is
         pressed on them. This matches the standard NSToolbar look.
 
index 47105bc..f4596f2 100644 (file)
@@ -44,6 +44,9 @@ WebInspector.ElementsPanel = function()
 
     this.treeOutline.focusedNodeChanged = function(forceUpdate)
     {
 
     this.treeOutline.focusedNodeChanged = function(forceUpdate)
     {
+        if (this.panel.visible)
+            WebInspector.currentFocusElement = document.getElementById("main-panels");
+
         this.panel.updateBreadcrumb(forceUpdate);
 
         for (var pane in this.panel.sidebarPanes)
         this.panel.updateBreadcrumb(forceUpdate);
 
         for (var pane in this.panel.sidebarPanes)
@@ -572,8 +575,6 @@ WebInspector.ElementsPanel.prototype = {
                 panel.focusedDOMNode = crumb.representedObject;
             }
 
                 panel.focusedDOMNode = crumb.representedObject;
             }
 
-            WebInspector.currentFocusElement = document.getElementById("main-panels");
-
             event.preventDefault();
         }
 
             event.preventDefault();
         }
 
index 0b91efe..01e1256 100644 (file)
@@ -56,10 +56,8 @@ var WebInspector = {
 
     set currentFocusElement(x)
     {
 
     set currentFocusElement(x)
     {
-        if (!x || this._currentFocusElement === x)
-            return;
-
-        this._previousFocusElement = this._currentFocusElement;
+        if (this._currentFocusElement !== x)
+            this._previousFocusElement = this._currentFocusElement;
         this._currentFocusElement = x;
 
         if (this._currentFocusElement) {
         this._currentFocusElement = x;
 
         if (this._currentFocusElement) {