Re: [css21][css3-background] background-position examples conflict with prose/grammar

On 03/04/2010 04:48 PM, Sylvain Galineau wrote:
>> From: L. David Baron [mailto:dbaron@dbaron.org]
>
>> Note the "and at least one value is not a keyword".  Two keywords
>> together are allowed in either order, as long as one can be
>> interpreted as horizontal and the other can be interpreted as
>> vertical.  ('center' can be interpreted as either.)
>>
>> The grammar also allows this in the '&&' (our special notation for
>> both required, but in either order) that's in the third part of the
>> top-level |.
>
> Thanks ! Now that you've clarified it, I think I recall a f2f discussion
> about this. In my mind though, "at least one" does not exclude "both".

It was not the intention to exclude both.

There are three possible value type combinations:

  A) both are keywords
  B) both are not keywords
  C) one is a keyword and one is not a keyword

The spec says:
   # If two values are given and at least one value is not a keyword,
   # then the first value represents the horizontal position (or offset)
   # and the second represents the vertical position (or offset).

"at least one value is not a keyword" means either B or C, but not A.

So for case B or C, the first value represents the horizontal position,
and the second the vertical. (The grammar excludes as invalid any pair
that includes a length and a keyword the wrong position.)

For case A, the sentence doesn't apply: the grammar allows either order,
and the interpretation is given by the keyword definitions below.

I believe that, when combined with the grammar and the keyword definitions,
the prose is unambiguous on the interpretation of any pair of values. If
I am mistaken and there is a case that is not defined, please point it out.

~fantasai

Received on Friday, 5 March 2010 20:29:03 UTC