Web Inspector: REGRESSION (r238602): Elements: deleting the last child of a collapsed...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:44:50 +0000 (22:44 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:44:50 +0000 (22:44 +0000)
commit05474d0a00fac7b6305922e8eea361ea916d77c9
treead3de3f17ee73e37ba67658ca440501429a81d79
parent391017b6314898bd8baafe6697c46387996928be
Web Inspector: REGRESSION (r238602): Elements: deleting the last child of a collapsed parent selects the parent's next sibling
https://bugs.webkit.org/show_bug.cgi?id=192711
<rdar://problem/46738990>

Reviewed by Timothy Hatcher.

Original patch by Matt Baker <mattbaker@apple.com>.

Source/WebInspectorUI:

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController.prototype.removeSelectedItems):
When looking for a new item to select, start with the item preceding the
selection, instead of the item following the selection. This matches
pre-multiple selection behavior, as well as Mail and Xcode.

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.onexpand):
Drive-by fix: when a hidden node is selected, its selection area is drawn
with a height of 0px. Update the selection area once the hidden node's
parent is expanded. AFAIK, this has always been broken.

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.ondelete):
After a delete the `SelectionController` may have chosen a child of a
collapsed parent as the new selected item. If the item isn't the closing tag (e.g. after
deleting the last child), reveal it.

(WI.DOMTreeOutline.prototype.selectionControllerPreviousSelectableItem):

* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.get previousSelectableSibling): Added.
(WI.TreeElement.prototype.get nextSelectableSibling): Added.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.selectionControllerPreviousSelectableItem):
(WI.TreeOutline.prototype.selectionControllerNextSelectableItem):
Set `skipUnrevealed` to false, so that children of collapsed parent nodes
are considered when looking for an item to selected after a delete. Hidden `TreeElement`s
are still ignored as they aren't `selectable`.

LayoutTests:

* inspector/table/table-remove-rows.html:
* inspector/table/table-remove-rows-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/inspector/table/table-remove-rows-expected.txt
LayoutTests/inspector/table/table-remove-rows.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
Source/WebInspectorUI/UserInterface/Views/TreeElement.js
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js