Title: [201125] trunk/Source/WebInspectorUI
Revision
201125
Author
mattba...@apple.com
Date
2016-05-18 20:21:05 -0700 (Wed, 18 May 2016)

Log Message

Web Inspector: unable to switch between navigation tree outlines using up/down arrow keys
https://bugs.webkit.org/show_bug.cgi?id=157713
<rdar://problem/26287086>

Reviewed by Timothy Hatcher.

* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype.createContentTreeOutline):
Listen for TreeOutline focus changes, and associate trees and their DOM
elements for quick lookup when handling focus events.

(WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineDidFocus):
(WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineTreeSelectionDidChange):
When selecting a tree element causes an element in a different tree outline
to be deselected, remember the old selection so that it can be restored
the next time the tree outline get the focus.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (201124 => 201125)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-19 03:11:41 UTC (rev 201124)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-19 03:21:05 UTC (rev 201125)
@@ -1,5 +1,24 @@
 2016-05-18  Matt Baker  <mattba...@apple.com>
 
+        Web Inspector: unable to switch between navigation tree outlines using up/down arrow keys
+        https://bugs.webkit.org/show_bug.cgi?id=157713
+        <rdar://problem/26287086>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel.prototype.createContentTreeOutline):
+        Listen for TreeOutline focus changes, and associate trees and their DOM
+        elements for quick lookup when handling focus events.
+
+        (WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineDidFocus):
+        (WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineTreeSelectionDidChange):
+        When selecting a tree element causes an element in a different tree outline
+        to be deselected, remember the old selection so that it can be restored
+        the next time the tree outline get the focus.
+
+2016-05-18  Matt Baker  <mattba...@apple.com>
+
         Web Inspector: Checkbox disappears when unchecking CSS property with value containing a semicolon
         https://bugs.webkit.org/show_bug.cgi?id=157862
         <rdar://problem/16214480>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (201124 => 201125)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2016-05-19 03:11:41 UTC (rev 201124)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2016-05-19 03:21:05 UTC (rev 201125)
@@ -153,7 +153,11 @@
         contentTreeOutline.hidden = !dontHideByDefault;
         contentTreeOutline.element.classList.add(WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName);
         contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._contentTreeOutlineTreeSelectionDidChange, this);
+        contentTreeOutline.element.addEventListener("focus", this._contentTreeOutlineDidFocus, this);
 
+        // FIXME Remove ContentTreeOutlineSymbol once <https://webkit.org/b/157825> is finished.
+        contentTreeOutline.element[WebInspector.NavigationSidebarPanel.ContentTreeOutlineSymbol] = contentTreeOutline;
+
         this.contentView.element.appendChild(contentTreeOutline.element);
 
         if (!suppressFiltering) {
@@ -646,22 +650,35 @@
         this.soon._updateContentOverflowShadowVisibility();
     }
 
+    _contentTreeOutlineDidFocus(event)
+    {
+        let treeOutline = event.target[WebInspector.NavigationSidebarPanel.ContentTreeOutlineSymbol];
+        if (!treeOutline)
+            return;
+
+        let previousSelectedTreeElement = treeOutline[WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol];
+        if (!previousSelectedTreeElement)
+            return;
+
+        previousSelectedTreeElement.select();
+    }
+
     _contentTreeOutlineTreeSelectionDidChange(event)
     {
-        let treeElement = event.data.selectedElement;
-        if (!treeElement)
+        let {selectedElement, deselectedElement} = event.data;
+        if (deselectedElement)
+            deselectedElement.treeOutline[WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol] = deselectedElement;
+
+        if (!selectedElement)
             return;
 
-        this._selectedContentTreeOutline = treeElement.treeOutline;
+        // Prevent two selections in the sidebar, if the selected tree outline is changing.
+        let treeOutline = selectedElement.treeOutline;
+        if (this._selectedContentTreeOutline && this._selectedContentTreeOutline !== treeOutline)
+            this._selectedContentTreeOutline.selectedTreeElement.deselect();
 
-        // Deselect any other tree elements to prevent two selections in the sidebar.
-        for (let treeOutline of this.visibleContentTreeOutlines) {
-            if (treeOutline === this._selectedContentTreeOutline)
-                continue;
-
-            if (treeOutline.selectedTreeElement)
-                treeOutline.selectedTreeElement.deselect();
-        }
+        treeOutline[WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol] = null;
+        this._selectedContentTreeOutline = treeOutline;
     }
 
     _checkForStaleResourcesIfNeeded()
@@ -790,6 +807,8 @@
     }
 };
 
+WebInspector.NavigationSidebarPanel.ContentTreeOutlineSymbol = Symbol("content-tree-outline");
+WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol = Symbol("previous-selected-tree-element");
 WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol = Symbol("suppress-filtering");
 WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering");
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to