Changeset 221756 in webkit
- Timestamp:
- Sep 7, 2017 1:55:50 PM (7 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r221748 r221756 1 2017-09-07 Devin Rousso <webkit@devinrousso.com> 2 3 Web Inspector: Canvas RecordingAction tree outline virtualization is broken 4 https://bugs.webkit.org/show_bug.cgi?id=176547 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Views/TreeOutline.js: 9 (WI.TreeOutline.prototype.updateVirtualizedElements.walk): 10 (WI.TreeOutline.prototype.updateVirtualizedElements): 11 Pass the current `count` to each recursive call of `walk` so that the cumulative index of a 12 TreeElement in any given sub-tree is correct. 13 Drive-by: if there is a focused TreeElement when scrolling, only change the current 14 `scrollTop` if it is not already visible. Also rewrote some loops for clarity. 15 1 16 2017-09-07 Devin Rousso <webkit@devinrousso.com> 2 17 -
trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
r220180 r221756 663 663 return; 664 664 665 function walk(parent, callback) { 666 let count = 0; 665 function walk(parent, callback, count = 0) { 667 666 let shouldReturn = false; 668 for (let i = 0; i < parent.children.length; ++i) {669 if (! parent.children[i].revealed(false))667 for (let child of parent.children) { 668 if (!child.revealed(false)) 670 669 continue; 671 670 672 671 shouldReturn = callback({ 673 672 parent, 674 treeElement: parent.children[i],673 treeElement: child, 675 674 count, 676 675 }); … … 679 678 680 679 ++count; 681 if ( parent.children[i].expanded) {682 let result = walk( parent.children[i], callback);683 count += result.count;680 if (child.expanded) { 681 let result = walk(child, callback, count); 682 count = result.count; 684 683 if (result.shouldReturn) 685 684 break; … … 694 693 let lastItem = firstItem + numberVisible + (extraRows * 2); 695 694 695 let shouldScroll = false; 696 696 if (focusedTreeElement && focusedTreeElement.revealed(false)) { 697 697 let index = walk(this, ({treeElement}) => treeElement === focusedTreeElement).count; … … 703 703 lastItem = index + extraRows; 704 704 } 705 706 shouldScroll = index < firstItem || index > lastItem; 705 707 } 706 708 707 709 let totalItems = walk(this, ({parent, treeElement, count}) => { 708 if (count < firstItem || count > lastItem) 709 treeElement.element.remove(); 710 else { 710 if (count >= firstItem && count <= lastItem) { 711 711 parent._childrenListNode.appendChild(treeElement.element); 712 712 if (treeElement._childrenListNode) 713 713 parent._childrenListNode.appendChild(treeElement._childrenListNode); 714 } 714 } else 715 treeElement.element.remove(); 716 715 717 return false; 716 718 }).count; … … 722 724 this.element.parentNode.insertBefore(this._virtualizedBottomSpacer, this.element.nextElementSibling); 723 725 724 if ( focusedTreeElement)726 if (shouldScroll) 725 727 this._virtualizedScrollContainer.scrollTop = (firstItem + extraRows) * this._virtualizedTreeItemHeight; 726 728 }
Note: See TracChangeset
for help on using the changeset viewer.