Created attachment 8861195 [details] plot.png When parsing colors like rgb(10%, 10%, 10%), or `rgba(0,0,0,0.1)`, Gecko multiplies by 255 and rounds. http://searchfox.org/mozilla-central/rev/313e5199bf58200f158c6fcbe193e41b88ed58a6/layout/style/nsCSSValue.cpp#3189 Servo and Chrome multiply by 256 and floor (and then clamp to 255, so that the input of 1.0 produces a result within bounds). This is more correct: The function has an equal distribution of values in the range to the domain. On the other hand, Gecko's function has fewer numbers mapping to 0 and 255 and the numbers in between get a larger domain each. This means that `rgb(10%, 10%, 10%)` is `rgb(25,25,25)` in servo and chrome, but `rgb(26, 26,26)` in gecko. Similarly, `rgba(0,0,0,0.1)` maps to different alpha values. (As a result, in Stylo, `rgba(0,0,0,0.1)` computes to `rgba(0,0,0,0.098)` since we still use nscolor but map the correct values into it, but Gecko's serialization assumes the flawed mapping) Try at https://treeherder.mozilla.org/#/jobs?repo=try&revision=4708b2339447d70af11f20d7e4bca3369df82380 This is a behavioral change, not sure if I should email dev.tech.layout.
Summary: Float/percentage color rounding is unfair and wrong → Float/percentage color rounding is unfairly distributed/wrong
Manish, could you move your patch to Bug 1340484? Thanks.
Status: NEW → RESOLVED
Last Resolved: 11 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1340484
You need to log in before you can comment on or make changes to this bug.