Skip to content

Commit 10f41b7

Browse files
author
Johan Vos
committed
8293836: Rendering performance degradation at bottom of TableView with many rows
Reviewed-by: angorya, kcr
1 parent 1a0f6c7 commit 10f41b7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,8 +1998,6 @@ protected void resizeCell(T cell) {
19981998
double height = Math.max(getMaxPrefBreadth(), getViewportBreadth());
19991999
cell.resize(fixedCellSizeEnabled ? getFixedCellSize() : Utils.boundedSize(cell.prefWidth(height), cell.minWidth(height), cell.maxWidth(height)), height);
20002000
}
2001-
// when a cell is resized, our estimate needs to be updated.
2002-
recalculateAndImproveEstimatedSize(0);
20032001
}
20042002

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

31093104
if (itemSizeCache.size() > cellIndex) {
31103105
Double oldSize = itemSizeCache.get(cellIndex);
31113106
double newSize = isVertical() ? cell.getLayoutBounds().getHeight() : cell.getLayoutBounds().getWidth();
31123107
itemSizeCache.set(cellIndex, newSize);
3113-
if ((cellIndex == currentIndex) && (oldSize != null) && (oldOffset != 0)) {
3114-
oldOffset = oldOffset + newSize - oldSize;
3108+
if ((oldSize != null) && !oldSize.equals(newSize)) {
3109+
int currentIndex = computeCurrentIndex();
3110+
double oldOffset = computeViewportOffset(getPosition());
3111+
if ((cellIndex == currentIndex) && (oldOffset != 0)) {
3112+
oldOffset = oldOffset + newSize - oldSize;
3113+
}
3114+
recalculateAndImproveEstimatedSize(0, currentIndex, oldOffset);
31153115
}
31163116
}
3117-
recalculateAndImproveEstimatedSize(0, currentIndex, oldOffset);
31183117
}
31193118

31203119
/**

0 commit comments

Comments
 (0)