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

CSS throws a lot of warnings: "javafx.scene.CssStyleHelper calculateValue"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • 8
    • 8
    • javafx
    • None

    Description

      From an email discussion with David:

      On Saturday, 25 May 2013 10:42:02 a.m., Jonathan Giles wrote:
      > I tried both of your suggestions. The first one led to a blank UI (I
      > probably misintepreted what you requested). Fortunately, the second
      > suggestion (impl_processCSS(true) rather than impl_reapplyCSS())
      > appears to fix the issue - I no longer see any warnings on the console
      > and my controls look like they should (which they have done all along,
      > they were just very noisy about it :-)).
      >
      > Does this get you any closer to thinking there is a bug / regression
      > here? Is there anything else I can look into for you?
      > -- Jonathan
      >
      > On 25/05/2013 2:00 a.m., David Grieve wrote:
      >> The warnings are certainly annoying, but are the styles broken?
      >>
      >> On May 23, 2013, at 1:38 AM, Jonathan Giles
      >> <jonathan.giles@oracle.com <mailto:jonathan.giles@oracle.com>> wrote:
      >>
      >>> I've done a bit more looking into this this evening, and can't quite
      >>> understand what I'm seeing... To summarise:
      >>>
      >>> 1. Currently the control overrides getUserAgentStyleSheet and this
      >>> works fine - the control is styled as expected (except it prints
      >>> all the console output).
      >>> 2. If I comment out this overridden method and instead simply add
      >>> StyleManager.getInstance().addUserAgentStylesheet(...) into the
      >>> constructor, everything styles properly and I don't see the css
      >>> warnings.
      >>>
      >> This makes me wonder if there is a bug in the StyleManager code that
      >> handles UA stylesheets. StyleManager keeps a list of UA stylesheets
      >> and reserves the zeroth element for the default UA stylesheet. It
      >> should be that the stylesheet from getUserAgentStyleSheet is added to
      >> the list (if it isn't already in the list) and then the styles are
      >> reapplied.
      >>
      >> But as I'm typing this I'm realizing that it could be that the
      >> StyleManager is clearing out its cache because of the added UA
      >> stylesheet. This would leave .root with no styles while at the same
      >> time your control is being styled.
      >>
      >> Try this. In Control#impl_processCSS(), simply return after the call
      >> to addUserAgentStylesheet.
      >> Another thing to try (because I'm have little confidence in my first
      >> suggestion) is in StyleManager#userAgentStylesheetsChanged, change
      >> the call to scene.getRoot().impl_reapplyCSS() to
      >> scene.getRoot().impl_processCSS(true).
      >>
      >> I'm not saying either of these is the right fix, but I think it would
      >> prove out my assumption. Ultimately, I think the stylesheet from
      >> getUserAgentStylesheet should affect only controls of that type and
      >> not the whole scene graph. I mean, it is possible to totally change
      >> the styles of everything simply by adding a ua stylesheet to a control.
      >>
      >>
      >>> 3. My test application places the control inside an HBox, and the
      >>> HBox into the Scene. I note that the HBox is given the style
      >>> class of .root. When the application runs like this, I see the
      >>> console warnings
      >>> 4. If I change my test application to place my control directly as
      >>> the root of the scene, then it runs fine and no warnings are
      >>> printed. Of course, it is laid out incorrectly.
      >>> 5. I'm also able to fix this issue by changing how my skin is
      >>> instantiated. It doesn't work in the 'old way' where the skin
      >>> constructor immediately adds the children into the scenegraph.
      >>> However, if I change the code to instead add the children into
      >>> the scenegraph in the layoutChildren() method everything works fine.
      >>> 6. Even if I fix the issue in one of my controls, I can see the
      >>> same problem in other areas (e.g. TabPane).
      >>>
      >>> In short, I'm fairly well confused as to what is going on here I
      >>> can't seem to find any particular changeset where everything broke,
      >>> so I'm not sure why things are playing up now. Do you have any
      >>> further thoughts on how I can work out what is wrong here?
      >>>
      >>> Thanks,
      >>> Jonathan
      >>>
      >>> On 23/05/2013 5:36 a.m., David Grieve wrote:
      >>>> This could be because the "root" of the scene hasn't had css applied yet. When css tries to resolve the lookups, it should find these values in styles that match .root. If .root doesn't have any styles mapped to it yet, then you'll get these errors. Another possible scenario is that the styleHelper for the .root node has been blown away while a child is processing css. As always, calls to impl_processCSS(true) are suspect.
      >>>>
      >>>>
      >>>> On May 22, 2013, at 4:13 AM, Jonathan Giles<jonathan.giles@oracle.com> wrote:
      >>>>
      >>>>> Hey David,
      >>>>>
      >>>>> I'm seeing a bunch of warnings in my ControlsFX side project which seem to have come out of nowhere. I can go back in history to see if they appeared with any particular change in ControlsFX, but my gut feeling is that they appeared after updating to a newer build of JavaFX 8.0. Do you have any pointers on how to resolve, or are these CSS issues that you're aware of?
      >>>>>
      >>>>> The warning text is long, but I've reproduced it below for your edutainment:
      >>>>>
      >>>>> May 22, 2013 8:11:01 PM javafx.scene.CssStyleHelper calculateValue
      >>>>> WARNING: Could not resolve '-fx-outer-border' while resolving lookups for '-fx-border-color' from rule '*.segmented-button *.toggle-button' in stylesheetfile:/C:/programming/netbeans/controlsfx/bin/org/controlsfx/control/segmentedbutton.css
      >>>>> May 22, 2013 8:11:01 PM javafx.scene.CssStyleHelper calculateValue
      >>>>> WARNING: Could not resolve '-fx-shadow-highlight-color' while resolving lookups for '-fx-background-color' from rule '*.segmented-button *.toggle-button:selected' in stylesheetfile:/C:/programming/netbeans/controlsfx/bin/org/controlsfx/control/segmentedbutton.css

      Attachments

        Issue Links

          Activity

            People

              dgrieve David Grieve
              jgiles Jonathan Giles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: