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

CSS performance: Link style helpers together to avoid going through parent chain looking for parent style helpers

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 10
    • 8, 9
    • javafx

    Description

      Typical code in CssStyleHelper is

      Styleable parent = node.getStyleableParent();
      CssStyleHelper styleHelper = this;
      while (parent != null) {
         styleHelper = parent instanceof Node ? ((Node)parent).styleHelper : null;
         if (styleHelper != null) break;
         parent = parent.getStyleableParent();
      }

      If you are deep in the scene graph, it may be that you get to the Control and have to go through several parents to get to the root style helper. If CssStyleHelper had a ref to a parent CssStyleHelper, then this code is just.

      CssStyleHelper styleHelper = this.getParentStyleHelper();

      Maybe parent isn't such a good name for it. Maybe "upstream"?

      Attachments

        1. Main.java
          2 kB
          Ajit Ghaisas
        2. Test.java
          3 kB
          Ajit Ghaisas

        Issue Links

          Activity

            People

              aghaisas Ajit Ghaisas
              dgrieve David Grieve
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: