W3C home > Mailing lists > Public > www-style@w3.org > February 2016

Re: [css-transitions] Interpolation of side-relative <position> values

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 22 Feb 2016 22:48:48 -0500
To: Simon Fraser <smfr@me.com>, "L. David Baron" <dbaron@dbaron.org>
Cc: www-style list <www-style@w3.org>
Message-ID: <56CBD6A0.5010001@inkedblade.net>
On 02/21/2016 04:01 PM, Simon Fraser wrote:
>
>> On Feb 19, 2016, at 6:39 pm, L. David Baron <dbaron@dbaron.org> wrote:
>>
>> On Friday 2016-02-19 18:28 -0800, Simon Fraser wrote:
>>> There is some trickiness with interpolation of side-relative <position> values. Consider:
>>>
>>> @keyframes shifty {
>>> from { background-position: 20px; }
>>> to { background-position: right 20px; }
>>> }
>>>
>>> Should that work? To make it work you’d have to know the box size when doing interpolation, or I suppose the UA could turn it into a calc() expression?
>>
>> In Gecko it works because we internally represent computed values of
>> background-position as calc() of a length and a percent, since the
>> three-value and four-value variants can all be reduced to that.
>>
>> This is consistent with the "Computed value:" line in
>> https://drafts.csswg.org/css-backgrounds/#the-background-position ,
>> so I believe it's correct, and that because of that "Computed
>> value:" line, this should work per spec.
>
> It’s not clear to me that the spec allows that calc() to leak out in computed style, yet in Firefox and Chrome, for object-position which also uses a <position>, it does:
>
> "object-position: bottom 10px right 20px;" turns into "calc(-20px + 100%) calc(-10px + 100%)” in computed style.
>
> Is this expected?

Yes. See
   https://www.w3.org/TR/css3-background/#changes-2012-07 (2nd to last bullet)
   https://hg.csswg.org/drafts/annotate/baa444d9c296/css-backgrounds/Overview.src.html
   https://lists.w3.org/Archives/Public/www-style/2013Dec/0023.html
   https://lists.w3.org/Archives/Public/www-style/2013Dec/0403.html

~fantasai
Received on Tuesday, 23 February 2016 03:49:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:00 UTC