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

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

      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"?

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

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

              Created:
              Updated:
              Resolved:
              Imported: