Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-12-07 Thread Ian Hickson
On Wed, 8 Sep 2010, Boris Zbarsky wrote: Consider this testcase: !doctype html html body canvas id=c width=200 height=200/canvas script try { var c = document.getElementById(c), t = c.getContext(2d); t.moveTo(100, 100); t.lineTo(NaN, NaN);

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Oliver Hunt
The problem with throwing an exception is that it's fairly common for code to end up accidentally producing a NaN or Infinite value, and throwing an exception would prevent all subsequent drawing from occurring. I suggested this behaviour a long time ago after running into yet another piece of

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Eric Uhrhane
On Wed, Sep 8, 2010 at 9:45 AM, Oliver Hunt oli...@apple.com wrote: The problem with throwing an exception is that it's fairly common for code to end up accidentally producing a NaN or Infinite value, and throwing an exception would prevent all subsequent drawing from occurring. I believe

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Oliver Hunt
On Sep 8, 2010, at 10:20 AM, Eric Uhrhane wrote: On Wed, Sep 8, 2010 at 9:45 AM, Oliver Hunt oli...@apple.com wrote: The problem with throwing an exception is that it's fairly common for code to end up accidentally producing a NaN or Infinite value, and throwing an exception would prevent

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Boris Zbarsky
On 9/8/10 12:45 PM, Oliver Hunt wrote: I suggested this behaviour a long time ago after running into yet another piece of code that hit this case in webkit (back when the spec said to throw an exception) yet firefox and opera did not throw. In some cases firefox does throw, and in others it

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Mike Shaver
On Wed, Sep 8, 2010 at 10:33 AM, Oliver Hunt oli...@apple.com wrote: In a lot of cases all you want to do is ignore NaN and Infinite values, otherwise you basically have to prepend every call to canvas with NaN and Infinity checks if you're computing values unless you can absolutely

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Boris Zbarsky
On 9/8/10 1:33 PM, Oliver Hunt wrote: Additionally there is content that depends on the non-throwing behaviour, in webkit we had to drop the exceptions that we threw due to content that worked in firefox because of the absence of exceptions. I'm really curious about this claim. Looking at

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Oliver Hunt
On Sep 8, 2010, at 11:00 AM, Boris Zbarsky wrote: On 9/8/10 12:45 PM, Oliver Hunt wrote: I suggested this behaviour a long time ago after running into yet another piece of code that hit this case in webkit (back when the spec said to throw an exception) yet firefox and opera did not throw.

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Boris Zbarsky
On 9/8/10 2:22 PM, Oliver Hunt wrote: I can see a number of canvas discussions in late 2007/early 2008 on the whatwg list, so i presume that covers some of it. OK. All versions of Firefox threw at that point. It also only leads to incorrect rendering if the behaviour if it's unexpected.

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Philip Taylor
On Wed, Sep 8, 2010 at 9:02 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 9/8/10 2:22 PM, Oliver Hunt wrote: One old case that failed in the presence of exceptions was the old canvex demo at http://canvex.lazyilluminati.com/83/play.xhtml - this was one of the first cases i saw after trying to

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-08 Thread Boris Zbarsky
On 9/8/10 7:04 PM, Philip Taylor wrote: I think the relevant bug is https://bugs.webkit.org/show_bug.cgi?id=13537 which was actually caused by passing 0 sizes to drawImage, not by non-finite values. Ah, yes. The drawImage size check for 0 in Gecko is still nonthrowing, and has never thrown to

[whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-07 Thread Boris Zbarsky
Consider this testcase: !doctype html html body canvas id=c width=200 height=200/canvas script try { var c = document.getElementById(c), t = c.getContext(2d); t.moveTo(100, 100); t.lineTo(NaN, NaN); t.lineTo(50, 25); t.stroke(); } catch (e)

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-07 Thread Sam Weinig
In 4.8.11.1 the spec does state: Except where otherwise specified, for the 2D context interface, any method call with a numeric argument whose value is infinite or a NaN value must be ignored. -Sam On Sep 7, 2010, at 9:41 PM, Boris Zbarsky wrote: Consider this testcase: !doctype html

Re: [whatwg] Canvas API: What should happen if non-finite floats are used

2010-09-07 Thread Jonas Sicking
This seems like a strange choice of behavior. Given that this is very likely a bug in the program, wouldn't it make more sense to throw an exception as to make it easier to debug? Similar to for example Node.appendChild when called with a null argument. / Jonas On Tue, Sep 7, 2010 at 10:32 PM,