Re: Radial gradients in <canvas>

Anne van Kesteren wrote:
> To quote from an internal 
> discussion: "IMO having an inner circle that goes outside the outer 
> circle is a bug in the script and I would prefer to just throw an error 
> if that happens.

In that case, authors would have to remember/discover that
   ctx.createRadialGradient(10, 10, 100, 20, 20, 0)
is an error and has to be rewritten as
   ctx.createRadialGradient(20, 20, 0, 10, 10, 100)

Under the current spec, those are equivalent if one circle is inside the 
other, which makes it easier for authors to get it working like they expect.

(The cases when neither circle is inside the other seem pretty obscure 
to me, so I don't think the behaviour matters much there.)

 From a UA's perspective, throwing errors in certain cases seems 
slightly dangerous, since code written for 'old' (i.e. current) browsers 
may (intentionally or accidentally) trigger those cases and will not be 
expecting an exception. If a UA starts throwing in those cases, the 
whole application is likely to break (see e.g. 
<http://bugs.webkit.org/show_bug.cgi?id=13537>), whereas the problems 
are much less significant if it simply renders an incorrect colour in a 
few places.

-- 
Philip Taylor
pjt47@cam.ac.uk

Received on Friday, 26 October 2007 12:54:15 UTC