[Webkit-unassigned] [Bug 102654] Zero size gradient should paint nothing on canvas

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 2 10:08:11 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=102654





--- Comment #17 from Dirk Schulze <krit at webkit.org>  2013-01-02 10:10:11 PST ---
> Webkit(checked on windows port) does not conform to SVG spec.
> FireFox conforms to SVG spec. I used the below test to check the conformance to SVG spec - 
> 
> In the test - http://w3c-test.org/html/tests/approved/canvas/2d.gradient.interpolate.zerosize.fill.html , replace the _addTest function-definition with the below definition, to check conformance to SVG spec :
> 
> _addTest(function(canvas, ctx) {
> 
> ctx.fillStyle = 'blue';
> ctx.fillRect(0, 0, 100, 50);
> 
> var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction)
> g.addColorStop(0, 'yellow');
> g.addColorStop(1, 'rgb(0,255,0)');
> ctx.fillStyle = g;
> ctx.rect(0, 0, 100, 50);
> ctx.fill();
> _assertPixel(canvas, 40,20, 0,255,0,255, "40,20", "0,255,0,255");

Hm, I actually can not confirm the behavior:

<html>
<canvas id="c" width="100" height="100"></canvas>
<script>
    var ctx = document.getElementById('c').getContext('2d');
    var lingrad = ctx.createLinearGradient(50,50,50,50);
    lingrad.addColorStop(0, 'yellow');
    lingrad.addColorStop(0.5, 'blue');
    lingrad.addColorStop(1, 'green');
    ctx.strokeRect(0,0,100,100);
    ctx.fillStyle = lingrad;
    ctx.fillRect(0,0,100,100);
</script>
</html>​

See http://fiddle.jshell.net/kHnnJ/1/

Firefox draws a vertical green stripe next to a vertical yellow stripe. This is not correct according to SVG or Canvas spec.

Safari and Chrome don't paint anything.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list