Page MenuHomePhabricator

Bug 2007772 - Parse multiple items for color-mix() function r=#layout
ClosedPublic

Authored by tlouw on Jan 7 2026, 1:26 PM.
Referenced Files
F68756984: D278117.1777357686.diff
Mon, Apr 27, 6:28 AM
Unknown Object (File)
Tue, Apr 14, 10:40 AM
Unknown Object (File)
Mon, Apr 13, 5:00 AM
Unknown Object (File)
Thu, Apr 9, 8:16 PM
Unknown Object (File)
Thu, Apr 9, 1:37 PM
Unknown Object (File)
Thu, Apr 9, 8:42 AM
Unknown Object (File)
Thu, Apr 9, 6:52 AM
Unknown Object (File)
Thu, Apr 9, 1:42 AM

Details

Summary

The color-mix() function can now take multiple color/percentage pairs
and mix them all together using the new algorithm.

Tests for the serialization is pending here:
https://github.com/web-platform-tests/wpt/pull/57234

Event Timeline

tlouw planned changes to this revision.Jan 7 2026, 1:26 PM
tlouw created this revision.
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Jan 7 2026, 1:27 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
tlouw updated this revision to Diff 1182127.
tlouw updated this revision to Diff 1182139.
tlouw updated this revision to Diff 1186895.
tlouw edited the summary of this revision. (Show Details)
tlouw updated this revision to Diff 1186898.
tlouw retitled this revision from WIP: Bug 2007772 - Parse multiple items for color-mix() function r=#layout to Bug 2007772 - Parse multiple items for color-mix() function r=#layout.
tlouw added a reviewer: layout-reviewers.
dshin added a subscriber: dshin.

testing-exception-other: As in comment, pending WPT approval & sync (But seems reasonable enough)

servo/components/style/values/generics/color.rs
111

Hm, what should color-mix(red 40%, green 40%, blue 40%) serialize to?

170

Oh, I guess for color-mix(red 40%, green 40%, blue 40%) this should be false

servo/components/style/values/specified/color.rs
97
829

This loop seems repeated at multiple places - maybe can map() into collect(), but that's probably a style thing.

This revision is now accepted and ready to land.Jan 20 2026, 3:23 PM
tlouw marked 4 inline comments as done.
servo/components/style/values/generics/color.rs
111

color-mix(red 40%, green 40%, blue 40%), because normalized percentages doesn't add up to 1.0.

servo/components/style/values/specified/color.rs
829

item.color.to_computed_color(context) returns an Option<_> and if one of them fails, the whole thing should fail. Don't think there is a cleaner way for that.

Added functionality behind a pref layout.css.color-mix-multi-color.enabled, because the tests did not land yet.