Web Inspector: Elements tab: multiple selection lost after navigating to another tab
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:44:11 +0000 (22:44 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:44:11 +0000 (22:44 +0000)
commit391017b6314898bd8baafe6697c46387996928be
tree0ce9b7761cf20c9d8487096cffab652e41f78015
parent32510c9af6856494298be982b45e7f2e07f85d03
Web Inspector: Elements tab: multiple selection lost after navigating to another tab
https://bugs.webkit.org/show_bug.cgi?id=192681
<rdar://problem/46709392>

Reviewed by Timothy Hatcher.

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

Source/WebInspectorUI:

* UserInterface/Controllers/SelectionController.js:
(WI.SelectionController.prototype.selectItem):
Simplify internal logic by removing an early return.

(WI.SelectionController.prototype.selectItems): Added.
(WI.SelectionController.prototype.selectAll):
Provide a means to select multiple items in a single operation.
If `_lastSelectedItem` is not in the items to select, the last
item being selected will become the last selected item.

(WI.SelectionController.prototype._deselectAllAndSelect):
Drive-by fix: correct a logic error. If no items are selected, the item
passed as an argument should still become selected.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.selectTreeElements): Added.

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement):
(WI.DOMTreeElement.prototype.get closeTagTreeElement): Added.
(WI.DOMTreeElement.prototype._updateChildren):
Make the close tag `TreeElement` available from the open tag `TreeElement`.

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.update):
Restore selected `TreeElement`s after updating.

* UserInterface/Base/Utilities.js:
* UserInterface/Test.html:

LayoutTests:

* inspector/tree-outline/tree-outline-selection.html: Added.
* inspector/tree-outline/tree-outline-selection-expected.txt: Added.
Add `TreeOutline` tests for single and multiple selection.

* inspector/unit-tests/set-utilities.html:
* inspector/unit-tests/set-utilities-expected.txt:
Add tests for `Set.prototype.lastValue`.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/tree-outline/tree-outline-selection-expected.txt [new file with mode: 0644]
LayoutTests/inspector/tree-outline/tree-outline-selection.html [new file with mode: 0644]
LayoutTests/inspector/unit-tests/set-utilities-expected.txt
LayoutTests/inspector/unit-tests/set-utilities.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Utilities.js
Source/WebInspectorUI/UserInterface/Controllers/SelectionController.js
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js