You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Maurice Amsellem <ma...@systar.com> on 2013/12/20 12:50:14 UTC

Managing units in CSS

Hi,

With the coming of FlexJS and the possibility to target JS or Flash with Flex code,  I think there is a feature that is available in HTML but has been missing from Flex.
It's the ability to express lengths in css using a physical unit ( inch, point) in addition to pixels.

Another reason for doing that is the following: with the plethora or screen sizes and densities, sometimes expressing a length in physical unit is the most elegant way.

It also expresses the real perception of end-users.

What do you think?

Maurice

Maurice Amsellem
SYSTAR R&D - BusinessBridgeFX


RE: Managing units in CSS

Posted by Maurice Amsellem <ma...@systar.com>.
Thanks.

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : vendredi 20 décembre 2013 17:21
À : dev@flex.apache.org
Objet : Re: Managing units in CSS


On 12/20/13 7:54 AM, "Maurice Amsellem" <ma...@systar.com>
wrote:

>>It is a lot of work to retrofit the current SDK, because you can't 
>>convert to a number at compile time.  If your units are inches or ems, 
>>you have to convert it at runtime.
>Agree that it has to be done at runtime.
>
>>But yes, FlexJS will try to support that, at least for the text styles.
>Out of curiosity, can you share how you intend to do that, in broad 
>lines ?
Not sure yet.  My thoughts are that the compiler will do real parsing and output a canonical form (we do this for the JS side already).  Then in FlexJS we'll either have a simple parser, or declare all styles as strings so they can retain their unit information.  Then from there we should be able to convert at runtime.

It isn't even clear that we'll use the protochain CSS that we used in current Flex.  I think the number of objects in the display list that care about styles may be much less than in current Flex so building and re-building a chain populated mostly empty nodes may not pay off against the much faster protochain lookup.

-Alex



>
>Maurice
>
>-----Message d'origine-----
>De : Alex Harui [mailto:aharui@adobe.com] Envoyé : vendredi 20 décembre 
>2013 15:48 À : dev@flex.apache.org Objet : Re: Managing units in CSS
>
>It is a lot of work to retrofit the current SDK, because you can't 
>convert to a number at compile time.  If your units are inches or ems, 
>you have to convert it at runtime.
>
>But yes, FlexJS will try to support that, at least for the text styles.
>
>-Alex
>
>On 12/20/13 4:00 AM, "Maurice Amsellem" <ma...@systar.com>
>wrote:
>
>>The idea would be that it gives the same result on both JS and Flash.
>>
>>I don't have an expert knowledge on how styles are currently managed 
>>in Flex, but it seems to me that the whole parsing / assignment is 
>>done either by the compiler or In Flex SDK code.
>>FlashPlayer only sees actual pixel values.
>>So of course we would have to change the SDK (and maybe the compiler 
>>as well ? ) so that "unit" values are turned into actual pixels.
>>
>>WDYT?
>>
>>Maurice
>>
>>-----Message d'origine-----
>>De : Tom Chiverton [mailto:tc@extravision.com] Envoyé : vendredi 20 
>>décembre 2013 12:54 À : dev@flex.apache.org Objet : Re: Managing units 
>>in CSS
>>
>>On 20/12/2013 11:50, Maurice Amsellem wrote:
>>> What do you think?
>>I think it's an issue, because you could write Flex code that can't be 
>>made into a .SWF when the whole point is both run times are equal ?
>>
>>Tom
>


Re: Managing units in CSS

Posted by Alex Harui <ah...@adobe.com>.
On 12/20/13 7:54 AM, "Maurice Amsellem" <ma...@systar.com>
wrote:

>>It is a lot of work to retrofit the current SDK, because you can't
>>convert to a number at compile time.  If your units are inches or ems,
>>you have to convert it at runtime.
>Agree that it has to be done at runtime.
>
>>But yes, FlexJS will try to support that, at least for the text styles.
>Out of curiosity, can you share how you intend to do that, in broad lines
>?
Not sure yet.  My thoughts are that the compiler will do real parsing and
output a canonical form (we do this for the JS side already).  Then in
FlexJS we'll either have a simple parser, or declare all styles as strings
so they can retain their unit information.  Then from there we should be
able to convert at runtime.

It isn't even clear that we'll use the protochain CSS that we used in
current Flex.  I think the number of objects in the display list that care
about styles may be much less than in current Flex so building and
re-building a chain populated mostly empty nodes may not pay off against
the much faster protochain lookup.

-Alex



>
>Maurice
>
>-----Message d'origine-----
>De : Alex Harui [mailto:aharui@adobe.com]
>Envoyé : vendredi 20 décembre 2013 15:48
>À : dev@flex.apache.org
>Objet : Re: Managing units in CSS
>
>It is a lot of work to retrofit the current SDK, because you can't
>convert to a number at compile time.  If your units are inches or ems,
>you have to convert it at runtime.
>
>But yes, FlexJS will try to support that, at least for the text styles.
>
>-Alex
>
>On 12/20/13 4:00 AM, "Maurice Amsellem" <ma...@systar.com>
>wrote:
>
>>The idea would be that it gives the same result on both JS and Flash.
>>
>>I don't have an expert knowledge on how styles are currently managed in
>>Flex, but it seems to me that the whole parsing / assignment is done
>>either by the compiler or In Flex SDK code.
>>FlashPlayer only sees actual pixel values.
>>So of course we would have to change the SDK (and maybe the compiler as
>>well ? ) so that "unit" values are turned into actual pixels.
>>
>>WDYT?
>>
>>Maurice
>>
>>-----Message d'origine-----
>>De : Tom Chiverton [mailto:tc@extravision.com] Envoyé : vendredi 20
>>décembre 2013 12:54 À : dev@flex.apache.org Objet : Re: Managing units
>>in CSS
>>
>>On 20/12/2013 11:50, Maurice Amsellem wrote:
>>> What do you think?
>>I think it's an issue, because you could write Flex code that can't be
>>made into a .SWF when the whole point is both run times are equal ?
>>
>>Tom
>


RE: Managing units in CSS

Posted by Maurice Amsellem <ma...@systar.com>.
>It is a lot of work to retrofit the current SDK, because you can't convert to a number at compile time.  If your units are inches or ems, you have to convert it at runtime.
Agree that it has to be done at runtime.

>But yes, FlexJS will try to support that, at least for the text styles.
Out of curiosity, can you share how you intend to do that, in broad lines ?

Maurice

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : vendredi 20 décembre 2013 15:48
À : dev@flex.apache.org
Objet : Re: Managing units in CSS

It is a lot of work to retrofit the current SDK, because you can't convert to a number at compile time.  If your units are inches or ems, you have to convert it at runtime.

But yes, FlexJS will try to support that, at least for the text styles.

-Alex

On 12/20/13 4:00 AM, "Maurice Amsellem" <ma...@systar.com>
wrote:

>The idea would be that it gives the same result on both JS and Flash.
>
>I don't have an expert knowledge on how styles are currently managed in 
>Flex, but it seems to me that the whole parsing / assignment is done 
>either by the compiler or In Flex SDK code.
>FlashPlayer only sees actual pixel values.
>So of course we would have to change the SDK (and maybe the compiler as 
>well ? ) so that "unit" values are turned into actual pixels.
>
>WDYT?
>
>Maurice
>
>-----Message d'origine-----
>De : Tom Chiverton [mailto:tc@extravision.com] Envoyé : vendredi 20 
>décembre 2013 12:54 À : dev@flex.apache.org Objet : Re: Managing units 
>in CSS
>
>On 20/12/2013 11:50, Maurice Amsellem wrote:
>> What do you think?
>I think it's an issue, because you could write Flex code that can't be 
>made into a .SWF when the whole point is both run times are equal ?
>
>Tom


Re: Managing units in CSS

Posted by Alex Harui <ah...@adobe.com>.
It is a lot of work to retrofit the current SDK, because you can't convert
to a number at compile time.  If your units are inches or ems, you have to
convert it at runtime.

But yes, FlexJS will try to support that, at least for the text styles.

-Alex

On 12/20/13 4:00 AM, "Maurice Amsellem" <ma...@systar.com>
wrote:

>The idea would be that it gives the same result on both JS and Flash.
>
>I don't have an expert knowledge on how styles are currently managed in
>Flex, but it seems to me that the whole parsing / assignment is done
>either by the compiler or
>In Flex SDK code.
>FlashPlayer only sees actual pixel values.
>So of course we would have to change the SDK (and maybe the compiler as
>well ? ) so that "unit" values are turned into actual pixels.
>
>WDYT?
>
>Maurice 
>
>-----Message d'origine-----
>De : Tom Chiverton [mailto:tc@extravision.com]
>Envoyé : vendredi 20 décembre 2013 12:54
>À : dev@flex.apache.org
>Objet : Re: Managing units in CSS
>
>On 20/12/2013 11:50, Maurice Amsellem wrote:
>> What do you think?
>I think it's an issue, because you could write Flex code that can't be
>made into a .SWF when the whole point is both run times are equal ?
>
>Tom


RE: Managing units in CSS

Posted by Maurice Amsellem <ma...@systar.com>.
The idea would be that it gives the same result on both JS and Flash.

I don't have an expert knowledge on how styles are currently managed in Flex, but it seems to me that the whole parsing / assignment is done either by the compiler or 
In Flex SDK code.
FlashPlayer only sees actual pixel values.
So of course we would have to change the SDK (and maybe the compiler as well ? ) so that "unit" values are turned into actual pixels.

WDYT?

Maurice 

-----Message d'origine-----
De : Tom Chiverton [mailto:tc@extravision.com] 
Envoyé : vendredi 20 décembre 2013 12:54
À : dev@flex.apache.org
Objet : Re: Managing units in CSS

On 20/12/2013 11:50, Maurice Amsellem wrote:
> What do you think?
I think it's an issue, because you could write Flex code that can't be made into a .SWF when the whole point is both run times are equal ?

Tom

Re: Managing units in CSS

Posted by Tom Chiverton <tc...@extravision.com>.
On 20/12/2013 11:50, Maurice Amsellem wrote:
> What do you think?
I think it's an issue, because you could write Flex code that can't be 
made into a .SWF when the whole point is both run times are equal ?

Tom