Re: [csswg-drafts] [css-cascade] Additive CSS

> The main thing that would need to be worked out is the addition rules for different data types. This would be similar to how we have interpolation rules for data types -- and with the similar understanding that some things can't be added and would be replaced instead.

Yes, I am working on adding that to CSS Values & Units since we already use this in Web Animations.

> For property values that consist of more than a single value, there usually wouldn't be a single universal way to define how to add two declarations.

I'm optimistic we can solve this (we have most of these complex types adding together in Gecko / Servo / Blink) by doing addition on the components. There are some cases where we fall back to non-additive just like for interpolation there are some cases where we fall back to discrete animation. As with interpolation, I think we can probably fill some of these gaps in the future without breaking content.

>  (This of course assumes an easy way to declare the data types of custom properties for interpolation and addition. But that's going to happen anyway, right?)

Right.

> I think accumulate is useful. But it doesn't fit into the !add syntax. Accumulation is a property of the animation repeat cycle, not of an individual declaration. The entire animation would either need to accumulate or not. And whether it accumulates or not would be separate from whether they underlying declarations were additive or not.

Web Animations lets you use the accumulate behavior (i.e. adding the function parameter values rather than appending to the list) when adding independent animations.

> (I'm assuming that, for !add in a @keyframes rule set, we are always adding on to the previous value from the cascade, and not on the previous keyframe. So it would be possible to have e.g. a 50% keyframe that was additive (so the first half of the animation is defined as a change from the base value), and then a 100% keyframe that wasn't additive (final value in the animation is the same regardless of the base value).)

Right. This per-keyframe additive behavior is already specified in Web Animations and implemented in Firefox and Chrome (but not shipping yet).

> How do you define the amount of change which becomes the amount to add?

I assume this is referring to how to apply accumulate behavior? If so, then this proposal is simply putting forward accumulate behavior as another type of addition independent of repetition.

>  Think of two text-shadow declarations: do you add them as a list, to create two shadows? Or do you add all the individual terms. So maybe there's a !concatenate list option versus !add?

This is precisely the difference between `!add` and `!accumulate` in this proposal.

-- 
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1594#issuecomment-319605835 using your GitHub account

Received on Wednesday, 2 August 2017 08:32:25 UTC