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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 10
    • Affects Version/s: 8, 9
    • Component/s: 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
          Ajit Ghaisas
        2. Test.java
          3 kB
          Ajit Ghaisas

            Assignee:
            Ajit Ghaisas
            Reporter:
            David Grieve
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: