Having a shadow offset of 1.0,1.0 doesn't seem to produce a shadow anymore (see below). Adding 0.01 to the shadow offsets appears to provide consistent results however. <canvas width="100" height="100" id="c" style="background: lime"></canvas> <script> window.onload = function () { var ctx = document.getElementById('c').getContext('2d'); // ctx.globalCompositeOperation = 'xor'; ctx.shadowColor = 'black'; ctx.shadowBlur = 1.0; ctx.shadowOffsetX = 1.0; ctx.shadowOffsetY = 1.0; ctx.fillStyle = '#f00'; ctx.fillRect(10, 10, 20, 20); } </script>
CanvasRenderingContext2D::applyShadow() needs to have the same extraShadowOffset logic GraphicsContext::setPlatformShadow() has in GraphicsContextCG.cpp to guarantee consistent results.
I have a patch but I cannot generate test results because DRT crashes on every test.
<rdar://problem/5977300>
Created attachment 21452 [details] Account for changes in CoreGraphics shadow behavior; fix recent Y-axis-direction regression The test covers both fixes.
Does SVG have some form of shadows that may require a similar fix?
Comment on attachment 21452 [details] Account for changes in CoreGraphics shadow behavior; fix recent Y-axis-direction regression r=me
Fixed in <http://trac.webkit.org/changeset/34287>.
(In reply to comment #5) > Does SVG have some form of shadows that may require a similar fix? No, but looking for calls to CGContextSetShadow* I just realized that canvas has many more which may need to be patched as well.
Additional related fixes landed in <http://trac.webkit.org/changeset/34317>.