Re: CSS warning

2014-10-21 Thread David Grieve
JavaFX CSS has a 'lookup' feature that allows you to declare the value 
of a property as another property. For example, the -fx-base property 
defines the base color of the modena theme (the same goes for caspian). 
When a css value is calculated, these looked-up properties have to be 
resolved to a real value. The code looks for matching styles starting 
with the current node and going up the parent chain to the root of the 
scene-graph until it finds a value that doesn't need to be further 
resolved.  If the value isn't resolved, then this message is printed out.


Resolving a lookup value is dependent on a node's parents having already 
been processed by CSS. If, for example, -fx-base is in .root and the 
root of the scene-graph hasn't been processed by CSS, the root node will 
not have any styles and the lookup will fail. The CSS code tries to 
ensure that CSS is always processed from the root down and also tries to 
ensure that the CSS state of parent nodes is not dirty when CSS is 
processed on a child node.


When new styles are added to the scene-graph, from adding a stylesheet 
to the scene or adding a user-agent stylesheet, CSS is reapplied to the 
scene-graph. This means that all the matching styles and calculated 
values are thrown away and re-evaluated from scratch. In 8u20, adding a 
stylesheet to a control via the Control method getUserAgentStylesheet() 
will cause this to happen. So I think what is happening here is that the 
getUserAgentStylesheet() call happens in the middle of CSS being 
processed on the Control; thus, the CSS for the parent nodes of the 
control will all be tossed out and the lookups will fail. This all 
settles out in the next CSS pass, which is why you don't see an issue 
with the look.


There was some work done in 8u40 improve the handling of reapplying CSS. 
There were also some changes to getUserAgentStylesheet() so that it only 
affects the control and not the whole scene-graph. Try 8u40 and see if 
that doesn't help. If you still get these warnings on 8u40, then please 
create a bug in jira.


On 10/21/14, 2:10 AM, Tom Eugelink wrote:
Has anyone every figured out what the cause is of these CSS warnings I 
get? They do not seem to influence the look at all, and since I copied 
the styling from moderna.css, they do not seem to be valid either. I 
suspect it may have to do with a different handling of CSS and that I 
cannot reuse stuff defined in moderna? Because if I take the first 
error; -fx-focus-color is defined in moderna.css.


Tom

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-focus-color' while resolving lookups 
for '-fx-background-color' from rule '*.ListSpinnerSkin' in stylesheet 
file:/C:/Users/user/Documents/jfxtras/jfxtras-controls/_build/jfxtras/internal/scene/control/ListSpinner.css

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving 
lookups for '-fx-text-fill' from rule '*.label' in stylesheet 
jar:file:/C:/Program%20Files%20(x86)/Java/jre1.8.0_20/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving 
lookups for '-fx-text-fill' from rule '*.label' in stylesheet 
jar:file:/C:/Program%20Files%20(x86)/Java/jre1.8.0_20/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-focus-color' while resolving lookups 
for '-fx-background-color' from rule '*.ListSpinnerSkin' in stylesheet 
file:/C:/Users/user/Documents/jfxtras/jfxtras-controls/_build/jfxtras/internal/scene/control/ListSpinner.css

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving 
lookups for '-fx-text-fill' from rule '*.label' in stylesheet 
jar:file:/C:/Program%20Files%20(x86)/Java/jre1.8.0_20/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving 
lookups for '-fx-text-fill' from rule '*.label' in stylesheet 
jar:file:/C:/Program%20Files%20(x86)/Java/jre1.8.0_20/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving 
lookups for '-fx-text-fill' from rule '*.label' in stylesheet 
jar:file:/C:/Program%20Files%20(x86)/Java/jre1.8.0_20/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-accent' while resolving lookups for 
'-fx-text-fill' from rule '*.CalendarPickerControlSkin 

Re: CSS warning

2014-10-21 Thread Tom Eugelink

I understand and see the merrits of special handling so that the engine 
prevents leaking. OTOH, special handling always is extra overhead, and I know 
how careful the JavaFX team weighs any additional performance hit, so the 
question remains if the engine should have a special handling or the CSS should 
have selectors that prevent leaking. You could, for example, have the CSS 
parser add an generated class to all the control's CSS rules, and also add that 
class to the control (basically what I have done explicitely). In this way the 
CSS engine does not need special handling, but uses the existing selector logic 
to prevent leaking.

Anywho, my concern was placed on the table, I do not have enough knowledge of 
the CSS engine to argue the finer details.

Tom


On 21-10-2014 19:20, David Grieve wrote:


On 10/21/14, 1:09 PM, Tom Eugelink wrote:

That makes sense :-) I've tested it under 8U40, took some hacking because of the other 
CSS problems with the only affects the control, but it indeed seems to not be 
a problem anymore.

About this only affects the control; are you sure you want to add special CSS 
handling for controls in the code, instead of making sure that the CSS only applies to 
the correct nodes by better using CSS selectors? It seems to me CSS classes are a perfect 
mechanism for this. HTML engines don't have special CSS handling for divs or imgs or ...

Yes, I'm sure. Keep in mind that the stylesheet returned by 
getUserAgentStylesheet() is treated as a user-agent stylesheet for the purpose 
of the cascade. I would argue, however, that you don't want styles from some 
third party control leaking into other parts of your application. What the 
special handling does is allow css to be bundled with some control and for the 
control to be dropped into a scene-graph without affecting the rest of the 
application.


Tom



On 21-10-2014 16:19, David Grieve wrote:

JavaFX CSS has a 'lookup' feature that allows you to declare the value of a 
property as another property. For example, the -fx-base property defines the 
base color of the modena theme (the same goes for caspian). When a css value is 
calculated, these looked-up properties have to be resolved to a real value. The 
code looks for matching styles starting with the current node and going up the 
parent chain to the root of the scene-graph until it finds a value that doesn't 
need to be further resolved.  If the value isn't resolved, then this message is 
printed out.

Resolving a lookup value is dependent on a node's parents having already been 
processed by CSS. If, for example, -fx-base is in .root and the root of the 
scene-graph hasn't been processed by CSS, the root node will not have any 
styles and the lookup will fail. The CSS code tries to ensure that CSS is 
always processed from the root down and also tries to ensure that the CSS state 
of parent nodes is not dirty when CSS is processed on a child node.

When new styles are added to the scene-graph, from adding a stylesheet to the 
scene or adding a user-agent stylesheet, CSS is reapplied to the scene-graph. 
This means that all the matching styles and calculated values are thrown away 
and re-evaluated from scratch. In 8u20, adding a stylesheet to a control via 
the Control method getUserAgentStylesheet() will cause this to happen. So I 
think what is happening here is that the getUserAgentStylesheet() call happens 
in the middle of CSS being processed on the Control; thus, the CSS for the 
parent nodes of the control will all be tossed out and the lookups will fail. 
This all settles out in the next CSS pass, which is why you don't see an issue 
with the look.

There was some work done in 8u40 improve the handling of reapplying CSS. There 
were also some changes to getUserAgentStylesheet() so that it only affects the 
control and not the whole scene-graph. Try 8u40 and see if that doesn't help. 
If you still get these warnings on 8u40, then please create a bug in jira.

On 10/21/14, 2:10 AM, Tom Eugelink wrote:

Has anyone every figured out what the cause is of these CSS warnings I get? 
They do not seem to influence the look at all, and since I copied the styling 
from moderna.css, they do not seem to be valid either. I suspect it may have to 
do with a different handling of CSS and that I cannot reuse stuff defined in 
moderna? Because if I take the first error; -fx-focus-color is defined in 
moderna.css.

Tom

okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-focus-color' while resolving lookups for 
'-fx-background-color' from rule '*.ListSpinnerSkin' in stylesheet 
file:/C:/Users/user/Documents/jfxtras/jfxtras-controls/_build/jfxtras/internal/scene/control/ListSpinner.css
okt 21, 2014 8:02:42 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving lookups 
for '-fx-text-fill' from rule '*.label' in stylesheet 

hg: openjfx/8u-dev/rt: RT-38352: [CSS] Warning messages in media Ensemble tests

2014-08-19 Thread david . grieve
Changeset: 96b2950a91e3
Author:David Grievedavid.gri...@oracle.com
Date:  2014-08-19 12:52 -0400
URL:   http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/96b2950a91e3

RT-38352: [CSS] Warning messages in media Ensemble tests

! 
apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/streamingmediaplayer/PlayerPane.java
! 
apps/samples/Ensemble8/src/samples/resources/ensemble/samples/media/alphamediaplayer/AlphaMediaPlayer.css
! 
apps/samples/Ensemble8/src/samples/resources/ensemble/samples/media/overlaymediaplayer/OverlayMediaPlayer.css
! 
apps/samples/Ensemble8/src/samples/resources/ensemble/samples/media/streamingmediaplayer/StreamingMediaPlayer.css



hg: openjfx/8u-dev/rt: RT-38345: [CSS] Warning messages from CSS on touch devices

2014-08-18 Thread david . grieve
Changeset: d7373a5e9cd9
Author:David Grievedavid.gri...@oracle.com
Date:  2014-08-18 12:30 -0400
URL:   http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/d7373a5e9cd9

RT-38345: [CSS] Warning messages from CSS on touch devices
Reviewed by: kevin, lisa

! modules/graphics/src/main/java/com/sun/javafx/css/parser/CSSParser.java