diff -r 6a30ae549629 modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Wed Oct 16 13:11:04 2013 +0200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualFlow.java	Fri Oct 18 09:21:34 2013 +0200
@@ -125,6 +125,8 @@
      * horizontally next to each other.
      */
     private BooleanProperty vertical;
+    private double sumCellLength;
+
     public final void setVertical(boolean value) {
         verticalProperty().set(value);
     }
@@ -1063,7 +1065,7 @@
             
             // The distance from the top of the viewport to the top of the
             // cell for the current index.
-            double offset = -computeViewportOffset(getPosition());
+            double offset = computeViewportOffset(getPosition());
             
             // Add all the leading and trailing cells (the call to add leading
             // cells will add the current cell as well -- that is, the one that
@@ -1397,7 +1399,6 @@
         // Toggle visibility on the corner
         corner.setVisible(breadthBar.isVisible() && lengthBar.isVisible());
 
-        double sumCellLength = 0;
         double flowLength = (isVertical ? getHeight() : getWidth()) -
             (breadthBar.isVisible() ? breadthBar.prefHeight(-1) : 0);
 
@@ -1448,28 +1449,16 @@
         if (lengthBar.isVisible()) {
             // determine how many cells there are on screen so that the scrollbar
             // thumb can be appropriately sized
-            int numCellsVisibleOnScreen = 0;
-            for (int i = 0, max = cells.size(); i < max; i++) {
-                T cell = cells.get(i);
-                if (cell != null && ! cell.isEmpty()) {
-                    sumCellLength += (isVertical ? cell.getHeight() : cell.getWidth());
-                    if (sumCellLength > flowLength) {
-                        break;
-                    }
 
-                    numCellsVisibleOnScreen++;
-                }
+            sumCellLength = 0;
+
+            for (int i = 0; i < cellCount; i++) {
+                sumCellLength += getCellLength(i);
             }
 
             lengthBar.setMax(1);
-            if (numCellsVisibleOnScreen == 0 && cellCount == 1) {
-                // special case to help resolve RT-17701 and the case where we have
-                // only a single row and it is bigger than the viewport
-                lengthBar.setVisibleAmount(flowLength / sumCellLength);
-            } else {
-                lengthBar.setVisibleAmount(numCellsVisibleOnScreen / (float) cellCount);
-            }
-            
+            lengthBar.setVisibleAmount(flowLength / sumCellLength);
+
 
             // Fix for RT-11873. If this isn't here, we can have a situation where
             // the scrollbar scrolls endlessly. This is possible when the cell
@@ -1612,7 +1601,10 @@
         }
 
         if (pile.size() > 0) {
-            return pile.get(0);
+            T cell = pile.get(0);
+            cell.updateIndex(index);
+            resizeCellSize(cell);
+            return cell;
         }
 
         // We need to use the accumCell and return that
@@ -1672,8 +1664,8 @@
         if (fixedCellSizeEnabled) return fixedCellSize;
 
         return isVertical() ?
-            cell.getLayoutBounds().getHeight()
-            : cell.getLayoutBounds().getWidth();
+            cell.getHeight()
+            : cell.getWidth();
     }
 
 //    private double getCellPrefLength(T cell) {
@@ -2111,7 +2103,7 @@
 
                 // The distance from the top of the viewport to the top of the
                 // cell for the current index.
-                double offset = -computeViewportOffset(getPosition());
+                double offset = computeViewportOffset(getPosition());
 
                 // Add all the leading and trailing cells (the call to add leading
                 // cells will add the current cell as well -- that is, the one that
@@ -2240,13 +2232,9 @@
      */
     private double computeViewportOffset(double position) {
         double p = com.sun.javafx.Utils.clamp(0, position, 1);
-        double fractionalPosition = p * getCellCount();
-        int cellIndex = (int) fractionalPosition;
-        double fraction = fractionalPosition - cellIndex;
-        double cellSize = getCellLength(cellIndex);
-        double pixelOffset = cellSize * fraction;
-        double viewportOffset = getViewportLength() * p;
-        return pixelOffset - viewportOffset;
+        double itempos = positionOfItemAt(p);
+        return (itempos - p) * sumCellLength;
+
     }
 
     private void adjustPositionToIndex(int index) {
@@ -2267,77 +2255,36 @@
      */
     private void adjustByPixelAmount(double numPixels) {
         if (numPixels == 0) return;
-        // Starting from the current cell, we move in the direction indicated
-        // by numPixels one cell at a team. For each cell, we discover how many
-        // pixels the "position" line would move within that cell, and adjust
-        // our count of numPixels accordingly. When we come to the "final" cell,
-        // then we can take the remaining number of pixels and multiply it by
-        // the "travel rate" of "p" within that cell to get the delta. Add
-        // the delta to "p" to get position.
+        setPosition(getPosition() + numPixels / sumCellLength);
+    }
 
-        // get some basic info about the list and the current cell
-        boolean forward = numPixels > 0;
-        int cellCount = getCellCount();
-        double fractionalPosition = getPosition() * cellCount;
-        int cellIndex = (int) fractionalPosition;
-        if (forward && cellIndex == cellCount) return;
-        double cellSize = getCellLength(cellIndex);
-        double fraction = fractionalPosition - cellIndex;
-        double pixelOffset = cellSize * fraction;
+    private int positionToIndex(double pos) {
+        double sum = 0;
+        double reference = pos * sumCellLength;
+        for (int i = 0; i < cellCount; ++i) {
+            sum += getCellLength(i);
+            if (sum > reference) {
+                return i;
+            }
+        }
+        return cellCount;
+    }
 
-        // compute the percentage of "position" that represents each cell
-        double cellPercent = 1.0 / cellCount;
-
-        // To help simplify the algorithm, we pretend as though the current
-        // position is at the beginning of the current cell. This reduces some
-        // of the corner cases and provides a simpler algorithm without adding
-        // any overhead to performance.
-        double start = computeOffsetForCell(cellIndex);
-        double end = cellSize + computeOffsetForCell(cellIndex + 1);
-
-        // We need to discover the distance that the fictional "position line"
-        // would travel within this cell, from its current position to the end.
-        double remaining = end - start;
-
-        // Keep track of the number of pixels left to travel
-        double n = forward ?
-              numPixels + pixelOffset - (getViewportLength() * getPosition()) - start
-            : -numPixels + end - (pixelOffset - (getViewportLength() * getPosition()));
-
-        // "p" represents the most recent value for position. This is always
-        // based on the edge between two cells, except at the very end of the
-        // algorithm where it is added to the computed "p" offset for the final
-        // value of Position.
-        double p = cellPercent * cellIndex;
-
-        // Loop over the cells one at a time until either we reach the end of
-        // the cells, or we find that the "n" will fall within the cell we're on
-        while (n > remaining && ((forward && cellIndex < cellCount - 1) || (! forward && cellIndex > 0))) {
-            if (forward) cellIndex++; else cellIndex--;
-            n -= remaining;
-            cellSize = getCellLength(cellIndex);
-            start = computeOffsetForCell(cellIndex);
-            end = cellSize + computeOffsetForCell(cellIndex + 1);
-            remaining = end - start;
-            p = cellPercent * cellIndex;
+    private double positionOfItemAt(double pos) {
+        double sum = 0;
+        double reference = pos * sumCellLength;
+        for (int i = 0; i < cellCount; ++i) {
+            double cellLength = getCellLength(i);
+            if (sum + cellLength > reference) {
+                return sum / sumCellLength;
+            }
+            sum += cellLength;
         }
-
-        // if remaining is < n, then we must have hit an end, so as a
-        // fast path, we can just set position to 1.0 or 0.0 and return
-        // because we know we hit the end
-        if (n > remaining) {
-            setPosition(forward ? 1.0f : 0.0f);
-        } else if (forward) {
-            double rate = cellPercent / Math.abs(end - start);
-            setPosition(p + (rate * n));
-        } else {
-            double rate = cellPercent / Math.abs(end - start);
-            setPosition((p + cellPercent) - (rate * n));
-        }
+        return sum / sumCellLength;
     }
 
     private int computeCurrentIndex() {
-        return (int) (getPosition() * getCellCount());
+        return positionToIndex(getPosition());
     }
 
     /**
