A fillStyle bug on Chrome canvas

178 views
Skip to first unread message

Akira Kuroiwa

unread,
Feb 23, 2022, 1:33:29 AM2/23/22
to Chromium-dev
Hi, I found a fillStyle bug on Chrome canvas. 

When assigning "rgba(255, 0, 0, 0.5)" to ctx.fillStyle (ctx is a context of a canvas here) on Chrome for PC, the value is automatically changed to "rgba(255, 0, 0, 0.501960784313726)", where the other browsers (Firefox, Safari, Chrome) are "rgba(255, 0, 0, 0.5)". 
Please see a PoC below for details.

I think the alpha value 0.501960784313726 is basically came from 128 / 255, however, the detail is unknown. (It may be related to some decimal rounding problem, because the changed value takes discrete values when we give 0.005883 and 0.05882999999999)

Environments:
- Windows:
  - Chrome 98.0.4758.102 -> incorrect value
  - Firefox 97.0.1 -> correct value
  - Edge 98.0.1108.56 -> incorrect value
- Mac:
  - Chrome 98.0.4758.102 -> incorrect value
  - Firefox 96.0.3  -> correct value
  - Safari 17612.3.6.1.6  -> correct value
- Android:
  - Chrome 98.0.4758.101 -> incorrect value
- iOS:
  - Chrome 98.0.4758.97 -> correct value

PoC result images:
Windows.pngMac.jpgAndroid_Chrome.pngiOS_Chrome.jpg

0.00582999999999 vs. 0.00583:
005882999999999.png005883.png

thanks!

Lei Zhang

unread,
Feb 23, 2022, 1:51:09 AM2/23/22
to kurok...@gmail.com, Chromium-dev
Please use Chromium's bug tracker to report bugs. https://new.crbug.com/

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/36fdff80-7928-4e5b-867b-9b8fd27368d4n%40chromium.org.

Akira Kuroiwa

unread,
Feb 25, 2022, 5:48:25 PM2/25/22
to Chromium-dev, Lei Zhang, Chromium-dev, Akira Kuroiwa
Thank you, and I reported the isuue on bug tracker.
2022年2月23日水曜日 15:51:09 UTC+9 Lei Zhang:
Reply all
Reply to author
Forward
0 new messages