RESOLVED DUPLICATE of bug 91355 42012
Alpha value obtained by getComputedStyle is noticeably less than the actual value.
https://bugs.webkit.org/show_bug.cgi?id=42012
Summary Alpha value obtained by getComputedStyle is noticeably less than the actual v...
Ryosuke Niwa
Reported 2010-07-09 17:47:51 PDT
Created attachment 61124 [details] demonstrates the bug When the background color is set to rgba(255, 255, 0.5), the computed style's background color indicates the actual alpha value to be 0.496094. Firefox returns 0.5 correctly. The bug is demonstrated in the attachment.
Attachments
demonstrates the bug (276 bytes, text/html)
2010-07-09 17:47 PDT, Ryosuke Niwa
no flags
demonstrates issue with getComputedStyle for opacity (651 bytes, text/html)
2010-12-13 01:44 PST, Daniel Wagner
no flags
patrice
Comment 1 2010-09-09 17:04:03 PDT
Also, sometimes, assigning the generated rgba color append to generate a new value : document.body.style.backgroundColor="rgba(0,0,0,0.3)"; "rgba(0,0,0,0.3)" document.body.style.backgroundColor = document.body.style.backgroundColor; "rgba(0, 0, 0, 0.296875)" document.body.style.backgroundColor = document.body.style.backgroundColor; "rgba(0, 0, 0, 0.292969)" document.body.style.backgroundColor = document.body.style.backgroundColor; "rgba(0, 0, 0, 0.292969)"
Daniel Wagner
Comment 2 2010-12-13 01:44:08 PST
Created attachment 76360 [details] demonstrates issue with getComputedStyle for opacity Similarly, if an element's opacity is set to 0.7, getComputedStyle returns 0.699999988079071.
Simon Fraser (smfr)
Comment 3 2010-12-13 10:37:47 PST
I think this is a divide-by-255 vs. 256 issue.
Simon Fraser (smfr)
Comment 4 2010-12-13 14:05:28 PST
Internally rgba(255, 255, 0, 0.5) is stored as 0x7fffff00 (ARGB), and 127/255 is 0.49803921568627. (In reply to comment #2) > Created an attachment (id=76360) [details] > demonstrates issue with getComputedStyle for opacity > > Similarly, if an element's opacity is set to 0.7, getComputedStyle returns 0.699999988079071. This is just floating point rounding error.
Ryosuke Niwa
Comment 5 2012-07-15 20:39:54 PDT
*** This bug has been marked as a duplicate of bug 91355 ***
Note You need to log in before you can comment on or make changes to this bug.