Page MenuHomePhabricator

Bug 2001615 - Fix carry forward to not override flags from conversion. r=tlouw,emilio
ClosedPublic

Authored by zakrok on Dec 8 2025, 12:18 AM.
Referenced Files
Unknown Object (File)
Tue, Apr 14, 3:10 PM
Unknown Object (File)
Tue, Apr 14, 9:34 AM
Unknown Object (File)
Mon, Apr 13, 10:06 PM
Unknown Object (File)
Sat, Apr 11, 4:06 AM
Unknown Object (File)
Fri, Apr 10, 11:29 AM
Unknown Object (File)
Thu, Apr 9, 5:28 PM
Unknown Object (File)
Thu, Apr 9, 2:36 PM
Unknown Object (File)
Thu, Apr 9, 1:51 PM

Details

Summary

The bug occurs because any flags about missing components, generated during conversion of the colour (e.g. HSL->OKLCH it can produce a powerless hue) within are overridden by the source colour's flags.
The change is to make it instead by a disjunction of the source color flag and the flag of the color itself.

Diff Detail

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.

Code analysis found 1 defect in diff 1168443:

  • 1 defect found by file-whitespace (Mozlint)
IMPORTANT: Found 1 defect (error level) that must be fixed before landing.

You can run this analysis locally with:

  • ./mach lint --warnings --outgoing

If you see a problem in this automated review, please report it here.

You can view these defects in the Diff Detail section of Phabricator diff 1168443.

Code analysis found 1 defect in diff 1168450:

  • 1 defect found by file-whitespace (Mozlint)
IMPORTANT: Found 1 defect (error level) that must be fixed before landing.

You can run this analysis locally with:

  • ./mach lint --warnings --outgoing

If you see a problem in this automated review, please report it here.

You can view these defects in the Diff Detail section of Phabricator diff 1168450.

Oriol added inline comments.
servo/components/style/color/mix.rs
258

Why not insert()?

if source.flags.contains(F::C0_IS_NONE) {
    self.flags.insert(F::C0_IS_NONE);
}
emilio requested changes to this revision.Dec 8 2025, 8:49 AM

Thanks! Looks reasonable.

Yeah let's use insert for the flags that are different, and that or something like what I suggested when the components match.

Let's also simplify the test. Is there any reason it needs to go on its own test file?

servo/components/style/color/mix.rs
301

For the ones with the same bit you can even do:

self.flags |= other.flags & F::C1_IS_NONE;

which is a bit easier to read

594

Please fix the lint?

testing/web-platform/tests/css/css-color/color-mix-missing-components-carry-forward.html
3 ↗(On Diff #1168450)

Let's just add this to color-mix-computed or so rather than adding a whole new file?

This revision now requires changes to proceed.Dec 8 2025, 8:49 AM

Good catch! Looks good with the combined testing and .insert issues addressed.

testing/web-platform/tests/css/css-color/color-mix-missing-components-carry-forward.html
13 ↗(On Diff #1168450)

Can you add more tests? Ones that exercise all the combinations? Slightly more effort to figure out which combinations, but would be super helpful to catch these.

zakrok updated this revision to Diff 1168553.
zakrok edited the summary of this revision. (Show Details)
zakrok marked 3 inline comments as done.EditedDec 8 2025, 10:35 AM

Hello 👋:)

I added the changes, took me a bit of attempts to get used to moz-phab (hence the extra random revision that happened x). I added the changes and appended the test to the end of the color-computed-color-mix-function.html file, under a new "subsection".

Edit: Just saw the comment about adding more tests. I will do so later today as soon as possible

This revision is now accepted and ready to land.Dec 8 2025, 12:43 PM