JDK-8266966 : Wrong CSS properties are applied to other nodes after fix for JDK-8204568
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: openjfx11.0.12,8u301,openjfx17
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-12
  • Updated: 2021-06-01
  • Resolved: 2021-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8u301Fixed openjfx11.0.12Fixed
Related Reports
Relates :  
Description
After JDK-8204568 was integrated, running with 17-ea+3 or later, under certain conditions it happens that some nodes get wrong CSS properties from other nodes.

The attached test case shows that after hiding the stage, when showing it again the Labels after the Button take the button's padding and background properties.

The test sets by CSS a font size different than 13 px (default for labeled controls). Using 13 px or removing it works fine. 

Also, a Button and some other controls like a CheckBox, a ComboBox or a Spinner are required in the scene.

After pressing the button, that simply hides and shows the stage again (see AfterHideAndShow attached pic), the logs from CssStyleHelper::recalculateRelativeSizeProperties show that these properties are wrongly set for Label "Text 2" (also for "Text 4"):

-fx-padding, call applyStyle: ObjectProperty [bean: Label@5cc81f36[styleClass=label]'Text 2', name: padding, value: Insets [top=0.0, right=0.0, bottom=0.0, left=0.0]], value =Insets [top=4.3, right=8.7, bottom=4.3, left=8.7], originOfCalculatedValue=USER_AGENT
-fx-region-background, call applyStyle: ObjectProperty [bean: Label@5cc81f36[styleClass=label]'Text 2', name: background, value: null], value =javafx.scene.layout.Background@4d573d15, originOfCalculatedValue=USER_AGENT

Running with 17-ea+2 or lower, or reverting the fix for JDK-8204568, solves the issue.
Comments
Changeset: 93de5840 Author: Ambarish Rapte <arapte@openjdk.org> Date: 2021-05-18 03:29:29 +0000 URL: https://git.openjdk.java.net/jfx/commit/93de5840b19868fbe8850b846418c3f6f72df256
18-05-2021

Issue does not occur when style is set using setStyle("-fx-font-size: 15px;") method.
13-05-2021