Title: [239517] trunk/Source/WebInspectorUI
- Revision
- 239517
- Author
- [email protected]
- Date
- 2018-12-21 14:27:50 -0800 (Fri, 21 Dec 2018)
Log Message
Web Inspector: update scroll position when revealing a virtualized WI.DataGridNode
https://bugs.webkit.org/show_bug.cgi?id=192992
<rdar://problem/46886427>
Reviewed by Joseph Pecoraro.
When `reveal`ing a `WI.DataGridNode`, if it is not currently in the DOM tree (e.g. it's been
virtualized by it's owner `WI.DataGrid`), we need to scroll to it's position so that it gets
added to the DOM tree before it can be revealed/selected.
* UserInterface/Views/DataGrid.js:
(WI.DataGrid.prototype.layout):
(WI.DataGrid.prototype.updateVisibleRows):
(WI.DataGrid.prototype._updateVisibleRows): Deleted.
* UserInterface/Views/DataGridNode.js:
(WI.DataGridNode.prototype.reveal):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (239516 => 239517)
--- trunk/Source/WebInspectorUI/ChangeLog 2018-12-21 21:33:03 UTC (rev 239516)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-12-21 22:27:50 UTC (rev 239517)
@@ -1,3 +1,23 @@
+2018-12-21 Devin Rousso <[email protected]>
+
+ Web Inspector: update scroll position when revealing a virtualized WI.DataGridNode
+ https://bugs.webkit.org/show_bug.cgi?id=192992
+ <rdar://problem/46886427>
+
+ Reviewed by Joseph Pecoraro.
+
+ When `reveal`ing a `WI.DataGridNode`, if it is not currently in the DOM tree (e.g. it's been
+ virtualized by it's owner `WI.DataGrid`), we need to scroll to it's position so that it gets
+ added to the DOM tree before it can be revealed/selected.
+
+ * UserInterface/Views/DataGrid.js:
+ (WI.DataGrid.prototype.layout):
+ (WI.DataGrid.prototype.updateVisibleRows):
+ (WI.DataGrid.prototype._updateVisibleRows): Deleted.
+
+ * UserInterface/Views/DataGridNode.js:
+ (WI.DataGridNode.prototype.reveal):
+
2018-12-20 Nikita Vasilyev <[email protected]>
Web Inspector: Dark Mode: Type profiler popovers have black text on dark background
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js (239516 => 239517)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js 2018-12-21 21:33:03 UTC (rev 239516)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DataGrid.js 2018-12-21 22:27:50 UTC (rev 239517)
@@ -876,7 +876,7 @@
this._updateHeaderAndScrollbar();
}
- this._updateVisibleRows();
+ this.updateVisibleRows();
}
sizeDidChange()
@@ -1047,7 +1047,7 @@
this.needsLayout();
}
- _updateVisibleRows()
+ updateVisibleRows(focusedDataGridNode)
{
if (this._inline || this._variableHeightRows) {
// Inline DataGrids always show all their rows, so we can't virtualize them.
@@ -1066,6 +1066,9 @@
nextElement = rowElement;
}
+ if (focusedDataGridNode)
+ focusedDataGridNode.element.scrollIntoViewIfNeeded(false);
+
return;
}
@@ -1079,26 +1082,32 @@
if (isNaN(this._cachedScrollableOffsetHeight))
this._cachedScrollableOffsetHeight = this._scrollContainerElement.offsetHeight;
- let scrollTop = this._cachedScrollTop;
- let scrollableOffsetHeight = this._cachedScrollableOffsetHeight;
+ let visibleRowCount = Math.ceil((this._cachedScrollableOffsetHeight + (overflowPadding * 2)) / rowHeight);
- let visibleRowCount = Math.ceil((scrollableOffsetHeight + (overflowPadding * 2)) / rowHeight);
+ if (!focusedDataGridNode) {
+ let currentTopMargin = this._topDataTableMarginHeight;
+ let currentBottomMargin = this._bottomDataTableMarginHeight;
+ let currentTableBottom = currentTopMargin + (visibleRowCount * rowHeight);
- let currentTopMargin = this._topDataTableMarginHeight;
- let currentBottomMargin = this._bottomDataTableMarginHeight;
- let currentTableBottom = currentTopMargin + (visibleRowCount * rowHeight);
+ let belowTopThreshold = !currentTopMargin || this._cachedScrollTop > currentTopMargin + updateOffsetThreshold;
+ let aboveBottomThreshold = !currentBottomMargin || this._cachedScrollTop + this._cachedScrollableOffsetHeight < currentTableBottom - updateOffsetThreshold;
- let belowTopThreshold = !currentTopMargin || scrollTop > currentTopMargin + updateOffsetThreshold;
- let aboveBottomThreshold = !currentBottomMargin || scrollTop + scrollableOffsetHeight < currentTableBottom - updateOffsetThreshold;
+ if (belowTopThreshold && aboveBottomThreshold && !isNaN(this._previousRevealedRowCount))
+ return;
+ }
- if (belowTopThreshold && aboveBottomThreshold && !isNaN(this._previousRevealedRowCount))
- return;
-
let revealedRows = this._rows.filter((row) => row.revealed && !row.hidden);
this._previousRevealedRowCount = revealedRows.length;
- let topHiddenRowCount = Math.max(0, Math.floor((scrollTop - overflowPadding) / rowHeight));
+ if (focusedDataGridNode) {
+ let focusedIndex = revealedRows.indexOf(focusedDataGridNode);
+ let firstVisibleRowIndex = this._cachedScrollTop / rowHeight;
+ if (focusedIndex < firstVisibleRowIndex || focusedIndex > firstVisibleRowIndex + visibleRowCount)
+ this._scrollContainerElement.scrollTop = this._cachedScrollTop = (focusedIndex * rowHeight) - (this._cachedScrollableOffsetHeight / 2) + (rowHeight / 2);
+ }
+
+ let topHiddenRowCount = Math.max(0, Math.floor((this._cachedScrollTop - overflowPadding) / rowHeight));
let bottomHiddenRowCount = Math.max(0, this._previousRevealedRowCount - topHiddenRowCount - visibleRowCount);
let marginTop = topHiddenRowCount * rowHeight;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js (239516 => 239517)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js 2018-12-21 21:33:03 UTC (rev 239516)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js 2018-12-21 22:27:50 UTC (rev 239517)
@@ -544,7 +544,7 @@
currentAncestor = currentAncestor.parent;
}
- this.element.scrollIntoViewIfNeeded(false);
+ this.dataGrid.updateVisibleRows(this);
this.dispatchEventToListeners("revealed");
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes