Percent normalization incorrect in color-mix()
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Tracking
()
People
(Reporter: chris, Unassigned, Mentored)
References
Details
(Keywords: good-first-bug)
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
Steps to reproduce:
I created a test for wpt and Firefox failed one subtest, where percentages add to more than 100%.
I created a second test to explore this in more detail and Firefox fails all the subtests where percentages sum to more than 100
Actual results:
It looks as if there is no percentage normalization happening. Instead, the first percentage is taken as-is and the second one is ignored and computed as 100% minus the first percentage?
Expected results:
https://drafts.csswg.org/css-color-5/#color-mix
Let p1 be the first percentage and p2 the second one.
If both percentages are omitted, they each default to 50% (an equal mix of the two colors).
Otherwise, if p2 is omitted, it becomes 100% - p1
Otherwise, if p1 is omitted, it becomes 100% - p2
If the percentages sum to zero, the function is invalid.
Otherwise, if both are provided and add up to greater than 100%, they are scaled accordingly so that they add up to 100%.
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Relevant code is here and this should be trivial to fix by checking whether left_weight and right_weight add up to more than 1 (and acting accordingly).
related WPT PR for these two tests
https://github.com/web-platform-tests/wpt/pull/32084
Comment 5•4 years ago
|
||
The severity field is not set for this bug.
:emilio, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Comment 6•4 years ago
|
||
Bug 1770616 does this.
Description
•