Well, there can be other IValuesImpl other than SimpleCSSValuesImpl and
those other implementations may not have a perInstanceStyles property, so
I don't know that we should add perInstanceStyles to IValuesImpl.

If we don't, you will have to know that the IValuesImpl is a
SimpleCSSValuesImpl, so I'm not sure I see an advantage to making it an
instance property.  IMO, it isn't a hack to have a static map.  It is
available on-demand.  Are you sure that the IValuesImpl is set before
anybody will need to access perInstanceStyles?

No code relies on it that I saw in a quick search, so I suppose you could
change it and see what others think when they need to add a property some
day.

-Alex

On 10/30/16, 2:31 PM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:

>I’ll explain the scenario to make it more clear.
>
>
>
>I wanted to add a new CSS property (overflow) which was not included in
>SimpleCSSValueImpl. I noticed that valid CSS properties were specified in
>SimpleCSSValuesImpl.perInstanceStyles. I suppose I could have done
>                  
>SimpleCSSValuesImpl.perInstanceStyles.overflow = 1
>
>
>
>when the app initializes but it seems to me like a hack. Instead I wanted
>to create a new class that extends SimpleCSSValuesImpl and adds overflow
>to its list of allowed properties. The problem is that
>SimpleCSSValuesImpl.perInstanceStyles is static, so there’s no clean way
>of changing it.
>
>
>
>So my suggestion is to change this line:
>
>
>
>        public static var perInstanceStyles:Object = {…}
>
>
>
>with this line
>
>
>
>        public var perInstanceStyles:Object = {}
>
>
>
>It would still be accessible the way it’s done today, i.e.
>ValuesManager.valuesImpl will still be static as it is today. Any
>objections?
>
>
>
>From: Alex Harui<mailto:aha...@adobe.com>
>Sent: Sunday, October 30, 2016 4:07 PM
>To: dev@flex.apache.org<mailto:dev@flex.apache.org>
>Subject: Re: [FlexJS] Extending SimpleCSSValuesImpl
>
>
>
>
>On 10/30/16, 4:23 AM, "yishayw" <yishayj...@hotmail.com> wrote:
>
>>Is there a reason why SimpleCSSValuesImpl.perInstanceStyles is static? It
>>makes extending SimpleCSSValuesImpl difficult. Since there's typically
>>just
>>one such instance per app is there any harm in making it a dynamic
>>property.
>>That will allow derived classes to simply push new values upon
>>construction,
>>and make adding a new style property to an app easier.
>>
>
>Not sure I understand, but you can try it and see what happens.  I think I
>set it up as static because that way you don't have to have a reference to
>the shared instance in order to change it.  But maybe it is easy enough to
>use ValuesManager to get there.
>
>-Alex
>

Reply via email to