W3C home > Mailing lists > Public > www-style@w3.org > December 2015

Re: [css-values] Adding a <length-percentage> production

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 10 Dec 2015 12:30:40 -0800
Message-ID: <CAAWBYDDHuEk8=6+LqzZ-EufjD7d53YoEC=3Fz3ZiLU0LUfhBUQ@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style list <www-style@w3.org>
On Thu, Dec 10, 2015 at 11:43 AM, fantasai
<fantasai.lists@inkedblade.net> wrote:
> On 12/10/2015 02:05 PM, Tab Atkins Jr. wrote:
>>
>> At TPAC, in the unofficial Houdini meetup on Thursday, we realized
>> that our property grammars were kinda ambiguous, and that was
>> troublesome for the Custom Properties API.  In particular, when you
>> see a grammar like "<length> | <percentage>", it's not clear whether
>> the <percentage> is a distinct type, or a length-equivalent type.
>> This is an important distinction, because the latter allows `calc(5px
>> + 10%)`, but the former does not.  CSS has examples of both: most
>> instances are the latter, but 'word-spacing' is the former, and
>> 'background-position' is *technically* the former, but we hack things
>> around to make it work like the latter anyway.  CSS currently resolves
>> the ambiguity with prose (the "Percentages" line in the
>>
>> The solution we hit on in the meeting was to define a new grammar
>> non-terminal, <length-percentage>, that indicates the
>> "length-equivalent" percentage case.  This also simplifies grammars -
>> I've always been slightly, vaguely annoyed at the clumsiness that "[
>> <length> | <percentage> ]" introduces into my grammars, and this
>> simplifies things a bit.
>>
>> We'll need similar non-terminals for the other base types: frequence,
>> angle, time, and number.  I don't think we need a non-terminal for the
>> length-percentage-number triplet that line-height uses - that "number"
>> case probably should really have been a new unit that was a
>> used-value-time 'em'.
>>
>> So, I plan to add these to V&U. Specs can gradually adopt it - the
>> current grammars are non-ambiguous due to the accompanying prose.
>> This is just an attempt to slightly simplify CSS, and make sure that
>> Houdini and CSS grow together.
>>
>> Thoughts?
>
>
> <length-percentage> makes sense to me. What are the others you need
> to add?

Just the other things that can be combined with % in calc() -
<time-percentage>, etc.  I don't think they're used anywhere in CSS,
but there's no reason to exclude their use in Houdini.

> Should we cut a V&U L4 draft or just fold this into L3?

This is a non-normative addition of some grammar non-terminals, so it
can go in L3.

~TJ
Received on Thursday, 10 December 2015 20:31:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:59 UTC