Open Bug 372783 Opened 17 years ago Updated 2 years ago

hsl(), hsla(), rgba(0,0,0,0), rgba(x, y, z, 1.0) colors not round-tripped correctly

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned)

References

Details

Attachments

(1 file)

As discussed in bug 372770, hsl() and hsla() colors are not round-tripped correctly by nsCSSDeclaration (e.g., setting and getting the style attribute or a property on element.style), since they are converted to rgb() or rgba().  Furthemore, rgba(0, 0, 0, 0) is converted to 'transparent'.  These should probably not be modified in editing situations.
Also a problem for "rgba(x, y, z, 1.0)".  It ends up as "rgb(x, y, z)".
Summary: hsl(), hsla(), and rgba(0,0,0,0) colors not round-tripped correctly → hsl(), hsla(), rgba(0,0,0,0), rgba(x, y, z, 1.0) colors not round-tripped correctly
Attached file testcase
This shows the bug (compare the second and third columns for what this bug covers).
Assignee: dbaron → nobody
QA Contact: ian → style-system
Is this bug the cause of the following bug?

A div with a hsla background color has in the source viewer opened with "View Selection Source" a rgba background color.

If this isn't the case then I will open another bug for it.
(In reply to comment #3)
> Is this bug the cause of the following bug?

Yes.
Another related question:

What does this return: hsl(34.9,50.9%,57.6%)?
It should return rgb(202,156,92) whereas hsl(35,51%,58%) maps to rbg(203,157,93)

HSL with integer values only allows 3.6 million colors/combinations.  There are 16.8 million RBG colors, which means that there are about 5 (4.661) RBG colors mapped to each integer HSL value.  The CSS 3 color spec doesn't mention fractional HSL values at all.  Nor does it require only integer values.

Does Mozilla do fractional HSL values?
I didn't find this bug when I filed bug 635723 and bug 635724 earlier today. I'm handling the rgba(0, 0, 0, 0) vs. transparent issues there.
Depends on: 635723, 635724
Flags: needinfo?(emilio+bugs)
Whoops, wrong checkbox, sorry for the noise.
Flags: needinfo?(emilio+bugs)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: