Title: [206442] trunk/Source/WebInspectorUI
Revision
206442
Author
mattba...@apple.com
Date
2016-09-27 10:25:38 -0700 (Tue, 27 Sep 2016)

Log Message

Web Inspector: Unfocusing / Focusing inspector window should not change ContentView
https://bugs.webkit.org/show_bug.cgi?id=162572
<rdar://problem/28479562>

Reviewed by Brian Burg.

Improve NavigationSidebarPanel logic for coordinating selection between trees.
When tree selection changes, the most recent selection should be restored
the next time the tree is focused.

The sidebar should also handle focusing a tree for the first time, in
which no previous selection exists, and focusing a tree that has had its
previous selection filtered out (hidden).

* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineDidFocus):
(WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineTreeSelectionDidChange):
Restoring the last deselected element, instead of the last selected element
only works when the selection is moving from one tree to another. When
the elements belong to the same tree the newly selected element won't
be saved until the next selection change. If the window loses and regains
the focus before then, the tree will restore the previous selection,
effectively reverting the last selection change.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (206441 => 206442)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-09-27 17:18:55 UTC (rev 206441)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-09-27 17:25:38 UTC (rev 206442)
@@ -1,3 +1,29 @@
+2016-09-27  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: Unfocusing / Focusing inspector window should not change ContentView
+        https://bugs.webkit.org/show_bug.cgi?id=162572
+        <rdar://problem/28479562>
+
+        Reviewed by Brian Burg.
+
+        Improve NavigationSidebarPanel logic for coordinating selection between trees.
+        When tree selection changes, the most recent selection should be restored
+        the next time the tree is focused.
+
+        The sidebar should also handle focusing a tree for the first time, in
+        which no previous selection exists, and focusing a tree that has had its
+        previous selection filtered out (hidden).
+
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineDidFocus):
+        (WebInspector.NavigationSidebarPanel.prototype._contentTreeOutlineTreeSelectionDidChange):
+        Restoring the last deselected element, instead of the last selected element
+        only works when the selection is moving from one tree to another. When
+        the elements belong to the same tree the newly selected element won't
+        be saved until the next selection change. If the window loses and regains
+        the focus before then, the tree will restore the previous selection,
+        effectively reverting the last selection change.
+
 2016-09-27  Tomas Popela  <tpop...@redhat.com>
 
         [GTK] Mac defaults are used for key shortcuts on Linux

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (206441 => 206442)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2016-09-27 17:18:55 UTC (rev 206441)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2016-09-27 17:25:38 UTC (rev 206442)
@@ -647,6 +647,15 @@
             return;
 
         let previousSelectedTreeElement = treeOutline[WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol];
+        if (!previousSelectedTreeElement || previousSelectedTreeElement.hidden) {
+            const skipUnrevealed = true;
+            let firstVisibleTreeElement = treeOutline.children[0];
+            while (firstVisibleTreeElement && firstVisibleTreeElement.hidden)
+                firstVisibleTreeElement = firstVisibleTreeElement.traverseNextTreeElement(skipUnrevealed, this);
+
+            previousSelectedTreeElement = firstVisibleTreeElement;
+        }
+
         if (!previousSelectedTreeElement)
             return;
 
@@ -655,15 +664,14 @@
 
     _contentTreeOutlineTreeSelectionDidChange(event)
     {
-        let {selectedElement, deselectedElement} = event.data;
-        if (deselectedElement)
-            deselectedElement.treeOutline[WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol] = deselectedElement;
-
+        let selectedElement = event.data.selectedElement;
         if (!selectedElement)
             return;
 
-        // Prevent two selections in the sidebar.
         let selectedTreeOutline = selectedElement.treeOutline;
+        selectedTreeOutline[WebInspector.NavigationSidebarPanel.PreviousSelectedTreeElementSymbol] = selectedElement;
+
+        // Prevent multiple selections in the sidebar.
         for (let treeOutline of this._visibleContentTreeOutlines) {
             if (selectedTreeOutline === treeOutline)
                 continue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to