W3C home > Mailing lists > Public > www-style@w3.org > April 2009

Re: [CSS3] Flexible Flow Module, proposal.

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Tue, 14 Apr 2009 22:54:06 +0200
Message-ID: <65307430904141354w775f66c5nd8c3cb8c6b815f8a@mail.gmail.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: "Philip TAYLOR (Ret'd)" <P.Taylor@rhul.ac.uk>, www-style <www-style@w3.org>
2009/4/14 Andrew Fedoniouk <news@terrainformatica.com>:
> Giovanni Campagna wrote:
>>
>> 2009/4/14 Andrew Fedoniouk <news@terrainformatica.com>:
>>
>>>
>>> Philip TAYLOR (Ret'd) wrote:
>>>
>>>>
>>>> Andrew Fedoniouk wrote:
>>>>
>>>>
>>>>>
>>>>> '*' as a unit is used already in these places:
>>>>>
>>>>> 1) In html, so called multi-length or relative units:
>>>>> http://www.w3.org/TR/html401/types.html#type-length
>>>>> Used in tables[in supporting UAs] and framesets (@cols and @rows).
>>>>>
>>>>
>>>> Thank you, I confess I had overlooked that (in that
>>>> I was unaware of multilengths per se, although I had
>>>> seen the asterisk used in frameset specifications
>>>> -- and completely failed to understand it).
>>>>
>>>>
>>>>>
>>>>> 2) In following CSS3 proposals:
>>>>> http://www.w3.org/TR/css3-grid/
>>>>> http://www.w3.org/TR/css3-layout/
>>>>>
>>>>
>>>> OK, but they are still /proposals/ : there is
>>>> still time to get "*" replaced by something
>>>> more mnemonic :-)
>>>>
>>>>
>>>
>>> '*' can be used alone as a short form of  '1*'. For example if you want
>>> to
>>> put element in the bottom right corner of
>>> its container you can write:
>>>
>>> #middle
>>> {
>>>  margin: * 0 0 *;
>>> }
>>>
>>> Such short form will not work with mnemonics - will clash with #name
>>> production in CSS grammar.
>>>
>>
>> If you introduce the FLEX token as {number}*, you cannot use * alone,
>> you get a DELIM instead of a FLEX.
>>
>
> Imagine it this way:
>
> PERCENTAGE  ::=    num '%'        FLEX        ::=    [num]'*'    ('*' alone
> without any number is precise equivalent of '1*')
>
> And if you want to see flex units in mnemonic form (say 'flex') then you
> will need to change two things:
>
> First, ident production:
>
>  ident    ::=    '-'? nmstart nmchar* , but not 'flex'
>
> And second you will need:
> FLEX        ::=    [num] 'flex'
>
> First change is not desirable for many reasons. Think why it is '!important'
> but not just 'important'.
> ( Actually !important token is missing in this document:
>  http://www.w3.org/TR/css3-syntax )

Why flex (on its own) cannot be a ident (btw, an unit identifier is an ident)

> If you will try in practice to define CSS parser you will get almost
> immediately why '*' is better for flexes.

It depends on what you use to define your CSS parser. Probably if you
write your own parser from the basics it is better to use *, but if
you use a toolkit, I'm not sure.

>>> I mean that this:
>>> #middle
>>> {
>>>  margin: 1flex 0 0 1flex;
>>> }
>>> cannot be reduced to this:
>>> #middle
>>> {
>>>  margin: flex 0 0 flex;
>>> }
>>> without major changes in lex definitions.
>>>
>>
>> The same changes (probably even less, a keyword is easier to parse
>> than a separator)
>>
>
> I have CSS tokenizer/parser already that uses flexes as '*' and can claim
> exactly otherwise.
> Flexes in '*' form create less logical conflicts, see above.

Why? You can define <flex> = DIMENSION | IDENT at an upper level.

> For CSS tokenizers that do not support flexes things like '1*' and  '*' will
> trigger errors
> at the '*' character itself (thus on tokenizer level) so the whole property
> will be dropped reliably.
> For cases when flexes will be presented as say '1flex' or just 'flex' error
> handling will be way less
> predictable.

If it is less predictable, you're not conforming. Anytype of
unsupported value makes the whole declaration ignored, always, up to
and including the next semicolon.

>>
>>>
>>> And yes, these are proposals (above), but note - written by different
>>> authors. That means this idea/notation is somehow common.
>>>
>>
>> Because Grid Positioning imitated HTML, Template Layout reused Grid
>> Positioning and you copied both
>>
>
> I did not get this statement, sorry.
>
> What Grid Positioning is imitated in HTML and who copied what are not clear.

HTML introduced MultiLenghts with *. Grid Positioning copied that
syntax into "grid-columns" and "grid-rows", ignoring the existance of
a "fr" unit. Template Layout saw the precedent and copied.
You then reused both, ignoring the syntax concerns, because "css3-grid
and css3-layout use * as flexes"

>> Giovanni
Received on Tuesday, 14 April 2009 20:54:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:46:58 GMT