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

StyleHelper.transitionToState doesn't properly handle CSS key lists containing multiple Type.FONT keys

XMLWordPrintable

      While chasing down a problem where changes to the .scene -fx-font
      was not resulting in a change in the font size of sliders with labeled
      tick marks, I ran into a bit of code in StyleHelper.transitionToState that
      does this:

              // First we want to lookup the font associated with the Node in its
              // current state so that all subsequent font-related sizes will be
              // correct.
              def keys:Key[] = node.impl_cssKeys();
              var fontKey = DEFAULT_FONT_KEY;
              for (key in keys) {
                  if (key.type == Type.FONT) {
                      fontKey = key;
                      break;
                  }
              }

      It appears to be trying to find the base font for the Node. Some controls,
      however, define multiple keys of Type.FONT. Axis, for example does this:

      public def impl_CSS_KEYS:Key[] = [
          Node.impl_CSS_KEYS,
      ...
          Key.FONT("-fx-label", Stylesheet.INHERIT),
      ...
          Key.FONT("-fx-tick-label", Stylesheet.INHERIT),
      ...
      ];

      As a result, the code in StyleHelper.transitionToState may not always be
      doing what was intended.

      I have no great thoughts on this one.

            dgrieve David Grieve
            wwalkerwse Willie Walker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: