changeset 10750:39cdd3789f13

8183100: Styles not applied reliably after Java 8u92 Reviewed-by: kcr
author aghaisas
date Thu, 14 Dec 2017 11:49:28 +0530
parents 570f0433e960
children f5e35d7834d4
files modules/javafx.graphics/src/main/java/javafx/scene/Node.java modules/javafx.graphics/src/main/java/javafx/scene/Parent.java modules/javafx.graphics/src/main/java/javafx/scene/Scene.java modules/javafx.graphics/src/main/java/javafx/scene/SubScene.java
diffstat 4 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.graphics/src/main/java/javafx/scene/Node.java	Thu Dec 14 11:34:51 2017 +0530
+++ b/modules/javafx.graphics/src/main/java/javafx/scene/Node.java	Thu Dec 14 11:49:28 2017 +0530
@@ -1055,15 +1055,13 @@
         }
     }
 
-    // reapplyCSS should be true for root elements when they are added, and is false for children
-    // of the root element. This prevents CSS being reapplied recursively, as noted in JDK-8151756.
-    private void invalidatedScenes(Scene oldScene, SubScene oldSubScene, boolean reapplyCSS) {
+    private void invalidatedScenes(Scene oldScene, SubScene oldSubScene) {
         Scene newScene = sceneProperty().get();
         boolean sceneChanged = oldScene != newScene;
         SubScene newSubScene = subScene;
 
         if (getClip() != null) {
-            getClip().setScenes(newScene, newSubScene, reapplyCSS);
+            getClip().setScenes(newScene, newSubScene);
         }
         if (sceneChanged) {
             updateCanReceiveFocus();
@@ -1086,7 +1084,7 @@
         }
         updateTreeShowing();
 
-        if (sceneChanged && reapplyCSS) reapplyCSS();
+        if (sceneChanged) reapplyCSS();
 
         if (sceneChanged && !isDirtyEmpty()) {
             //Note: no need to remove from scene's dirty list
@@ -1145,16 +1143,16 @@
         }
     }
 
-    final void setScenes(Scene newScene, SubScene newSubScene, boolean reapplyCSS) {
+    final void setScenes(Scene newScene, SubScene newSubScene) {
         Scene oldScene = sceneProperty().get();
         if (newScene != oldScene || newSubScene != subScene) {
             scene.set(newScene);
             SubScene oldSubScene = subScene;
             subScene = newSubScene;
-            invalidatedScenes(oldScene, oldSubScene, reapplyCSS);
+            invalidatedScenes(oldScene, oldSubScene);
             if (this instanceof SubScene) { // TODO: find better solution
                 SubScene thisSubScene = (SubScene)this;
-                thisSubScene.getRoot().setScenes(newScene, thisSubScene, reapplyCSS);
+                thisSubScene.getRoot().setScenes(newScene, thisSubScene);
             }
         }
     }
@@ -6953,13 +6951,13 @@
                         } else {
                             if (oldClip != null) {
                                 oldClip.clipParent = null;
-                                oldClip.setScenes(null, null, /* reapplyCSS */ false);
+                                oldClip.setScenes(null, null);
                                 oldClip.updateTreeVisible(false);
                             }
 
                             if (newClip != null) {
                                 newClip.clipParent = Node.this;
-                                newClip.setScenes(getScene(), getSubScene(), /* reapplyCSS */ false);
+                                newClip.setScenes(getScene(), getSubScene());
                                 newClip.updateTreeVisible(true);
                             }
 
--- a/modules/javafx.graphics/src/main/java/javafx/scene/Parent.java	Thu Dec 14 11:34:51 2017 +0530
+++ b/modules/javafx.graphics/src/main/java/javafx/scene/Parent.java	Thu Dec 14 11:49:28 2017 +0530
@@ -373,7 +373,7 @@
                             relayout = true;
                         }
                         node.setParent(Parent.this);
-                        node.setScenes(getScene(), getSubScene(), /* reapplyCSS*/ true);
+                        node.setScenes(getScene(), getSubScene());
                         // assert !node.boundsChanged;
                         if (node.isVisible()) {
                             geomChanged = true;
@@ -606,7 +606,7 @@
                     }
                     if (old.getParent() == Parent.this) {
                         old.setParent(null);
-                        old.setScenes(null, null, /* reapplyCSS*/ false);
+                        old.setScenes(null, null);
                     }
                     // Do not add node with null scene to the removed list.
                     // It will not be processed in the list and its memory
@@ -773,7 +773,7 @@
         }
 
         for (int i=0; i<children.size(); i++) {
-            children.get(i).setScenes(newScene, newSubScene, /* reapplyCSS*/ false);
+            children.get(i).setScenes(newScene, newSubScene);
         }
 
         final boolean awaitingLayout = layoutFlag != LayoutFlags.CLEAN;
--- a/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java	Thu Dec 14 11:34:51 2017 +0530
+++ b/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java	Thu Dec 14 11:49:28 2017 +0530
@@ -1239,11 +1239,11 @@
                     }
 
                     if (oldRoot != null) {
-                        oldRoot.setScenes(null, null, /* reapplyCSS*/ false);
+                        oldRoot.setScenes(null, null);
                     }
                     oldRoot = _value;
                     _value.getStyleClass().add(0, "root");
-                    _value.setScenes(Scene.this, null, /* reapplyCSS*/ true);
+                    _value.setScenes(Scene.this, null);
                     markDirty(DirtyBits.ROOT_DIRTY);
                     _value.resize(getWidth(), getHeight()); // maybe no-op if root is not resizable
                     _value.requestLayout();
--- a/modules/javafx.graphics/src/main/java/javafx/scene/SubScene.java	Thu Dec 14 11:34:51 2017 +0530
+++ b/modules/javafx.graphics/src/main/java/javafx/scene/SubScene.java	Thu Dec 14 11:49:28 2017 +0530
@@ -320,11 +320,11 @@
 
                     if (oldRoot != null) {
                         StyleManager.getInstance().forget(SubScene.this);
-                        oldRoot.setScenes(null, null, /* reapplyCSS*/ false);
+                        oldRoot.setScenes(null, null);
                     }
                     oldRoot = _value;
                     _value.getStyleClass().add(0, "root");
-                    _value.setScenes(getScene(), SubScene.this, /* reapplyCSS*/ true);
+                    _value.setScenes(getScene(), SubScene.this);
                     markDirty(SubSceneDirtyBits.ROOT_SG_DIRTY);
                     _value.resize(getWidth(), getHeight()); // maybe no-op if root is not resizable
                     _value.requestLayout();