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

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

From: Simon Fraser <smfr@me.com>
Date: Sun, 21 Feb 2016 13:01:36 -0800
Cc: www-style list <www-style@w3.org>
Message-id: <30585F96-3A98-423B-86BB-4FB7F1F858F7@me.com>
To: "L. David Baron" <dbaron@dbaron.org>

> 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?

Simon
Received on Sunday, 21 February 2016 21:02:08 UTC

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