Closed Bug 1363974 Opened 7 years ago Closed 7 years ago

stylo: Alpha channel of color is rounded incorrectly

Categories

(Core :: CSS Parsing and Computation, defect)

53 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1340484

People

(Reporter: xidorn, Unassigned)

References

Details

The following page:
<div id="test"></div>
<script>
test.style.color = 'rgba(0, 0, 0, 0.1)';
alert(getComputedStyle(test).color);
</script>

shows "rgba(0, 0, 0, 0.098)" in Stylo but "rgba(0, 0, 0, 0.1)" in Gecko.

Apparently Stylo's behavior is undesired here.

layout/style/test/test_computed_style.html checks this.
Manish, since you are handling color rounding issue recently, I guess you may have some insight to this.
Flags: needinfo?(manishearth)
Known and being fixed in bug 1340484
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(manishearth)
Resolution: --- → DUPLICATE
I'd note that the Gecko serialization behavior here is quite subtle, and uses different numbers of decimal places depending on what will round-trip correctly.  See nsStyleUtil::ColorComponentToFloat.
Yeah, but these specific numbers are just the rounding behavior (in fact the rounding of 0.1 is how I found the original bug). That alpha value renders differently in servo and gecko.

Serializing is another beast, and I have not yet fixed that part. Feel free to reopen this just for the serialization thing.
You need to log in before you can comment on or make changes to this bug.