Commit graph

12 commits

Author SHA1 Message Date
Zach Hoffman
87ce7045ef style: [css-properties-values-api] Parsing and serialization for @property syntax descriptor
Based off of @emilio's syntax parser at
<https://github.com/emilio/css-typed-om-syntax>.

Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>

Differential Revision: https://phabricator.services.mozilla.com/D178268
2023-11-24 08:57:14 +01:00
Emilio Cobos Álvarez
0917ee3f9b style: Fix some spec links
Trivial, comment-only

Differential Revision: https://phabricator.services.mozilla.com/D174474
2023-11-21 15:36:35 +01:00
Tiaan Louw
f3402e6144 style: Color interpolation takes none keyword into account
Now that the none keyword is available, we can take it into account when
interpolating colors following the rules from the spec here:

https://drafts.csswg.org/css-color-4/#interpolation-missing

Differential Revision: https://phabricator.services.mozilla.com/D172666
2023-11-21 15:36:35 +01:00
Tiaan Louw
fb4501c5b4 style: Allow 'none' keyword in color components
Make use of the new changes in the cssparser that allows 'none' keywords
in color components where allowed.  We store the none values as 0.0 (as
per the spec) and mark the components with the flags. This way we don't
have to check anything on the components before doing calculations.

As this is the last part intended to be released for the new [color-4]
changes, I've also enabled the changes on nightly.

Differential Revision: https://phabricator.services.mozilla.com/D170208
2023-11-21 15:36:35 +01:00
Tiaan Louw
8c1c4073e2 style: Convert RGBA to AbsoluteColor for computed/animated/resolved CSS colors
Computed color values will not be in the correct format, closer to the
one specified by the author.  This also means that colors accross the
code are stored now as AbsoluteColor or StyleAbsoluteColor.  This allows
color space/gamut information to be available for use.

Some animation related test failures had to be changed, because colors
now has greater precision.  Animated a color now causes a lot more
animation updates, which was not initially expected.  See the bug for
discussion.

Differential Revision: https://phabricator.services.mozilla.com/D171021
2023-11-21 15:36:35 +01:00
Tiaan Louw
1c3aafd9d2 style: Use abstract color parser
In stead of having the css parser construct a color in it's own format
and then converting it to what Gecko needs to perform operations, we now
construct a Gecko friendly color type directly.

Differential Revision: https://phabricator.services.mozilla.com/D170187
2023-11-06 09:35:57 +01:00
Tiaan Louw
93326b2d2b style: Part 3 - Color mixing is done with new color spaces
The color mixing is npw using AbsoluteColor and it's conversion
functions. The result is still being converted back to sRGB for now.

Differential Revision: https://phabricator.services.mozilla.com/D169930
2023-11-06 09:35:57 +01:00
Tiaan Louw
954c38cccb style: Part 2 - Use new color space for color mixing
Mixing is now using the new color space for specifying the interpolation
color space.  For that reason hsl and hwb is added to the color space
and also converting to/from them.

Differential Revision: https://phabricator.services.mozilla.com/D169929
2023-11-06 09:35:57 +01:00
Tiaan Louw
e963abe2e9 style: Part 1 - Move color mixing code to color module
No functional changes, just moving the code to the shared library in
preperation for replacing it with the new AbsoluteColor.

Differential Revision: https://phabricator.services.mozilla.com/D169928
2023-11-06 09:35:57 +01:00
Tiaan Louw
a9998e899b style: Move AbsoluteColor to common color module
Differential Revision: https://phabricator.services.mozilla.com/D169607
2023-11-06 09:35:57 +01:00
Tiaan Louw
169c2682d5 style: Add missing color conversions
The patch adds some of the color conversions away from sRGB.

Differential Revision: https://phabricator.services.mozilla.com/D168895
2023-11-06 09:35:57 +01:00
Tiaan Louw
922914aa38 style: Implement color() function from CSS specification
Colors can now be defined in different color spaces with the color()
function.

https://w3c.github.io/csswg-drafts/css-color-4/#predefined

Differential Revision: https://phabricator.services.mozilla.com/D164866
2023-11-06 09:35:57 +01:00