changeset 1676:b5f7b25bbc50

RT-23873: Only process CSS for new cells.
author Kinsley Wong
date Tue, 21 Aug 2012 13:49:53 -0700
parents beb41249e03b
children 067f7a7ea26e 8130462bc94f
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java	Tue Aug 21 12:18:27 2012 +1200
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/VirtualFlow.java	Tue Aug 21 13:49:53 2012 -0700
@@ -1399,6 +1399,7 @@
         Callback<VirtualFlow,? extends IndexedCell> createCell = getCreateCell();
         if (accumCell == null && createCell != null) {
             accumCell = createCell.call(this);
+            accumCell.getProperties().put(NEW_CELL, null);
             accumCellParent.getChildren().setAll(accumCell);
         }
         setCellIndex(accumCell, index);
@@ -1498,8 +1499,9 @@
         if (cell == null) return;
 
         cell.updateIndex(index);
-        if (cell.isNeedsLayout() && cell.getScene() != null) {
+        if (cell.isNeedsLayout() && cell.getScene() != null && cell.getProperties().containsKey(NEW_CELL)) {
             cell.impl_processCSS(false);
+            cell.getProperties().remove(NEW_CELL);
         }
     }
 
@@ -1510,6 +1512,11 @@
      **************************************************************************/
 
     /**
+     * Indicates that this is a new cell and we need to process CSS for it.
+     */
+    private static final String NEW_CELL = "newcell";
+    
+    /**
      * Get a cell which can be used in the layout. This function will reuse
      * cells from the pile where possible, and will create new cells when
      * necessary.
@@ -1533,6 +1540,7 @@
                 cell = (prefIndex < pile.getFirst().getIndex())? pile.removeLast() : pile.removeFirst();
             } else {
                 cell = createCell.call(this);
+                cell.getProperties().put(NEW_CELL, null);
             }
         }