Title: [222899] trunk/Source/WebInspectorUI
- Revision
- 222899
- Author
- [email protected]
- Date
- 2017-10-04 23:33:56 -0700 (Wed, 04 Oct 2017)
Log Message
Web Inspector: When scrolled Network Table reduces the number of rows it may appear as blank
https://bugs.webkit.org/show_bug.cgi?id=177914
<rdar://problem/34827613>
Patch by Joseph Pecoraro <[email protected]> on 2017-10-04
Reviewed by Matt Baker.
* UserInterface/Views/Table.js:
(WI.Table.prototype._updateVisibleRows):
(WI.Table.prototype._updateFillerRowWithNewHeight):
Reduce the scrollTop when the table was scrolled and was then reloaded with a
smaller number of rows. This can happen in two ways. Either the number of rows
was reduced so much that we enter non-scrollable mode with a non-zero filler
row. This can always reset the scrollTop to 0. Or when a large number of rows
is reduced to a smaller number than our current scrollTop but still more than
fit on one screen. In that case we can reduce the scrollTop to whatever would
scroll the table to its max position.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (222898 => 222899)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-10-05 06:13:51 UTC (rev 222898)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-10-05 06:33:56 UTC (rev 222899)
@@ -1,3 +1,22 @@
+2017-10-04 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: When scrolled Network Table reduces the number of rows it may appear as blank
+ https://bugs.webkit.org/show_bug.cgi?id=177914
+ <rdar://problem/34827613>
+
+ Reviewed by Matt Baker.
+
+ * UserInterface/Views/Table.js:
+ (WI.Table.prototype._updateVisibleRows):
+ (WI.Table.prototype._updateFillerRowWithNewHeight):
+ Reduce the scrollTop when the table was scrolled and was then reloaded with a
+ smaller number of rows. This can happen in two ways. Either the number of rows
+ was reduced so much that we enter non-scrollable mode with a non-zero filler
+ row. This can always reset the scrollTop to 0. Or when a large number of rows
+ is reduced to a smaller number than our current scrollTop but still more than
+ fit on one screen. In that case we can reduce the scrollTop to whatever would
+ scroll the table to its max position.
+
2017-10-04 Matt Baker <[email protected]>
Web Inspector: Improve CanvasManager recording events
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Table.js (222898 => 222899)
--- trunk/Source/WebInspectorUI/UserInterface/Views/Table.js 2017-10-05 06:13:51 UTC (rev 222898)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Table.js 2017-10-05 06:33:56 UTC (rev 222899)
@@ -890,6 +890,21 @@
let numberOfRows = this._dataSource.tableNumberOfRows(this);
this._previousRevealedRowCount = numberOfRows;
+ // Scroll back up if the number of rows was reduced such that the existing
+ // scroll top value is larger than it could otherwise have been. We only
+ // need to do this adjustment if there are more rows than would fit on screen,
+ // because when the filler row activates it will reset our scroll.
+ if (scrollTop) {
+ let rowsThatCanFitOnScreen = Math.ceil(scrollableOffsetHeight / rowHeight);
+ if (numberOfRows >= rowsThatCanFitOnScreen) {
+ let maximumScrollTop = Math.max(0, (numberOfRows * rowHeight) - scrollableOffsetHeight);
+ if (scrollTop > maximumScrollTop) {
+ this._scrollContainerElement.scrollTop = maximumScrollTop;
+ this._cachedScrollTop = maximumScrollTop;
+ }
+ }
+ }
+
let topHiddenRowCount = Math.max(0, Math.floor((scrollTop - overflowPadding) / rowHeight));
let bottomHiddenRowCount = Math.max(0, this._previousRevealedRowCount - topHiddenRowCount - visibleRowCount);
@@ -931,6 +946,13 @@
this._scrollContainerElement.classList.add("not-scrollable");
+ // In the event that we just made the table not scrollable then the number
+ // of rows can fit on screen. Reset the scroll top.
+ if (this._cachedScrollTop) {
+ this._scrollContainerElement.scrollTop = 0;
+ this._cachedScrollTop = 0;
+ }
+
// Extend past edge some reasonable amount. At least 200px.
const paddingPastTheEdge = 200;
this._fillerHeight += paddingPastTheEdge;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes