Skip to content

Commit bd4a306

Browse files
committed
Revert commit1 and commit 2
1 parent 12ea822 commit bd4a306

File tree

5 files changed

+17
-121
lines changed

5 files changed

+17
-121
lines changed

modules/javafx.graphics/src/main/java/javafx/scene/Node.java

+10-16
Original file line numberDiff line numberDiff line change
@@ -1051,15 +1051,13 @@ public void fireSuperValueChangedEvent() {
10511051
}
10521052
}
10531053

1054-
// reapplyCSS should be true for root elements when they are added, and is false for children
1055-
// of the root element. This prevents CSS being reapplied recursively, as noted in JDK-8151756.
1056-
private void invalidatedScenes(Scene oldScene, SubScene oldSubScene, boolean reapplyCSS) {
1054+
private void invalidatedScenes(Scene oldScene, SubScene oldSubScene) {
10571055
Scene newScene = sceneProperty().get();
10581056
boolean sceneChanged = oldScene != newScene;
10591057
SubScene newSubScene = subScene;
10601058

10611059
if (getClip() != null) {
1062-
getClip().setScenes(newScene, newSubScene, reapplyCSS);
1060+
getClip().setScenes(newScene, newSubScene);
10631061
}
10641062
if (sceneChanged) {
10651063
updateCanReceiveFocus();
@@ -1093,9 +1091,7 @@ private void invalidatedScenes(Scene oldScene, SubScene oldSubScene, boolean rea
10931091
}
10941092
updateTreeShowing();
10951093

1096-
if (sceneChanged && reapplyCSS) {
1097-
reapplyCSS();
1098-
}
1094+
if (sceneChanged) reapplyCSS();
10991095

11001096
if (sceneChanged && !isDirtyEmpty()) {
11011097
//Note: no need to remove from scene's dirty list
@@ -1154,16 +1150,16 @@ private void invalidatedScenes(Scene oldScene, SubScene oldSubScene, boolean rea
11541150
}
11551151
}
11561152

1157-
final void setScenes(Scene newScene, SubScene newSubScene, boolean reapplyCSS) {
1153+
final void setScenes(Scene newScene, SubScene newSubScene) {
11581154
Scene oldScene = sceneProperty().get();
11591155
if (newScene != oldScene || newSubScene != subScene) {
11601156
scene.set(newScene);
11611157
SubScene oldSubScene = subScene;
11621158
subScene = newSubScene;
1163-
invalidatedScenes(oldScene, oldSubScene, reapplyCSS);
1159+
invalidatedScenes(oldScene, oldSubScene);
11641160
if (this instanceof SubScene) { // TODO: find better solution
11651161
SubScene thisSubScene = (SubScene)this;
1166-
thisSubScene.getRoot().setScenes(newScene, thisSubScene, reapplyCSS);
1162+
thisSubScene.getRoot().setScenes(newScene, thisSubScene);
11671163
}
11681164
}
11691165
}
@@ -1184,10 +1180,8 @@ public final ReadOnlyObjectProperty<Scene> sceneProperty() {
11841180
* Exists for Parent and LightBase
11851181
*/
11861182
void scenesChanged(final Scene newScene, final SubScene newSubScene,
1187-
final Scene oldScene, final SubScene oldSubScene) {
1188-
// On scenes change, reapply CSS for this Node
1189-
reapplyCSS();
1190-
}
1183+
final Scene oldScene, final SubScene oldSubScene) { }
1184+
11911185

11921186
/**
11931187
* The id of this {@code Node}. This simple string identifier is useful for
@@ -6982,13 +6976,13 @@ protected void invalidated() {
69826976
} else {
69836977
if (oldClip != null) {
69846978
oldClip.clipParent = null;
6985-
oldClip.setScenes(null, null, /* reapplyCSS */ false);
6979+
oldClip.setScenes(null, null);
69866980
oldClip.updateTreeVisible(false);
69876981
}
69886982

69896983
if (newClip != null) {
69906984
newClip.clipParent = Node.this;
6991-
newClip.setScenes(getScene(), getSubScene(), /* reapplyCSS */ false);
6985+
newClip.setScenes(getScene(), getSubScene());
69926986
newClip.updateTreeVisible(true);
69936987
}
69946988

modules/javafx.graphics/src/main/java/javafx/scene/Parent.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ protected void onChanged(Change<Node> c) {
368368
relayout = true;
369369
}
370370
node.setParent(Parent.this);
371-
node.setScenes(getScene(), getSubScene(), /* reapplyCSS */ true);
371+
node.setScenes(getScene(), getSubScene());
372372
// assert !node.boundsChanged;
373373
if (node.isVisible()) {
374374
geomChanged = true;
@@ -601,7 +601,7 @@ protected void onProposedChange(final List<Node> newNodes, int[] toBeRemoved) {
601601
}
602602
if (old.getParent() == Parent.this) {
603603
old.setParent(null);
604-
old.setScenes(null, null, /* reapplyCSS */ false);
604+
old.setScenes(null, null);
605605
}
606606
// Do not add node with null scene to the removed list.
607607
// It will not be processed in the list and its memory
@@ -756,7 +756,6 @@ final void toBack(Node node) {
756756
@Override
757757
void scenesChanged(final Scene newScene, final SubScene newSubScene,
758758
final Scene oldScene, final SubScene oldSubScene) {
759-
super.scenesChanged(newScene, newSubScene, oldScene, oldSubScene);
760759

761760
if (oldScene != null && newScene == null) {
762761
// RT-34863 - clean up CSS cache when Parent is removed from scene-graph
@@ -769,7 +768,7 @@ void scenesChanged(final Scene newScene, final SubScene newSubScene,
769768
}
770769

771770
for (int i=0; i<children.size(); i++) {
772-
children.get(i).setScenes(newScene, newSubScene, /* reapplyCSS */ false);
771+
children.get(i).setScenes(newScene, newSubScene);
773772
}
774773

775774
final boolean awaitingLayout = layoutFlag != LayoutFlags.CLEAN;
@@ -788,7 +787,6 @@ void scenesChanged(final Scene newScene, final SubScene newSubScene,
788787
}
789788
}
790789
}
791-
792790
}
793791

794792
@Override

modules/javafx.graphics/src/main/java/javafx/scene/Scene.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1218,11 +1218,11 @@ protected void invalidated() {
12181218
}
12191219

12201220
if (oldRoot != null) {
1221-
oldRoot.setScenes(null, null, /* reapplyCSS */ false);
1221+
oldRoot.setScenes(null, null);
12221222
}
12231223
oldRoot = _value;
12241224
_value.getStyleClass().add(0, "root");
1225-
_value.setScenes(Scene.this, null, /* reapplyCSS */ true);
1225+
_value.setScenes(Scene.this, null);
12261226
markDirty(DirtyBits.ROOT_DIRTY);
12271227
_value.resize(getWidth(), getHeight()); // maybe no-op if root is not resizable
12281228
_value.requestLayout();

modules/javafx.graphics/src/main/java/javafx/scene/SubScene.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ protected void invalidated() {
313313

314314
if (oldRoot != null) {
315315
StyleManager.getInstance().forget(SubScene.this);
316-
oldRoot.setScenes(null, null, /* reapplyCSS */ false);
316+
oldRoot.setScenes(null, null);
317317
}
318318
oldRoot = _value;
319319
_value.getStyleClass().add(0, "root");
320-
_value.setScenes(getScene(), SubScene.this, /* reapplyCSS */ true);
320+
_value.setScenes(getScene(), SubScene.this);
321321
markDirty(SubSceneDirtyBits.ROOT_SG_DIRTY);
322322
_value.resize(getWidth(), getHeight()); // maybe no-op if root is not resizable
323323
_value.requestLayout();

tests/system/src/test/java/test/robot/javafx/scene/CSSPerf_JDK8193445Test.java

-96
This file was deleted.

0 commit comments

Comments
 (0)