Bug 132949

Summary: [CANVAS] Gradients don't apply correctly in combination with some compositing modes
Product: WebKit Reporter: Branimir Lambov <blambov>
Component: CanvasAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: nikos.andronikos
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: Unspecified   
URL: http://jsfiddle.net/386sM/1/
Attachments:
Description Flags
Safari rendering
none
Expected rendering none

Description Branimir Lambov 2014-05-15 05:16:38 PDT
The linked fiddle tries to draw a stroke with a paint that requires transformation by drawing a black stroke followed by a 'source-in' fill, where the paint is a linear gradient.

Safari incorrectly paints the stroke in the final color of the gradient instead of rendering the gradient. This happens when source-in, source-out or destination-atop compositing mode is used.

The fiddle should result in two rectangles that look the same (the second one is stroked using the gradient directly, which is not always possible (e.g. for radial gradients with non-uniform scales)). The test works fine on Chrome on any platform, as well as Firefox and Opera on Linux. It fails on Safari MacOS and iOS (tested on MacOS 10.9.2, version 7.0.3, as well as iOS 7.1.1).

See also
http://jsfiddle.net/386sM/2/  (using source-atop to work around the problem for opaque paints, also swapping + destination in which is even more broken)
http://jsfiddle.net/386sM/5/  (testing all compositing modes for fill() and stroke())
Comment 1 Branimir Lambov 2014-05-15 05:17:28 PDT
Created attachment 231501 [details]
Safari rendering
Comment 2 Branimir Lambov 2014-05-15 05:17:59 PDT
Created attachment 231502 [details]
Expected rendering
Comment 3 Branimir Lambov 2014-05-15 05:22:24 PDT
Note: the Safari output is also affected by
https://bugs.webkit.org/show_bug.cgi?id=132948
Comment 4 Nikos Andronikos 2014-07-24 17:23:06 PDT

*** This bug has been marked as a duplicate of bug 129791 ***
Comment 5 Nikos Andronikos 2014-07-24 17:31:24 PDT
(In reply to comment #4)
> 
> *** This bug has been marked as a duplicate of bug 129791 ***

Wrong duplicate entry - however I have checked that the issue was fixed before  before revision 170906