Title: [239405] trunk/Source/WebInspectorUI
Revision
239405
Author
[email protected]
Date
2018-12-19 16:46:10 -0800 (Wed, 19 Dec 2018)

Log Message

Web Inspector: Elements tab: arrow key after undoing a DOM node delete selects the wrong element
https://bugs.webkit.org/show_bug.cgi?id=192871
<rdar://problem/46849060>

Reviewed by Devin Rousso.

Undoing a DOM node removal reinserts the node into the DOMTreeOutline.
When the reinserted node precedes the selected node in the tree, the
SelectionController should update `_lastSelectedIndex`.

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController.prototype.didInsertItem):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (239404 => 239405)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-12-20 00:31:27 UTC (rev 239404)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-12-20 00:46:10 UTC (rev 239405)
@@ -1,3 +1,18 @@
+2018-12-19  Matt Baker  <[email protected]>
+
+        Web Inspector: Elements tab: arrow key after undoing a DOM node delete selects the wrong element
+        https://bugs.webkit.org/show_bug.cgi?id=192871
+        <rdar://problem/46849060>
+
+        Reviewed by Devin Rousso.
+
+        Undoing a DOM node removal reinserts the node into the DOMTreeOutline.
+        When the reinserted node precedes the selected node in the tree, the
+        SelectionController should update `_lastSelectedIndex`.
+
+        * UserInterface/Controllers/SelectionController.js:
+        (WI.SelectionController.prototype.didInsertItem):
+
 2018-12-19  Devin Rousso  <[email protected]>
 
         Web Inspector: Audit: provide localization support for % pass display

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js (239404 => 239405)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js	2018-12-20 00:31:27 UTC (rev 239404)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js	2018-12-20 00:46:10 UTC (rev 239405)
@@ -212,6 +212,11 @@
 
             current = this._selectedIndexes.indexLessThan(current);
         }
+
+        if (this._lastSelectedIndex >= index)
+            this._lastSelectedIndex += 1;
+        if (this._shiftAnchorIndex >= index)
+            this._shiftAnchorIndex += 1;
     }
 
     didRemoveItems(indexes)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (239404 => 239405)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2018-12-20 00:31:27 UTC (rev 239404)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2018-12-20 00:46:10 UTC (rev 239405)
@@ -406,8 +406,10 @@
         this._cachedNumberOfDescendents++;
 
         let index = this._indexOfTreeElement(element);
-        if (index >= 0)
+        if (index >= 0) {
+            console.assert(!element.selected, "TreeElement should not be selected before being inserted.");
             this._selectionController.didInsertItem(index);
+        }
     }
 
     _forgetTreeElement(element)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to