Bug 19344

Summary: Regression: Shadow offsets seem to have changed in 10.5.3 in canvas
Product: WebKit Reporter: Francisco Tolmasky <tolmasky>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: mitz, mrowe
Priority: P1 Keywords: HasReduction, InRadar, Regression
Version: 525.x (Safari 3.1)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Account for changes in CoreGraphics shadow behavior; fix recent Y-axis-direction regression darin: review+

Description Francisco Tolmasky 2008-05-31 01:43:09 PDT
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>
Comment 1 mitz 2008-05-31 11:09:14 PDT
CanvasRenderingContext2D::applyShadow() needs to have the same extraShadowOffset logic GraphicsContext::setPlatformShadow() has in GraphicsContextCG.cpp to guarantee consistent results.
Comment 2 mitz 2008-05-31 12:18:16 PDT
I have a patch but I cannot generate test results because DRT crashes on every test.
Comment 3 Mark Rowe (bdash) 2008-05-31 16:12:43 PDT
<rdar://problem/5977300>
Comment 4 mitz 2008-05-31 16:16:14 PDT
Created attachment 21452 [details]
Account for changes in  CoreGraphics shadow behavior; fix recent Y-axis-direction regression

The test covers both fixes.
Comment 5 Mark Rowe (bdash) 2008-05-31 17:24:26 PDT
Does SVG have some form of shadows that may require a similar fix?
Comment 6 Darin Adler 2008-06-01 12:31:25 PDT
Comment on attachment 21452 [details]
Account for changes in  CoreGraphics shadow behavior; fix recent Y-axis-direction regression

r=me
Comment 7 mitz 2008-06-01 12:47:47 PDT
Fixed in <http://trac.webkit.org/changeset/34287>.
Comment 8 mitz 2008-06-02 11:40:12 PDT
(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.
Comment 9 mitz 2008-06-02 13:01:57 PDT
Additional related fixes landed in <http://trac.webkit.org/changeset/34317>.