Closed Bug 515919 Opened 15 years ago Closed 11 months ago

style system should store colors allowing larger gamut (and more precision)

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Unassigned)

References

(Depends on 2 open bugs)

Details

The style system should store colors as floats (rather than clamping to sRGB at parse time) for three reasons: 1. when we do full-page color management, some of the outside-sRGB colors will be representable 2. animations between colors should clamp at the correct point 3. additive animations (SMIL) should function for negative color components When we do this we should fix the FIXME comment in http://hg.mozilla.org/mozilla-central/rev/e98277a9cec4
I just discussed this with vlad; I think we settled on the idea that it would make more sense (space-wise) to use something like signed 4.12 fixed point (treating sRGB as being 0-1), so that a single color value would fit in 64 bits. (If we used gfxRGBA, it would be 256 bits; if we used a similar structure that had floats instead of doubles, it would be 128 bits.) I think that would address all the practical cases here (and potentially allow feeding more precision to cairo if it ever supports that additional precision on the other end, although not the full 16-bits-per-component precision).
Summary: style system should store colors as floats → style system should store colors allowing larger gamut (and more precision)
Actually, I think changes in css-color-4 make this mostly invalid, since colors are now supposed to be clamped to 0-255, but we should implement the new stuff that replaces it.
Depends on: 1299366
Are we still going to use real numbers for colors? Would that affect how complex color for interpolation should look like?
Flags: needinfo?(dbaron)
There probably still is value in using higher precision to represent fractional values within 0-255, although I suspect fixed point may be preferable to floats. I'm not sure what you mean about complex color and interpolation.
Flags: needinfo?(dbaron)
Severity: normal → S3

The [css-color-4] spec was implemented along with gamut mapping, so closing this issue as we now have float value colors.

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