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

RESOLVED FIXED in mozilla1.9alpha5

Status

()

P1
normal
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: jruderman, Assigned: bzbarsky)

Tracking

(Blocks: 1 bug, {assertion, testcase})

Trunk
mozilla1.9alpha5
x86
Mac OS X
assertion, testcase
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

12 years ago
Created attachment 263309 [details]
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".)
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
Created attachment 263322 [details] [diff] [review]
Fix
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #263322 - Flags: superreview?(dbaron)
Attachment #263322 - Flags: review?(dbaron)
(Assignee)

Updated

12 years ago
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
Checked in.
Status: ASSIGNED → RESOLVED
Last Resolved: 12 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?
(Reporter)

Comment 7

12 years ago
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.