Bug 48294

Summary: Fix LayoutTests/canvas/philip/tests/2d.composite.uncovered.fill.source-in.html
Product: WebKit Reporter: Mike Lawther <mikelawther>
Component: CanvasAssignee: Carol Szabo <carol>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: carol, excors, ian, jamesr, mdelaney7
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 46506    

Description Mike Lawther 2010-10-25 22:23:20 PDT
This layout tests fails. See master bug: https://bugs.webkit.org/show_bug.cgi?id=46506
Comment 1 Carol Szabo 2010-12-20 16:19:03 PST
I will try to resolve this bug.
But fist I want to make sure that I am on the right track.
I believe that either Philip made an error when setting up this test or may not have a correct interpretation of the standard.
The test verifies that when the globalCompositingOperation is source-in, a fillRect operation clears all the canvas except for the area being filled.
After talking to several people, my belief is that this test is not correct. The compositing operation applies only to pixels that are being composited, that is the pixels that are covered by the fill in this case, thus pixels not covered by the fill should not be touched. I see a difference between one of the pixels being composited to generate a result being transparent and yielding a transparent result and a pixel not being the result of a compositing operation as there is no corresponding source or destination pixel.

By my interpretation the current WebKit behavior is correct. It is the expected result that is not.
By extending the interpretation that is consistent with the current expected result of the test, to source-out or copy, it would mean that if one fills an area outside the bounds of a canvas with a color, the canvas should be extended to show the color in that area, which I again find not to be what the standard designer intended.
Comment 2 James Robinson 2010-12-20 17:32:06 PST
This has been debated many times.  The current spec agrees with Philip's interpretation - the composite operation applies to all pixels in the canvas.  CoreGraphics does not implement this behavior (and it's not clear that it can efficiently) and to the best of my knowledge nobody at Apple wants to change the canvas behavior to match what the spec says.  Chrome behavior follows Safari here.  Firefox and Opera implement what the spec says mostly - although they both deviate in interesting ways in several corner cases.  IE does not support any composite operations yet, so we can't tell what behavior they will have.
Comment 3 Carol Szabo 2010-12-21 10:45:00 PST
After some more discussions and thoughts, it appears that the intended behavior is as demanded by the tests. Shall try to comply. I believe that the reason why there is a spec it is to get people to agree on something and provide common behavior. As far as I know Microsoft signed off on the spec, thus it is expected that IE will implement it, I know Mozilla implements this bit, in this case, I believe that WebKit should conform as well.
Comment 4 Carol Szabo 2010-12-21 14:11:38 PST

*** This bug has been marked as a duplicate of bug 39027 ***