Closed Bug 2070541 Opened 2 months ago Closed 2 months ago

[wpt-sync] Sync PR 62494 - [CSS] Handle color-mix() and palette-mix() percentages adding up to zero

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 62494 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/62494
Details from upstream follow.

Felipe Erias <felipeerias@igalia.com> wrote:

[CSS] Handle color-mix() and palette-mix() percentages adding up to zero

When the two percentages of color-mix() add up to zero, CSS Color 5
specifies a progress percentage of 0.5 and an alpha multiplier of 0,
so the result is transparent.

https://www.w3.org/TR/css-color-5/#color-mix-result
https://github.com/w3c/csswg-drafts/issues/14013

CSS Fonts 4 applies the same rules to palette-mix().

https://www.w3.org/TR/css-fonts-4/#font-palette-prop

Blink rejected color-mix() and palette-mix() at parse time when both
percentages were literally 0%. When the zero sum came from calc()
instead, the values parsed but percentage normalization reported
failure. Then color-mix() went on with a progress percentage of 0,
and palette-mix() was replaced by the normal palette, as if the value
had not been specified.

Remove the parse-time rejection. Make
CSSColorMixValue::NormalizePercentages() always produce a progress
percentage and an alpha multiplier, using 0.5 and 0 for a zero sum. Keep
a palette mix with equal endpoints when the alpha multiplier is not 1,
as collapsing it into a single palette would drop the multiplier.

Tests:
external/wpt/css/css-color/parsing/color-valid-color-mix-function.html
external/wpt/css/css-color/parsing/color-computed-color-mix-function.html
StyleBuilderConverterTest.ResolveColorValue_ZeroCombinedPercentage
StyleBuilderConverterPageTest.PaletteMix_ZeroCombinedPercentage

Bug: 445726759
Change-Id: I79682e00f313722a09f3a9a337aac4eabd0cb0c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8337347
Commit-Queue: Felipe Erias \<felipeerias@igalia.com>
Reviewed-by: Anders Hartvoll Ruud \<andruud@chromium.org>
Reviewed-by: Kevin Babbitt \<kbabbitt@microsoft.com>
Reviewed-by: Rune Lillesveen \<futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1693091}

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Attached file Notable wpt changes —

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 45 tests and 27 subtests

Status Summary

Firefox

OK : 1[GitHub] 45[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 893[GitHub] 10896[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 65[GitHub] 1214[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 1
PASS: 878
FAIL: 80

Safari

OK : 1
PASS: 951
FAIL: 7

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

Firefox-only Failures

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: