Changeset 238859 in webkit
- Timestamp:
- Dec 4, 2018 10:17:16 AM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r238858 r238859 1 2018-12-04 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Elements: $0 is shown for all selected elements 4 https://bugs.webkit.org/show_bug.cgi?id=192119 5 <rdar://problem/46327554> 6 7 Reviewed by Devin Rousso. 8 9 * UserInterface/Views/ContentBrowserTabContentView.js: 10 (WI.ContentBrowserTabContentView.prototype._revealAndSelectRepresentedObject): 11 * UserInterface/Views/DOMTreeContentView.js: 12 (WI.DOMTreeContentView): 13 (WI.DOMTreeContentView.prototype.layout): 14 (WI.DOMTreeContentView.prototype._domTreeSelectionDidChange): 15 Update the selected DOM node using the TreeOutline's selection change 16 event, instead of in `onselect`, which wasn't always called. 17 18 * UserInterface/Views/DOMTreeElement.js: 19 (WI.DOMTreeElement.prototype.onselect): Deleted. 20 (WI.DOMTreeElement.prototype.ondeselect): Deleted. 21 Eliminate `onselect` and `ondeselect`. TreeOutline clients should use 22 the TreeOutline.Event.SelectedDidChange event instead. 23 24 * UserInterface/Views/DOMTreeOutline.css: 25 (.tree-outline.dom li.last-selected > span::after): 26 (.tree-outline.dom:focus li.last-selected > span::after): 27 (.tree-outline.dom li.selected > span::after): Deleted. 28 (.tree-outline.dom:focus li.selected > span::after): Deleted. 29 * UserInterface/Views/DOMTreeOutline.js: 30 (WI.DOMTreeOutline.prototype.updateSelection): Deleted. 31 32 * UserInterface/Views/DebuggerSidebarPanel.js: 33 (WI.DebuggerSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): 34 * UserInterface/Views/FolderizedTreeElement.js: 35 (WI.FolderizedTreeElement.prototype._addTreeElement): 36 * UserInterface/Views/NavigationSidebarPanel.js: 37 (WI.NavigationSidebarPanel.prototype.showDefaultContentViewForTreeElement): 38 (WI.NavigationSidebarPanel.prototype._treeElementWasFiltered): 39 (WI.NavigationSidebarPanel): 40 * UserInterface/Views/OpenResourceDialog.js: 41 (WI.OpenResourceDialog.prototype._populateResourceTreeOutline): 42 (WI.OpenResourceDialog.prototype._handleKeydownEvent): 43 * UserInterface/Views/SourceCodeTreeElement.js: 44 (WI.SourceCodeTreeElement.prototype.descendantResourceTreeElementTypeDidChange): 45 * UserInterface/Views/TreeElement.js: 46 (WI.TreeElement.prototype.select): 47 (WI.TreeElement.prototype.revealAndSelect): 48 (WI.TreeElement.prototype.deselect): 49 Remove `suppressOnDeselect` and rename `suppressOnSelect` to `suppressNotification`. 50 Now that `ondeselect` has been removed `suppressOnDeselect` is no longer 51 meaningful, as TreeOutline generates a single `SelectedDidChange` event 52 when the selected item changes. In the case of `revealAndSelect`, both 53 arguments had the same value. 54 55 * UserInterface/Views/TreeOutline.js: 56 (WI.TreeOutline): 57 (WI.TreeOutline.prototype.selectionControllerSelectionDidChange): 58 Add a unique class name to the last selected TreeElement to distinguish 59 it from other selected elements. 60 1 61 2018-12-04 Matt Baker <mattbaker@apple.com> 2 62 -
trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js
r234563 r238859 318 318 319 319 if (treeElement) 320 treeElement.revealAndSelect(true, false, true , true);320 treeElement.revealAndSelect(true, false, true); 321 321 else if (this.navigationSidebarPanel && this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement) 322 322 this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement.deselect(true); -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
r238602 r238859 68 68 this._domTreeOutline.allowsMultipleSelection = true; 69 69 this._domTreeOutline.addEventListener(WI.TreeOutline.Event.ElementAdded, this._domTreeElementAdded, this); 70 this._domTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._domTreeSelectionDidChange, this); 70 71 this._domTreeOutline.addEventListener(WI.DOMTreeOutline.Event.SelectedNodeChanged, this._selectedNodeDidChange, this); 71 72 this._domTreeOutline.wireToDomAgent(); … … 358 359 layout() 359 360 { 360 this._domTreeOutline.updateSelection ();361 this._domTreeOutline.updateSelectionArea(); 361 362 362 363 if (this.layoutReason === WI.View.LayoutReason.Resize) … … 450 451 451 452 this._updateBreakpointStatus(node.id); 453 } 454 455 _domTreeSelectionDidChange(event) 456 { 457 let treeElement = this._domTreeOutline.selectedTreeElement; 458 let domNode = treeElement ? treeElement.representedObject : null; 459 let selectedByUser = event.data.selectedByUser; 460 461 this._domTreeOutline.suppressRevealAndSelect = true; 462 this._domTreeOutline.selectDOMNode(domNode, selectedByUser); 463 464 if (domNode && selectedByUser) 465 WI.domManager.highlightDOMNode(domNode.id); 466 467 this._domTreeOutline.updateSelectionArea(); 468 this._domTreeOutline.suppressRevealAndSelect = false; 452 469 } 453 470 -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
r238626 r238859 626 626 } 627 627 628 onselect(treeElement, selectedByUser)629 {630 this.treeOutline.suppressRevealAndSelect = true;631 this.treeOutline.selectDOMNode(this.representedObject, selectedByUser);632 if (selectedByUser)633 WI.domManager.highlightDOMNode(this.representedObject.id);634 this.treeOutline.updateSelection();635 this.treeOutline.suppressRevealAndSelect = false;636 }637 638 ondeselect(treeElement)639 {640 this.treeOutline.selectDOMNode(null);641 }642 643 628 ondelete() 644 629 { -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css
r238671 r238859 79 79 } 80 80 81 .tree-outline.dom li. selected > span::after {81 .tree-outline.dom li.last-selected > span::after { 82 82 content: " = $0"; 83 83 color: var(--console-secondary-text-color); … … 86 86 } 87 87 88 .tree-outline.dom:focus li. selected > span::after {88 .tree-outline.dom:focus li.last-selected > span::after { 89 89 color: var(--selected-secondary-text-color); 90 90 } -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
r238626 r238859 185 185 } 186 186 187 updateSelection ()187 updateSelectionArea() 188 188 { 189 189 // This will miss updating selection areas used for the hovered tree element and -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
r238743 r238859 785 785 786 786 if (newDebuggerTreeElement && wasSelected) 787 newDebuggerTreeElement.revealAndSelect(true, false, true , true);787 newDebuggerTreeElement.revealAndSelect(true, false, true); 788 788 } 789 789 -
trunk/Source/WebInspectorUI/UserInterface/Views/FolderizedTreeElement.js
r231391 r238859 224 224 225 225 if (wasSelected) 226 childTreeElement.revealAndSelect(true, false, true , true);226 childTreeElement.revealAndSelect(true, false, true); 227 227 } 228 228 -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
r238831 r238859 196 196 return false; 197 197 198 treeElement.revealAndSelect(true, false, true , true);198 treeElement.revealAndSelect(true, false, true); 199 199 return true; 200 200 } … … 743 743 const omitFocus = true; 744 744 const selectedByUser = false; 745 const suppressOnSelect = true; 746 const suppressOnDeselect = true; 747 treeElement.revealAndSelect(omitFocus, selectedByUser, suppressOnSelect, suppressOnDeselect); 745 const suppressNotification = true; 746 treeElement.revealAndSelect(omitFocus, selectedByUser, suppressNotification); 748 747 } 749 748 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js
r238483 r238859 125 125 126 126 if (this._treeOutline.children.length) 127 this._treeOutline.children[0].select(true, false, true , true);127 this._treeOutline.children[0].select(true, false, true); 128 128 } 129 129 … … 203 203 treeElement = treeElement[adjacentSiblingProperty]; 204 204 if (treeElement) 205 treeElement.revealAndSelect(true, false, true , true);205 treeElement.revealAndSelect(true, false, true); 206 206 207 207 event.preventDefault(); -
trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTreeElement.js
r220119 r238859 185 185 parentTreeElement.expand(); 186 186 if (wasSelected) 187 childTreeElement.revealAndSelect(true, false, true , true);187 childTreeElement.revealAndSelect(true, false, true); 188 188 } 189 189 -
trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js
r238757 r238859 499 499 } 500 500 501 select(omitFocus, selectedByUser, suppress OnSelect, suppressOnDeselect)501 select(omitFocus, selectedByUser, suppressNotification) 502 502 { 503 503 if (!this.treeOutline || !this.selectable) … … 516 516 517 517 this.selected = true; 518 treeOutline.selectTreeElementInternal(this, suppressOnSelect, selectedByUser); 519 520 if (!suppressOnSelect && this.onselect) 521 this.onselect(this, selectedByUser); 518 treeOutline.selectTreeElementInternal(this, suppressNotification, selectedByUser); 522 519 523 520 let treeOutlineGroup = WI.TreeOutlineGroup.groupForTreeOutline(treeOutline); … … 528 525 } 529 526 530 revealAndSelect(omitFocus, selectedByUser, suppress OnSelect, suppressOnDeselect)527 revealAndSelect(omitFocus, selectedByUser, suppressNotification) 531 528 { 532 529 this.reveal(); 533 this.select(omitFocus, selectedByUser, suppress OnSelect, suppressOnDeselect);534 } 535 536 deselect(suppress OnDeselect)530 this.select(omitFocus, selectedByUser, suppressNotification); 531 } 532 533 deselect(suppressNotification) 537 534 { 538 535 if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected) … … 540 537 541 538 this.selected = false; 542 this.treeOutline.selectTreeElementInternal(null, suppressOnDeselect); 543 544 if (!suppressOnDeselect && this.ondeselect) 545 this.ondeselect(this); 539 this.treeOutline.selectTreeElementInternal(null, suppressNotification); 546 540 547 541 return true; -
trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
r238858 r238859 56 56 57 57 this._cachedNumberOfDescendents = 0; 58 this._previousSelectedTreeElement = null; 58 59 this._selectionController = new WI.SelectionController(this); 59 60 … … 813 814 } 814 815 816 let selectedTreeElement = this.selectedTreeElement; 817 if (selectedTreeElement !== this._previousSelectedTreeElement) { 818 if (this._previousSelectedTreeElement) 819 this._previousSelectedTreeElement.listItemElement.classList.remove("last-selected"); 820 821 this._previousSelectedTreeElement = selectedTreeElement; 822 823 if (this._previousSelectedTreeElement) 824 this._previousSelectedTreeElement.listItemElement.classList.add("last-selected"); 825 } 826 815 827 this._dispatchSelectionDidChangeEvent(); 816 828
Note: See TracChangeset
for help on using the changeset viewer.