WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
Bug 60091
The canvas spec models an edge case after an old bug in CG
https://bugs.webkit.org/show_bug.cgi?id=60091
Summary
The canvas spec models an edge case after an old bug in CG
Matthew Delaney
Reported
2011-05-03 17:27:44 PDT
It appears that this edge case in the canvas spec... "Shadows are only drawn if the opacity component of the alpha component of the color of shadowColor is non-zero and either the shadowBlur is non-zero, or the shadowOffsetX is non-zero, or the shadowOffsetY is non-zero." ...is modeled after a bug that CG had/has. In destination-atop, the shadow should be rendered atop the source. However, if you have a shadowBlur of 0 (or very close to 0), then CG will just not render the shadow. The philip canvas test suite has a test to check for this edge case at:
http://philip.html5.org/tests/canvas/suite/tests/2d.shadow.enable.off.2.html
Here's a testcase that jamesr constructed that shows the discontinuity of varying the shadow blur from 20 down to 0. Notice that it switches all of a sudden to all blue at the end, where it should instead have an all red shadow rect on top.
http://webstuff.nfshost.com/shadowblur.html
Looking around, it appears that the only browsers that support this faulty edge case are FireFox4 (not before 4 though), WebKit browsers that use CG (and also Skia, jamesr tells me). My proposal is to: 1) Change the spec by stripping out this edge case paragraph. 2) Notify Firefox team that they should strip out this hack in their code for the edge case. 3) Remove the hack also from Skia. 4) File a bug against CG on this faulty behavior (just did that) and hope that it can be fixed in future releases. 5) In GraphicsContextCG, "fix" this faulty behavior for all OSes that don't this possible future CG fix (via Gestalt). 6) Tell philip/W3C to update his/the test at
http://philip.html5.org/tests/canvas/suite/tests/2d.shadow.enable.off.2.html
/
http://w3c-test.org/html/tests/approved/canvas/2d.shadow.enable.off.2.html
7) Remove the GraphicsContextCG "fix" in a few thousands years if/when we no longer need to support the broken CG.
Attachments
Add attachment
proposed patch, testcase, etc.
James Robinson
Comment 1
2011-05-03 17:34:43 PDT
(In reply to
comment #0
)
> My proposal is to: > 1) Change the spec by stripping out this edge case paragraph. > 2) Notify Firefox team that they should strip out this hack in their code for the edge case. > 3) Remove the hack also from Skia. > 4) File a bug against CG on this faulty behavior (just did that) and hope that it can be fixed in future releases. > 5) In GraphicsContextCG, "fix" this faulty behavior for all OSes that don't this possible future CG fix (via Gestalt). > 6) Tell philip/W3C to update his/the test at
http://philip.html5.org/tests/canvas/suite/tests/2d.shadow.enable.off.2.html
/
http://w3c-test.org/html/tests/approved/canvas/2d.shadow.enable.off.2.html
> 7) Remove the GraphicsContextCG "fix" in a few thousands years if/when we no longer need to support the broken CG.
Can you also start a thread on the WHATWG list explaining this proposal? Other vendors might have input that could alter this plan. This seems fine to me, however, unless we discover that there is some content that depends on the current behavior that we have to support.
Matthew Delaney
Comment 2
2012-01-26 12:16:04 PST
For reference, here's the thread. The current stance is to keep the spec as-is.
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-May/031457.html
Dirk Schulze
Comment 3
2014-04-04 13:27:24 PDT
We do not have interoperable behavior here. Safari has a shadow at the beginning which disappears at the end. Same for Blink. Firefox just has an inset like shadow.
Dirk Schulze
Comment 4
2014-04-05 14:08:01 PDT
Ok,
http://webstuff.nfshost.com/shadowblur.html
definitely shows a weird behavior cross platform. It might better if the canvas spec describes better if the shadow is a separate drawing operation or belongs to the object that is drawn. Currently browsers are not interoperable on that. However, the initial bug report is invalid. WebKit behaves as specified and does not draw the shadow if opacity == 0. It does not seem that the spec will change.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug