changeset 6732:f8f8ab5638cf

RT-36672: move code to process css during layout back to impl_reapplyCSS, which is where it was priort to RT-36559
author David Grieve<david.grieve@oracle.com>
date Tue, 15 Apr 2014 11:51:38 -0400
parents a76f2fa17b56
children 3438cbe3ac87
files modules/graphics/src/main/java/javafx/scene/Node.java modules/graphics/src/main/java/javafx/scene/Parent.java
diffstat 2 files changed, 17 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/javafx/scene/Node.java	Mon Apr 14 17:32:24 2014 -0400
+++ b/modules/graphics/src/main/java/javafx/scene/Node.java	Tue Apr 15 11:51:38 2014 -0400
@@ -8737,10 +8737,6 @@
         // createStyleHelper returned the same styleHelper
         final CssStyleHelper oldStyleHelper = styleHelper;
 
-        // Hang on to current cssFlags in case we have to
-        // set the state back to what it was.
-        final CssFlags oldCssFlag = cssFlag;
-
         // CSS state is "REAPPLY"
         cssFlag = CssFlags.REAPPLY;
 
@@ -8756,15 +8752,11 @@
 
             if (visitChildren) {
 
-                List<Node> children = ((Parent)this).getChildren();
-                for(int n=0, nMax=children.size(); n<nMax; n++) {
+                List<Node> children = ((Parent) this).getChildren();
+                for (int n = 0, nMax = children.size(); n < nMax; n++) {
                     Node child = children.get(n);
                     child.impl_reapplyCSS();
                 }
-
-            } else {
-                cssFlag = oldCssFlag;
-                return;
             }
 
         } else if (styleHelper == null) {
@@ -8776,9 +8768,22 @@
             return;
         }
 
-        // this branch needs update
         cssFlag = CssFlags.UPDATE;
-        notifyParentsOfInvalidatedCSS();
+
+        //
+        // One idiom employed by developers is to, during the layout pass,
+        // add or remove nodes from the scene. For example, a ScrollPane
+        // might add scroll bars to itself if it determines during layout
+        // that it needs them, or a ListView might add cells to itself if
+        // it determines that it needs to. In such situations we must
+        // apply the CSS immediately and not add it to the scene's queue
+        // for deferred action.
+        //
+        if (getParent() != null && getParent().performingLayout) {
+            impl_processCSS(null);
+        } else {
+            notifyParentsOfInvalidatedCSS();
+        }
 
     }
 
--- a/modules/graphics/src/main/java/javafx/scene/Parent.java	Mon Apr 14 17:32:24 2014 -0400
+++ b/modules/graphics/src/main/java/javafx/scene/Parent.java	Tue Apr 15 11:51:38 2014 -0400
@@ -1071,23 +1071,6 @@
                     break;
                 }
                 performingLayout = true;
-                //
-                // One idiom employed by developers is to, during the layout pass,
-                // add or remove nodes from the scene. For example, a ScrollPane
-                // might add scroll bars to itself if it determines during layout
-                // that it needs them, or a ListView might add cells to itself if
-                // it determines that it needs to. In such situations we must
-                // apply the CSS immediately and not add it to the scene's queue
-                // for deferred action.
-                //
-                // Note that we only call processCSS if the flag is update. If the
-                // flag is DIRTY_BRANCH, then the whatever children need UPDATE
-                // will be visited during this layout anyway. On the next pulse,
-                // doCSSPass will clean up the DIRTY_BRANCH nodes.
-                //
-                if (cssFlag == CssFlags.UPDATE) {
-                    processCSS();
-                }
                 layoutChildren();
                 // Intended fall-through
             case DIRTY_BRANCH: