Closed Bug 379316 Opened 13 years ago Closed 13 years ago

[FIX]rgba(0,0,255,4.3) renders with alpha of 0.3 and triggers "ASSERTION: out of range"

Categories

(Core :: CSS Parsing and Computation, defect, P1)

x86
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha5

People

(Reporter: jruderman, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

Attached file testcase
<div style="color: rgba(0,0,255,4.3)">alpha: 4.3 !?</div>

triggers an assertion:

###!!! ASSERTION: out of range: '0.0 <= aAlpha && aAlpha <= 1.0', file /Users/jruderman/trunk/mozilla/layout/style/nsStyleUtil.h, line 87

I'm also not sure Firefox's rendering is correct.  It renders as if alpha were 0.3, which seems wrong to me, but I don't see anything in http://www.w3.org/TR/css3-color/ that specifies how it should render.  (Two reasonable answers would be "clamp the alpha value to 1" and "ignore the entire rgba as invalid".)
http://www.w3.org/TR/css3-color/#alphavaluedt says:

# Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque)
# will be clamped to this range.
This is a regression from bug 372782.  We do the clamping too late, and nsStyleUtil::FloatToColorComponent automatically takes the remainder mod 255 on return, since the return value is a PRUint8.
Blocks: 372782
Attached patch FixSplinter Review
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #263322 - Flags: superreview?(dbaron)
Attachment #263322 - Flags: review?(dbaron)
Priority: -- → P1
Summary: rgba(0,0,255,4.3) renders with alpha of 0.3 and triggers "ASSERTION: out of range" → [FIX]rgba(0,0,255,4.3) renders with alpha of 0.3 and triggers "ASSERTION: out of range"
Target Milestone: --- → mozilla1.9alpha5
Comment on attachment 263322 [details] [diff] [review]
Fix

r+sr=dbaron.  Thanks for fixing this.
Attachment #263322 - Flags: superreview?(dbaron)
Attachment #263322 - Flags: superreview+
Attachment #263322 - Flags: review?(dbaron)
Attachment #263322 - Flags: review+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: blocking1.9? → in-testsuite+
Resolution: --- → FIXED
The last line of the testcase fails on Mac with subpixel anti-aliasing (see bug 379786). I'm not sure how to fix that bug; in the meantime what should we do? Mark the test random on Mac?
How about changing the reftest for this bug to test opacity against opacity and rgba against rgba?
The last line of the test is a control to test that rgba() works at all.  It needs to be tested against opacity.

So we should probably factor it out into a separate test and make that test random on Mac.  I'll do that.
Did that.  That one line is now marked as random on cocoa, pending bug 379786.  Once thats fixed, we should undo it.
You need to log in before you can comment on or make changes to this bug.