[css-align] Clarification on the concept of 'parent' for Self Alignment 'auto' value resolution

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[css-align] Clarification on the concept of 'parent' for Self Alignment 'auto' value resolution

Javier Fernandez
hi,

Sorry if this question is seen as a pure implementation detail, but I'm
finding some problems to properly implement 'auto' value resolution in
some cases. Both the Flexbox and Box Alignment specification use the
concept "element's parent" to indicate the Default Alignment
value to be used for resolving 'auto' values of children's Self
Alignment properties.

>From the Flexible Box spec:

"On absolutely positioned elements, a value of auto computes to itself.
On all other elements, a value of auto for align-self computes to the
value of align-items on the element’s parent, or stretch if the element
has no parent."
https://drafts.csswg.org/css-flexbox/#align-items-property

>From the Box Alignment spec:

"The auto keyword computes to the computed value of justify-items on the
parent (minus any legacy keywords), or normal if the box has no parent."
https://drafts.csswg.org/css-align/#align-self-property

It may seems like obvious, but, I'd like a direct clarification of what
"parent" means here. Is it the HTML element's parent or the "parent box"
generated when elements are laid out ?

My question comes from the fact that some layout models may add an
anonymous box
as parent for elements with 'auto' values in their Self Alignment
properties. There won't
be a direct CSS rule indicating the Default Alignment value these 'auto'
 values will be resolved against. It'd depend on the values set, at
layout time, to those anonymous
parents.

BR,

----
Javi

Reply | Threaded
Open this post in threaded view
|

Re: [css-align] Clarification on the concept of 'parent' for Self Alignment 'auto' value resolution

Tab Atkins Jr.
On Mon, May 30, 2016 at 5:27 AM, Javier Fernandez <[hidden email]> wrote:

> Sorry if this question is seen as a pure implementation detail, but I'm
> finding some problems to properly implement 'auto' value resolution in
> some cases. Both the Flexbox and Box Alignment specification use the
> concept "element's parent" to indicate the Default Alignment
> value to be used for resolving 'auto' values of children's Self
> Alignment properties.
>
> >From the Flexible Box spec:
>
> "On absolutely positioned elements, a value of auto computes to itself.
> On all other elements, a value of auto for align-self computes to the
> value of align-items on the element’s parent, or stretch if the element
> has no parent."
> https://drafts.csswg.org/css-flexbox/#align-items-property
>
> >From the Box Alignment spec:
>
> "The auto keyword computes to the computed value of justify-items on the
> parent (minus any legacy keywords), or normal if the box has no parent."
> https://drafts.csswg.org/css-align/#align-self-property
>
> It may seems like obvious, but, I'd like a direct clarification of what
> "parent" means here. Is it the HTML element's parent or the "parent box"
> generated when elements are laid out ?
>
> My question comes from the fact that some layout models may add an
> anonymous box
> as parent for elements with 'auto' values in their Self Alignment
> properties. There won't
> be a direct CSS rule indicating the Default Alignment value these 'auto'
>  values will be resolved against. It'd depend on the values set, at
> layout time, to those anonymous
> parents.

Anonymous boxes are, as the name suggests, *boxes* - they show up in
the box tree, which is constructed *from* the element tree.  "Parent
element" refers to the element tree; it doesn't care about box-tree
structure.  (And so there's no layout-time determination; this
behavior can instead be resolved at inheritance time.)

~TJ

Reply | Threaded
Open this post in threaded view
|

Re: [css-align] Clarification on the concept of 'parent' for Self Alignment 'auto' value resolution

Javier Fernandez
Hi Tab,

I'd need further clarification on the "parent" concept for the
Alignment 'auto' value resolution and the "flat-tree" concept.

https://w3c.github.io/webcomponents/spec/shadow/#flat-trees
https://w3c.github.io/webcomponents/spec/shadow/#attributes

On 06/01/2016 01:06 AM, Tab Atkins Jr. wrote:
> Anonymous boxes are, as the name suggests, *boxes* - they show up in
> the box tree, which is constructed *from* the element tree.  "Parent
> element" refers to the element tree; it doesn't care about box-tree
> structure.  (And so there's no layout-time determination; this
> behavior can instead be resolved at inheritance time.)
>

Would it be correct to consider your sentence "Parent element" refers to
the element tree" in a more general way as "Parent element" refers to the
flat-tree ?