Skip to content

Commit

Permalink
8293836: Rendering performance degradation at bottom of TableView wit…
Browse files Browse the repository at this point in the history
…h many rows

Backport-of: 10f41b7
Jose Pereda committed Sep 6, 2023
1 parent a90a028 commit 514dfae
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1998,8 +1998,6 @@ protected void resizeCell(T cell) {
double height = Math.max(getMaxPrefBreadth(), getViewportBreadth());
cell.resize(fixedCellSizeEnabled ? getFixedCellSize() : Utils.boundedSize(cell.prefWidth(height), cell.minWidth(height), cell.maxWidth(height)), height);
}
// when a cell is resized, our estimate needs to be updated.
recalculateAndImproveEstimatedSize(0);
}

/**
@@ -3102,19 +3100,20 @@ private double getOrCreateCellSize (int idx, boolean create) {
*/
void updateCellSize(T cell) {
int cellIndex = cell.getIndex();
int currentIndex = computeCurrentIndex();
double oldOffset = computeViewportOffset(getPosition());


if (itemSizeCache.size() > cellIndex) {
Double oldSize = itemSizeCache.get(cellIndex);
double newSize = isVertical() ? cell.getLayoutBounds().getHeight() : cell.getLayoutBounds().getWidth();
itemSizeCache.set(cellIndex, newSize);
if ((cellIndex == currentIndex) && (oldSize != null) && (oldOffset != 0)) {
oldOffset = oldOffset + newSize - oldSize;
if ((oldSize != null) && !oldSize.equals(newSize)) {
int currentIndex = computeCurrentIndex();
double oldOffset = computeViewportOffset(getPosition());
if ((cellIndex == currentIndex) && (oldOffset != 0)) {
oldOffset = oldOffset + newSize - oldSize;
}
recalculateAndImproveEstimatedSize(0, currentIndex, oldOffset);
}
}
recalculateAndImproveEstimatedSize(0, currentIndex, oldOffset);
}

/**

1 comment on commit 514dfae

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.