Re: [CSS3] Some clarifications on background-position four values parsing.

On Fri, Nov 9, 2012 at 10:08 AM, Alexis Menard <alexis.menard@intel.com> wrote:
> Hi there,
>
> I was doing the implementation of background-position with four values
> and while writing the tests I found few cases where I'm not sure how
> WebKit (or any other UA should behave).
>
> Few assumptions :
>
> - The spec doesn't enforce in the case of 4 values whether the first
> pair of values is horizontal and the second vertical. So : top 30px
> right 15px is valid and produce the same result as if it was right
> 15px top 30px.
>
> - center keyword is possible as the spec doesn't explicitly say it's
> invalid value when you specify 3 or 4 values.
>
> Now here are the case I'm not sure what's the behaviour. Some of them
> could be stupid or have actually shortcuts by specifying two values
> but let's assume someone write them.
>
> - center top 20px will actually set the property to left 50% top 20px.
> This is the Opera 12.10 behaviour.
>
> - left 20px center will actually set the property to left 10px top
> 50%. This is the Opera 12.10 behaviour.
>
> - left center top 20px is treated as invalid by Opera 12.10. Could it
> be left 50% top 20px for the actual property value? Is Opera wrong?
>
> - left center top center is treated as invalid by Opera 12.10. Could
> it be left 50% top 50% or just center?
>
> - top 20px center is treated as invalid by Opera 12.10. Could it be
> left 50% top 20px for the actual property value?
>
> - right 20px top center is treated as invalid by Opera 12.10. Could it
> be right 20px top 50% for the actual property value?
>
> I'm fine matching the behaviour of Opera (though I'm not sure it's
> correct) but I'd like to understand why and maybe we should clarify a
> bit the specification on that part. I'm sure some people will play
> around with equivalent of right 20px top center.

ok

so the spec say :

<position> = [
  [ left | center | right | top | bottom | <percentage> | <length> ]
|
  [ left | center | right | <percentage> | <length> ]
  [ top | center | bottom | <percentage> | <length> ]
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

which I misread (confused || with |).

Opera is correct.

Really sorry for the noise.



>
> People have other obscure cases in mind too?
>
> Thanks.
>
> --
> Alexis Menard
>
> Intel Semiconductores do Brasil Ltda.
> Ave Dr. Chucri Zaidan, 940, Brooklin, 10 Andar
> 04583-904 São Paulo, SP
> Brazil
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.



-- 
Alexis Menard

Intel Semiconductores do Brasil Ltda.
Ave Dr. Chucri Zaidan, 940, Brooklin, 10 Andar
04583-904 São Paulo, SP
Brazil

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Received on Monday, 12 November 2012 07:22:14 UTC