OK this sounds like a promising approach.
On Wed, Oct 7, 2009 at 11:50 AM, P T Withington <[email protected]> wrote: > > See my reply to myself about a better approach, where you will see that > despite the $style bindings being classified as 'constraints' they do not > actually install any delegates (unless the CSS itself specifies a > constraint, as in, the `attr()` value, which ties one CSS value to another), > they are just evaluated at initialization time. Also, in the revised > implementation, we have a 'fallback' or 'default-default', where if there is > no CSS property found, you install that default instead. I guess you could > consider that fallback to specify the default LFC stylesheet, but I don't > think we have to actually implement any such thing. > > Also, the idea is that these are defaults that will be overridden by > subclasses and instances. Only if the subclasses and instances do not > specify values will these defaults be consulted. But, yes, if we go crazy > and make every possible attribute CSS styleable, there will be an increase > in the instantiation time of a view, so we should be judicious about what we > make styleable in this way. > > The goal here is that we think users expect to be able to use CSS to style > their applications, but because we don't have any default bindings for > <view> attributes, the user has to do this all by hand. This way, there > will be default bindings all set up and they can just add a stylesheet. > > We should obviously evaluate the overhead of this change. There are > already some pretty good caches that optimize the CSS lookup, but perhaps we > can make a further optimization that creates a cache on the class to avoid > re-looking up (non-existen) default CSS bindings for each instance of the > class. > > Finally, someday we _will_ have to have at least one more delegate for each > instance that has CSS style bindings so that we can implement dynamic CSS > styles. I.e., when the user wants to change a stylesheet dynamically and > see the change propagate to all the views with attributes bound to the > changed style. We'd need at least one delegate to re-evaluate the style > bindings when the style sheets change. > > -- Henry Minsky Software Architect [email protected]
