Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8266966

Wrong CSS properties are applied to other nodes after fix for JDK-8204568

    XMLWordPrintable

Details

    Backports

      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.

        Attachments

          1. AfterHideAndShow.png
            AfterHideAndShow.png
            118 kB
          2. InitialStage.png
            InitialStage.png
            110 kB
          3. styles.css
            0.1 kB
          4. TestCSS.java
            1 kB

          Issue Links

            Activity

              People

                arapte Ambarish Rapte
                jpereda Jose Pereda
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: