changeset 6955:2dd37489bbc3

RT-36838 - don't reapply CSS in the middle of an update or reapply Reviewed by: jonathan, martin
author David Grieve<david.grieve@oracle.com>
date Tue, 06 May 2014 08:41:12 -0400
parents f08c40c607dd
children 9c09a4284e91
files modules/graphics/src/main/java/javafx/scene/Node.java
diffstat 1 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/javafx/scene/Node.java	Tue May 06 11:32:40 2014 +0400
+++ b/modules/graphics/src/main/java/javafx/scene/Node.java	Tue May 06 08:41:12 2014 -0400
@@ -26,6 +26,7 @@
 package javafx.scene;
 
 
+import javafx.application.Platform;
 import javafx.beans.InvalidationListener;
 import javafx.beans.Observable;
 import javafx.beans.binding.BooleanExpression;
@@ -961,7 +962,13 @@
 
                 @Override
                 protected void invalidated() {
-                    impl_reapplyCSS();
+                    // RT-36838 - don't reapply CSS in the middle of an update or reapply
+                    if ((cssFlag == CssFlags.UPDATE) || (cssFlag == CssFlags.REAPPLY)) {
+                        Platform.runLater(()->impl_reapplyCSS());
+                    }
+                    else {
+                        impl_reapplyCSS();
+                    }
                     if (PrismSettings.printRenderGraph) {
                         impl_markDirty(DirtyBits.DEBUG);
                     }
@@ -994,7 +1001,13 @@
     private ObservableList<String> styleClass = new TrackableObservableList<String>() {
         @Override
         protected void onChanged(Change<String> c) {
-            impl_reapplyCSS();
+            // RT-36838 - don't reapply CSS in the middle of an update or reapply
+            if ((cssFlag == CssFlags.UPDATE) || (cssFlag == CssFlags.REAPPLY)) {
+                Platform.runLater(()->impl_reapplyCSS());
+            }
+            else {
+                impl_reapplyCSS();
+            }
         }
 
         @Override
@@ -1079,7 +1092,13 @@
                 protected void invalidated() {
                     // If the style has changed, then styles of this node
                     // and child nodes might be affected.
-                    impl_reapplyCSS();
+                    // RT-36838 - don't reapply CSS in the middle of an update or reapply
+                    if ((cssFlag == CssFlags.UPDATE) || (cssFlag == CssFlags.REAPPLY)) {
+                        Platform.runLater(()->impl_reapplyCSS());
+                    }
+                    else {
+                        impl_reapplyCSS();
+                    }
                 }
 
                 @Override