Re: [css-align][css-grid] which position to use for aligning a baseline-aligned subtree of grid items?

On 2016-05-18 00:46, fantasai wrote:
> On 05/14/2016 08:16 AM, Mats Palmgren wrote:
>> https://drafts.csswg.org/css-align-3/#align-by-baseline
>> "Position this aligned subtree
>> within the alignment container according to the rules of the box
>> alignment properties in effect."
>>
>> It's rather vague what "alignment properties in effect" you're
>> referring to here.  When aligning grid items the alignment
>> container is a track, which doesn't have any properties per se.
>
> I think what this is referring to is the fallback alignment
> https://drafts.csswg.org/css-align-3/#baseline
>  # If the alignment subject’s position is not fully determined
>  # by baseline alignment, the content is start-aligned insofar
>  # as possible while preserving the baseline alignment. (Content
>  # that has no first baselines is thus start-aligned.

Hmm, are you sure?  I read the above as a fallback when the alignment
subject doesn't have a baseline in the given axis, which isn't
the case here.

What I've implemented now is aligning the baseline subtree to
the start when the grid container [align|justify]-content is
'start', 'stretch', etc, and aligning it to the end for 'end'
(ditto for the other <content-position> values to whatever side
they correspond to, except 'center').

For 'center' and <content-distribution> I align the baseline
subtree to the center of the track, growing it as needed.

Only being able to align first-baseline-aligned subtrees to the start
of the track (and last-baseline to the end) seems a bit primitive.
It's fairly trivial to align both to either the start/end/center so
it might be worth adding a property specifically for this so that
authors can choose where they want it.

(FTR, the correct link for the spec paragraph you quoted is:
https://drafts.csswg.org/css-align-3/#first-baseline-alignment )

>> (I suggest that you define the alignment edges of the subtree
>> as the union of alignment edges for the individual boxes and
>> that this union should be aligned as an alignment subject
>> using the position defined above.)
>
> Hmm, yes, we didn't give an <overflow-position> for this case.
> Probably it's better to default to safe-alignment. Certainly
> the 'baseline' value, which is the established one, is safe
> because it falls back to start alignment.

This can also be fixed by the new property for subtree alignment
if we give it an optional <overflow-position>.  Again, should be
fairly trivial to implement.

>> In general, all the spec sections on baseline alignment would
>> benefit from illustrations to make your intent clearer.
>
> Yeah... Agreed on that point. :(

I understand that drawing illustrations takes time and may not be
a priority, but please consider drawing something quick on a whiteboard
and taking a photo as a temporary solution (as I've seen in some drafts).


/Mats

Received on Wednesday, 18 May 2016 01:41:02 UTC