changeset 5166:dbcbfaf3abb4

RT-32908: Scrolling mousewheel quickly with virtualised controls can result in incorrect layout of cells Reviewed-by: psomashe
author jgiles
date Wed, 25 Sep 2013 10:01:43 +1200
parents ac217689464d
children a1c13e1ce899
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Tue Sep 24 11:45:49 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Wed Sep 25 10:01:43 2013 +1200
@@ -2082,11 +2082,26 @@
                 positionCell(cell, getCellPosition(cell) - delta);
             }
 
+            // Fix for RT-32908
+            T firstCell = cells.getFirst();
+            double layoutY = firstCell == null ? 0 : getCellPosition(firstCell);
+            for (int i = 0; i < cells.size(); i++) {
+                T cell = cells.get(i);
+                assert cell != null;
+                double actualLayoutY = getCellPosition(cell);
+                if (actualLayoutY != layoutY) {
+                    // we need to shift the cell to layoutY
+                    positionCell(cell, layoutY);
+                }
+
+                layoutY += getCellLength(cell);
+            }
+            // end of fix for RT-32908
+
             // Now throw away any cells that don't fit
             cull();
 
             // Add any necessary leading cells
-            T firstCell = cells.getFirst();
             if (firstCell != null) {
                 int firstIndex = getCellIndex(firstCell);
                 double prevIndexSize = getCellLength(firstIndex - 1);