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

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 10
    • Component/s: javafx
    • Labels:

      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
        2. Test.java
          3 kB

          Issue Links

            Activity

              People

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

                Dates

                Due:
                Created:
                Updated:
                Resolved:
                Imported: