Web Inspector: REGRESSION (r244155): pressing down expands folders in trees
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Apr 2019 21:20:09 +0000 (21:20 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Apr 2019 21:20:09 +0000 (21:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197051
<rdar://problem/50006414>

Reviewed by Timothy Hatcher.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.selectionControllerPreviousSelectableItem):
(WI.TreeOutline.prototype.selectionControllerNextSelectableItem):
Skip hidden items when traversing the tree.

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.ondelete):
Reveal all items about to be deleted so that the above change won't skip any siblings.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js

index e0316fa..e4a47e8 100644 (file)
@@ -1,5 +1,22 @@
 2019-04-18  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: REGRESSION (r244155): pressing down expands folders in trees
+        https://bugs.webkit.org/show_bug.cgi?id=197051
+        <rdar://problem/50006414>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WI.TreeOutline.prototype.selectionControllerPreviousSelectableItem):
+        (WI.TreeOutline.prototype.selectionControllerNextSelectableItem):
+        Skip hidden items when traversing the tree.
+
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WI.DOMTreeOutline.prototype.ondelete):
+        Reveal all items about to be deleted so that the above change won't skip any siblings.
+
+2019-04-18  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Canvas: enable WebGL2 for inspector page
         https://bugs.webkit.org/show_bug.cgi?id=196932
         <rdar://problem/49916213>
index 67d5441..7a09139 100644 (file)
@@ -313,6 +313,12 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline
             return false;
 
         this._treeElementsToRemove = this.selectedTreeElements;
+
+        // Reveal all of the elements being deleted so that if the node is hidden (e.g. the parent
+        // is collapsed), we can select its siblings instead of the parent itself.
+        for (let treeElement of this._treeElementsToRemove)
+            treeElement.reveal();
+
         this._selectionController.removeSelectedItems();
 
         let levelMap = new Map;
@@ -335,12 +341,12 @@ WI.DOMTreeOutline = class DOMTreeOutline extends WI.TreeOutline
 
         // Track removed elements, since the opening and closing tags for the
         // same WI.DOMNode can both be selected.
-        let removedTreeElements = new Set;
+        let removedDOMNodes = new Set;
 
         for (let treeElement of this._treeElementsToRemove) {
-            if (removedTreeElements.has(treeElement))
+            if (removedDOMNodes.has(treeElement.representedObject))
                 continue;
-            removedTreeElements.add(treeElement)
+            removedDOMNodes.add(treeElement.representedObject);
             treeElement.remove();
         }
 
index 449c66f..66ecd52 100644 (file)
@@ -855,7 +855,7 @@ WI.TreeOutline = class TreeOutline extends WI.Object
         if (!treeElement)
             return null;
 
-        const skipUnrevealed = false;
+        const skipUnrevealed = true;
         const stayWithin = null;
         const dontPopulate = true;
 
@@ -874,7 +874,7 @@ WI.TreeOutline = class TreeOutline extends WI.Object
         if (!treeElement)
             return null;
 
-        const skipUnrevealed = false;
+        const skipUnrevealed = true;
         const stayWithin = null;
         const dontPopulate = true;