Web Inspector: REGRESSION(r238599): Multiple Selection: selecting a breakpoint will...
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2018 22:40:52 +0000 (22:40 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2018 22:40:52 +0000 (22:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192093
<rdar://problem/46318466>

Reviewed by Devin Rousso.

* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.select):
TreeElement shouldn't manage the TreeOutline's selection barrier.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline):
(WI.TreeOutline.prototype.get processingSelectionChange):
(WI.TreeOutline.prototype.selectionControllerSelectionDidChange):
(WI.TreeOutline.prototype.selectTreeElementInternal):
The selection re-entry barrier `processingSelectionChange` should be
managed internally by TreeOutline, and exposed as a read-only property.
Fix a bug where the barrier was cleared before dispatching the change
notification, which can cause re-entry as a side effect.

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

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

index 04cbd87..0ccfc19 100644 (file)
@@ -1,3 +1,25 @@
+2018-11-30  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: REGRESSION(r238599): Multiple Selection: selecting a breakpoint will change the selection to it's parent on the first click
+        https://bugs.webkit.org/show_bug.cgi?id=192093
+        <rdar://problem/46318466>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/TreeElement.js:
+        (WI.TreeElement.prototype.select):
+        TreeElement shouldn't manage the TreeOutline's selection barrier.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WI.TreeOutline):
+        (WI.TreeOutline.prototype.get processingSelectionChange):
+        (WI.TreeOutline.prototype.selectionControllerSelectionDidChange):
+        (WI.TreeOutline.prototype.selectTreeElementInternal):
+        The selection re-entry barrier `processingSelectionChange` should be
+        managed internally by TreeOutline, and exposed as a read-only property.
+        Fix a bug where the barrier was cleared before dispatching the change
+        notification, which can cause re-entry as a side effect.
+
 2018-11-30  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Settings: reload button needs horizontal spacing
index 545fc71..54d8bc0 100644 (file)
@@ -514,16 +514,12 @@ WI.TreeElement = class TreeElement extends WI.Object
         if (!treeOutline)
             return;
 
-        treeOutline.processingSelectionChange = true;
-
         this.selected = true;
         treeOutline.selectTreeElementInternal(this, suppressOnSelect, selectedByUser);
 
         if (!suppressOnSelect && this.onselect)
             this.onselect(this, selectedByUser);
 
-        treeOutline.processingSelectionChange = false;
-
         let treeOutlineGroup = WI.TreeOutlineGroup.groupForTreeOutline(treeOutline);
         if (!treeOutlineGroup)
             return;
index 4bd90df..61a3c41 100644 (file)
@@ -59,7 +59,7 @@ WI.TreeOutline = class TreeOutline extends WI.Object
         this._treeElementIndexCache = new Map;
 
         this._itemWasSelectedByUser = false;
-        this._processingSelectionControllerSelectionDidChange = false;
+        this._processingSelectionChange = false;
         this._suppressNextSelectionDidChangeEvent = false;
 
         this._virtualizedVisibleTreeElements = null;
@@ -132,6 +132,8 @@ WI.TreeOutline = class TreeOutline extends WI.Object
         return [];
     }
 
+    get processingSelectionChange() { return this._processingSelectionChange; }
+
     get hidden()
     {
         return this._hidden;
@@ -788,7 +790,7 @@ WI.TreeOutline = class TreeOutline extends WI.Object
 
     selectionControllerSelectionDidChange(controller, deselectedItems, selectedItems)
     {
-        this._processingSelectionControllerSelectionDidChange = true;
+        this._processingSelectionChange = true;
 
         for (let index of deselectedItems) {
             let treeElement = this._treeElementAtIndex(index);
@@ -810,9 +812,9 @@ WI.TreeOutline = class TreeOutline extends WI.Object
             }
         }
 
-        this._processingSelectionControllerSelectionDidChange = false;
-
         this._dispatchSelectionDidChangeEvent();
+
+        this._processingSelectionChange = false;
     }
 
     selectionControllerNextSelectableIndex(controller, index)
@@ -855,7 +857,7 @@ WI.TreeOutline = class TreeOutline extends WI.Object
 
     selectTreeElementInternal(treeElement, suppressNotification = false, selectedByUser = false)
     {
-        if (this._processingSelectionControllerSelectionDidChange)
+        if (this._processingSelectionChange)
             return;
 
         this._itemWasSelectedByUser = selectedByUser;