2011/1/3 P T Withington <[email protected]>

> [laszlo-reviews -> laszlo-dev, this is more than a review now]
>
> On 2011-01-01, at 22:51, Captain Feng wrote:
>
> > First, I assume that both the following two ways lead to the same result:
> >
> > 1. css:
> > </stylesheet>
> >    view.boxy {
> >      margin: 5;
> >    }
> > </stylesheet>
> >    <view name="ps" styleclass="boxy" width="200" height="200"
> > bgcolor="yellow"/>
> >
> > 2. attribute:
> > <view name="s2" margin="5" width="200" height="200" bgcolor="yellow"/>
> >
> > Unluckily, Number 2 is not working at all in current build, which is the
> > question I need to confirm.
>
> Fred, I've attached an expanded version of the demo that is in the boxmodel
> documentation.  This shows the same `<view with="boxmodel"` being styled by
> CSS and by explicitly specifying the attributes.  It also shows how you can
> update the attributes programatically.
>
> The example is a little elaborate, but it is hard to visualize the margin
> and padding properties without having the contrasting parent and child
> views.
>
> (I note in your example above, you omitted the `with="boxmodel"`, perhaps
> that is an oversight?  Or perhaps that is why you are not seeing what you
> expect?)
>
Yeah...what a fool am I, and I did omitted the "boxmodel" accidentally!
Sorry for the confusion.


>
> > Second, I agree we should avoid mingling "CSS" and 'individual attribute'
> at
> > the same time.
> > But when it come to the case, the individual attribute should be
> overwritten
> > by 'css'?
>
> Normally if I specify, say, both a CSS style `background-color: red` and an
> initial value `bgcolor="green"`, the initial value will win (because it is
> the "most specific", it is analogous to HTML saying
> `style="background-color: green"` on the element.  The style on the element
> will always win out over any style in a style sheet.  (As a separate issue,
> we probably want to support `style=` on nodes.)
>
> The issue with boxmodel is that there are two ways to specify, say padding:
> either with separate padding-top, padding-right, etc. or with the
> "abbreviation" padding, that lets you specify all four paddings at once.  In
> the implementation that I checked in, I am trying to handle the expansion of
> the abbreviation in an attribute, but what I realize now is that that will
> lead to confusion because the normal mechanism for figuring out the
> precedence of an attribute binding can't work between the individual and
> abbreviated attributes.  I am pretty sure that what we will have to do is
> have the CSS parser expand the abbreviated attribute, so that there is only
> one attribute that determines the precedence.  (We may still support a
> setter/getter for the abbreviated attribute at runtime.)
>
> It's a complicated issue!
>
> In any case, here is the demo which shows the two different ways to set the
> parameters of a boxmodel:
>
>  Thank you so much for the demo, and it's pretty much for me to move on.
But it would be great if we can add those cases to documents. For now, I'm
trying to encourage our team to use a more 'explicit' way so as not to bring
confusion to the compiler. But when come to the setter/getter, may be it
will bring up some potential issues, anyway, let's drive them through JIRA.


-- 
captain

Reply via email to