Hi Carlos,

Comments inline.

On 3/6/18, 10:45 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"
<carlos.rov...@gmail.com on behalf of carlosrov...@apache.org> wrote:

>Hi Alex,
>
>for SWF I think we should have something like [1] [2]
>
>what I don't know right now is what does royale compiler under the hood to
>bring the "linear-gradient" values to the flash part, maybe generate some
>AS3 code? 


For SWF, CSS is encoded into a data structure of name value pairs.  The
value can be a String, Number, reference to a class, Array, probably some
other things as well.



>from there we can get those values and use in the flash code
>similar to the ones in the links posted right?

The SWF code can do pretty much whatever it wants with those values.  The
goal is for the compiler to convert the CSS into a useful data structure
that doesn't take too much framework code to process.  So doing things
like converting RGBA to a hexadecimal number is preferred but there are no
hard rules.

>
>[1] 
>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhelp.adob
>e.com%2Fen_US%2FActionScript%2F3.0_ProgrammingAS3%2F&data=02%7C01%7Caharui
>%40adobe.com%7Cbb184bfb29e3488d18d008d5839278ef%7Cfa7b1b5a7b34438794aed2c1
>78decee1%7C0%7C0%7C636559587651768767&sdata=JLVkx89M4pFDeFsDKaPDI1dS%2B%2B
>UThrZQRCYkljWU3dk%3D&reserved=0
>WS5b3ccc516d4fbf351e63e3d118a9b90204-7dd7.html
>[2] 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsnipplr.co
>m%2Fview%2F15005%2F&data=02%7C01%7Caharui%40adobe.com%7Cbb184bfb29e3488d18
>d008d5839278ef%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63655958765176
>8767&sdata=UI2AFgw68%2F%2BCUDnU5uh6l%2F6aCrbLmSipjynq8xW69cg%3D&reserved=0
>
>For the compiler part, I'm really have to check for:
>
>background-image: linear-gradient(#3BB0FF, #1E36FA);
>
>or
>
>background: linear-gradient(#3BB0FF, #1E36FA);
>
>not for backgrounColor(s), but I suppose is the same
>
>(in this last case I guest we have some actual problems since in that
>compact mode, people could write many optional things and maybe this are
>not processed right for the compiler.

I don't know if linear-gradient can be specified in other CSS style
property values.  I guess it would be best to define a SWF data structure
that best represents the data.  I see in a CSS spec that linear-gradient
can have lots of different parameters.  We want the compiler to handle
that and maybe output an array of values.  The framework can read that
array and determine how to draw the gradient.  The first thing in the
array could be the string "linear-gradient" so you know what follows.

In Flex CSS there were often properties with names that ended with "Alpha"
but that isn't CSS compliant.  Instead, it appears that alpha is generally
specified via RGBA.  So the compiler and framework should probably handle
RGBA instead of separate *Alpha properties.

Good luck,
-Alex

>
>thanks
>
>
>2018-03-06 17:36 GMT+01:00 Alex Harui <aha...@adobe.com.invalid>:
>
>> Hi Carlos,
>>
>> If you can find a way to handle linear-gradient for SWF that would be
>> great.  I don't know this area of the code that well, but I think you
>>have
>> at least 3 choices:
>>
>> 1) Alter the AST
>> 2) Output a String
>> 3) Reduce it to a function call.
>>
>> FWIW, #3 requires changing the reducer which seems scary.  I think I've
>> avoided it so far.
>>
>> Options #1 and #2 are similar.  I think you can see that the parsing
>>sets
>> up a data structure with things like CSSRgbColorPropertyValue and
>> CSSFunctionCallPropertyValue.  It should be possible to see that a
>> CSSFunctionCallPropertyValue is a linear-gradient and swap it out for
>>some
>> other CSS structure that represents what the parser would have generated
>> for:
>>
>> #1:  backgroundColors: #000000, #123456;
>> #2:  backgroundColor: "linearGradient(#000000, #123456)"
>>
>> For #1, there seems to already be custom styles that end with
>>"xxxColors"
>> (note plural) that have a list of colors.
>> For #2, you are trying to set backgroundColor to a String that the
>> framework could parse at runtime.
>>
>> Good luck,
>> -Alex
>>
>>
>> On 3/6/18, 4:16 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"
>> <carlos.rov...@gmail.com on behalf of carlosrov...@apache.org> wrote:
>>
>> >Hi Alex,
>> >
>> >I'm looking into CSS compiler files and trying to see what to do. This
>>for
>> >the momento exceeds me, but I'll try to continue trying to understand
>>this
>> >part, but will need cross various emails with you:
>> >
>> >For this one:
>> >
>> >https://na01.safelinks.protection.outlook.com/?url=
>> https%3A%2F%2Fgithub.co
>> >m%2Fapache%2Froyale-compiler%2Fissues%2F26&data=02%7C01%
>> 7Caharui%40adobe.c
>> >om%7C5cf94961f3994e02456208d5835c29f8%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7
>> >C0%7C0%7C636559354222273618&sdata=jCD9%2FvfKxdW0TKwiJhMO%
>> 2FI7zwGI6cWaMQUYP
>> >oTMk%2BJo%3D&reserved=0
>> >
>> >I assume the point is in CSSReducer class (line 530), then I need to
>>deal
>> >with CSSFunctionCallPropertyValue
>> >
>> >but first of all is what to do with  *linear-gradient(#3BB0FF,
>>#1E36FA)'*
>> >in SWF
>> >
>> >I think this value could not be valid in SWF for "background", but in
>>that
>> >case:
>> >
>> >* we can make it valid
>> >
>> >or
>> >
>> >* maybe for SWF there's some way to discriminate css rules for SWF and
>>for
>> >JS?
>> >
>> >(In the end if we want JS and SWF match, I think we should support
>> >linear-gradients in SWF in some way
>> >
>> >Thanks
>> >
>> >--
>> >Carlos Rovira
>> >https://na01.safelinks.protection.outlook.com/?url=
>> http%3A%2F%2Fabout.me%2
>> >Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%
>> 7C5cf94961f3994e02456208d5
>> >835c29f8%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%
>> 7C636559354222273618&s
>> >data=XOjs%2B44XE3iak7IvBiX3lajtbDPUe6XPBCKPg%2FGUqLU%3D&reserved=0
>>
>>
>
>
>-- 
>Carlos Rovira
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2
>Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7Cbb184bfb29e3488d18d008d5
>839278ef%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636559587651768767&s
>data=hZupbvf5ZwbnAcTydxuZfuKn1L9JGgcK0rUwyeuVFOk%3D&reserved=0

Reply via email to