Closed Bug 1328224 Opened 7 years ago Closed 6 years ago

getComputedStyle() should return rgba(0, 0, 0, 0) for 'transparent' keyword

Categories

(Core :: DOM: CSS Object Model, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1339394

People

(Reporter: sebo, Unassigned)

References

()

Details

The CSS Color 3 spec. says that the computed value of the 'transparent' color keyword is 'rgba(0, 0, 0, 0)'[1] and CSSOM defines the resolved value of several color properties returned by getComputedStyle() as the used value[2]. CSS Color 4 even defines it as 'rgba(0 0 0 / 0)'[3].

Gecko currently returns the 'transparent' keyword, though. So, this needs to be changed accordingly.

This issue came up in bug 1063162 comment 72. According to Xidorn[4], the related code[5] is very old.

Sebastian

[1] https://www.w3.org/TR/css3-color/#transparent-def
[2] https://drafts.csswg.org/cssom/#resolved-values
[3] https://drafts.csswg.org/css-color-4/#transparent-color
[4] Bug 1063162 comment 74
[5] https://dxr.mozilla.org/mozilla-central/rev/c91249f41e3766274131a84f9157a4d9d9949520/layout/style/nsComputedDOMStyle.cpp#973-976
Note that while it is clear in the spec[1] that color properties should be serialized as the used value in getComputedStyle(), it isn't clear what the serialization is supposed to look like, and there is an open issue about that[2].

[1] https://www.w3.org/TR/cssom-1/#resolved-values
[2] https://github.com/w3c/csswg-drafts/issues/480
Oh, and we return 'transparent' for 'rgba(0, 0, 0, 0)' for specified value as well, which I guess worth fixing in this bug at the same time.
Priority: -- → P3
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.