Closed
Bug 347912
Opened 18 years ago
Closed 18 years ago
Computed style omits the 'a' part of rgba/hsla colors.
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: dbaron)
References
()
Details
(Keywords: dataloss, testcase, Whiteboard: [patch])
Attachments
(1 file)
(deleted),
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
Computed style doesn't do the 'a' part of rgba/hsla colors.
With cairo, we apparently added support for rgba/hsla colors, but the computed style implementation wasn't updated accordingly...
Reporter | ||
Comment 1•18 years ago
|
||
If nothing else, this will cause dataloss issues in editor/midas.
Flags: blocking1.9?
Summary: data:text/html,<body onload="alert(document.defaultView.getComputedStyle(document.body, '').color)" style="color: rgba(0, 0, 0, 0.6)">Text → data:text/html,<body onload="alert(document.defaultView.getComputedStyle(document.body, '').color)" style="color: rgba(1, 1, 1, 0.6)">Text
Updated•18 years ago
|
OS: Linux → All
Hardware: PC → All
Summary: data:text/html,<body onload="alert(document.defaultView.getComputedStyle(document.body, '').color)" style="color: rgba(1, 1, 1, 0.6)">Text → Computed style omits the 'a' part of rgba/hsla colors.
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [patch]
Assignee | ||
Comment 2•18 years ago
|
||
I don't care a whole lot about these DOM interfaces (nsIDOMRGBColor), so I just did the smallest thing I could to get things working somewhat sanely. It might have been nicer to have a separate (non-inheriting) interface since rgba colors really aren't rgb colors, and separate objects so that the existing objects wouldn't pick up an alpha property, but I don't think it's worth the extra codesize. We should probably even be thinking about code removal here...
Attachment #252567 -
Flags: superreview?(bzbarsky)
Attachment #252567 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 3•18 years ago
|
||
Note that this patch also implements http://www.w3.org/TR/2003/CR-css3-color-20030514/#transparent , since I wanted that to be the computed value in the alpha==0 cases.
Reporter | ||
Comment 4•18 years ago
|
||
Comment on attachment 252567 [details] [diff] [review]
patch
Looks good!
The interfaces are the ones in DOM CSS. And yes, I agree that they're not great.
Attachment #252567 -
Flags: superreview?(bzbarsky)
Attachment #252567 -
Flags: superreview+
Attachment #252567 -
Flags: review?(bzbarsky)
Attachment #252567 -
Flags: review+
Comment 5•18 years ago
|
||
This should have a mochitest. It would be easy to write.
Flags: in-testsuite?
Assignee | ||
Comment 6•18 years ago
|
||
Checked in to trunk, with visual reftests for rgba and transparent, but no mochitest. (I think I'd have an easier time writing it in reftest with document.write, but I suppose I should figure out how to copy an existing test at some point...)
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 8•18 years ago
|
||
The CSSValue and related interfaces have long been dropped from DOM Level 2 Style fwiw...
Reporter | ||
Comment 9•18 years ago
|
||
That's fine, but there's existing code relying on them, so it's not like we'll be removing them anytime soon. We can just worry less about adding stuff to them.
Comment 10•18 years ago
|
||
This is still broken for me on trunk:
<h3>Hello!</h3>
<script>
h3 = document.getElementsByTagName("h3")[0];
h3.style.color = "rgba(50, 50, 200, 0.7)";
document.write(h3.style.color);
</script>
--> rgb(50, 50, 200)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Reporter | ||
Comment 11•18 years ago
|
||
That's not computed style. Different code; separate bug.
Status: REOPENED → RESOLVED
Closed: 18 years ago → 18 years ago
Resolution: --- → FIXED
Comment 12•18 years ago
|
||
Ok, filed bug 372770 on that.
Updated•17 years ago
|
Flags: in-testsuite?
Flags: in-testsuite+
Flags: blocking1.9?
You need to log in
before you can comment on or make changes to this bug.
Description
•