Changeset 217317 in webkit
- Timestamp:
- May 23, 2017 6:09:18 PM (7 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r217306 r217317 1 2017-05-23 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: content views are not restored on reload if its tree element is filtered out 4 https://bugs.webkit.org/show_bug.cgi?id=165744 5 <rdar://problem/27461323> 6 7 Reviewed by Devin Rousso. 8 9 By default, NavigationSidebar should get the selected represented object 10 from its content browser, instead of relying on the tree selection. This 11 allows a filtered tree selection to persist across page loads. 12 13 * UserInterface/Views/NavigationSidebarPanel.js: 14 (WebInspector.NavigationSidebarPanel.prototype.get currentRepresentedObject): 15 (WebInspector.NavigationSidebarPanel.prototype.saveStateToCookie): 16 Get the represented object from the content browser instead of relying 17 on the tree selection (which can be filtered out). 18 19 (WebInspector.NavigationSidebarPanel.prototype._updateFilter): 20 (WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged): 21 (WebInspector.NavigationSidebarPanel.prototype._treeElementWasFiltered): 22 Reselect the represented object's tree element when it is shown due 23 to a change in the filter state. 24 25 (WebInspector.NavigationSidebarPanel.prototype.get hasSelectedElement): Deleted. 26 Not used. 27 (WebInspector.NavigationSidebarPanel.prototype.representedObjectWasFiltered): Deleted. 28 Not used. Replaced by _treeElementWasFiltered. 29 1 30 2017-05-23 Matt Baker <mattbaker@apple.com> 2 31 -
trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js
r217258 r217317 101 101 } 102 102 103 get hasSelectedElement() 104 { 105 return !!this._contentTreeOutlineGroup.selectedTreeElement 103 get currentRepresentedObject() 104 { 105 if (!this._contentBrowser) 106 return null; 107 108 return this._contentBrowser.currentRepresentedObjects[0] || null; 106 109 } 107 110 … … 205 208 console.assert(cookie); 206 209 207 // This does not save folder selections, which lack a represented object and content view. 208 var selectedTreeElement = null; 209 this.contentTreeOutlines.forEach(function(outline) { 210 if (outline.selectedTreeElement) 211 selectedTreeElement = outline.selectedTreeElement; 212 }); 213 214 if (!selectedTreeElement) 215 return; 216 217 if (this._isTreeElementWithoutRepresentedObject(selectedTreeElement)) 218 return; 219 220 var representedObject = selectedTreeElement.representedObject; 210 if (!this._contentBrowser) 211 return; 212 213 let representedObject = this.currentRepresentedObject; 214 if (!representedObject) 215 return; 216 221 217 cookie[WebInspector.TypeIdentifierCookieKey] = representedObject.constructor.TypeIdentifier; 222 218 223 if (representedObject.saveIdentityToCookie) 219 if (representedObject.saveIdentityToCookie) { 224 220 representedObject.saveIdentityToCookie(cookie); 225 else 226 console.error("Error: TreeElement.representedObject is missing a saveIdentityToCookie implementation. TreeElement.constructor: ", selectedTreeElement.constructor); 221 return; 222 } 223 224 console.error("NavigationSidebarPanel representedObject is missing a saveIdentityToCookie implementation.", representedObject); 227 225 } 228 226 … … 426 424 // Protected 427 425 428 representedObjectWasFiltered(representedObject, filtered)429 {430 // Implemented by subclasses if needed.431 }432 433 426 pruneStaleResourceTreeElements() 434 427 { … … 571 564 this.applyFiltersToTreeElement(currentTreeElement); 572 565 if (currentTreeElementWasHidden !== currentTreeElement.hidden) 573 this. representedObjectWasFiltered(currentTreeElement.representedObject, currentTreeElement.hidden);566 this._treeElementWasFiltered(currentTreeElement); 574 567 } 575 568 … … 596 589 this.applyFiltersToTreeElement(currentTreeElement); 597 590 if (currentTreeElementWasHidden !== currentTreeElement.hidden) 598 this. representedObjectWasFiltered(currentTreeElement.representedObject, currentTreeElement.hidden);591 this._treeElementWasFiltered(currentTreeElement); 599 592 } 600 593 … … 746 739 return emptyContentPlaceholderElement; 747 740 } 741 742 _treeElementWasFiltered(treeElement) 743 { 744 if (treeElement.selected || treeElement.hidden) 745 return; 746 747 let representedObject = this.currentRepresentedObject; 748 if (!representedObject || treeElement.representedObject !== representedObject) 749 return; 750 751 const omitFocus = true; 752 const selectedByUser = false; 753 const suppressOnSelect = true; 754 const suppressOnDeselect = true; 755 treeElement.revealAndSelect(omitFocus, selectedByUser, suppressOnSelect, suppressOnDeselect); 756 } 748 757 }; 749 758
Note: See TracChangeset
for help on using the changeset viewer.