Re: [whatwg] [canvas] Proposal for supportsContext

2012-10-22 Thread Ian Hickson
On Mon, 22 Oct 2012, Glenn Maynard wrote: > On Mon, Oct 22, 2012 at 6:36 PM, Ian Hickson wrote: > > > > > > If you really want to protect users from the behavior of pages, > > > you'd really need to make creating the context cheap. For example, > > > don't switch to a high-power GPU until the

Re: [whatwg] [canvas] Proposal for supportsContext

2012-10-22 Thread Glenn Maynard
On Mon, Oct 22, 2012 at 6:36 PM, Ian Hickson wrote: > > If you really want to protect users from the behavior of pages, you'd > > really need to make creating the context cheap. For example, don't > > switch to a high-power GPU until the page actually draws something, > > and--since many pages u

Re: [whatwg] [canvas] Proposal for supportsContext

2012-10-22 Thread Ian Hickson
On Mon, 10 Sep 2012, Dean Jackson wrote: > > I propose adding a new method to HTMLCanvasElement: > > interface HTMLCanvasElement : HTMLElement { > boolean supportsContext(DOMString contextId, any... arguments); > }; > > supportsContext takes the same parameters as getContext, and simply > ret

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-11 Thread Glenn Maynard
On Tue, Sep 11, 2012 at 3:50 AM, Tobie Langel wrote: > I actually like Ashley Gullen's proposal (canPlayType-inspired) > because it brings consistency to the platform and offers a general > pattern on how to test for the presence of features which can't be > asserted for certain without costly loo

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-11 Thread Tobie Langel
On Tue, Sep 11, 2012 at 10:34 AM, Simon Pieters wrote: > On Tue, 11 Sep 2012 00:14:25 +0200, Glenn Maynard wrote: >> If you really want to protect users from the behavior of pages, you'd >> really need to make creating the context cheap. > > This was exactly my reaction as well. Introducing a new

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-11 Thread Simon Pieters
On Tue, 11 Sep 2012 00:14:25 +0200, Glenn Maynard wrote: Expecting pages to use a supportsContext API is still expecting pages to behave nicely. If you really want to protect users from the behavior of pages, you'd really need to make creating the context cheap. This was exactly my reaction

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Paul Irish
On Mon, Sep 10, 2012 at 3:14 PM, Glenn Maynard wrote: > > (By the way, I'm not sure about it being "bad practice" to create a context > in advance. It's just standard feature testing, which is exactly how > JavaScript developers have been taught to detect features. > Indeed, js developers are g

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Glenn Maynard
On Mon, Sep 10, 2012 at 2:39 PM, Dean Jackson wrote: > > Can't Modernizr just lazy load the WebGL context? (i.e. only try to > create a context if the web page actually asks if WebGL is supported) > > Yes, it could. But we don't control Modernizr or any other scripts people > might use. I'd rath

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Ashley Gullen
On 10 September 2012 20:39, Dean Jackson wrote: > > On Sep 10, 2012, at 12:35 PM, Ashley Gullen wrote: > > Can't Modernizr just lazy load the WebGL context? (i.e. only try to > create a context if the web page actually asks if WebGL is supported) > > > Yes, it could. But we don't control Modern

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Mike Taylor
On Mon, 10 Sep 2012 13:14:30 -0500, Dean Jackson wrote: To give a real world example, the popular tool Modernizr tests for the availability of WebGL by attempting to create a WebGL context. This can happen even on pages that have no intention of using WebGL - an author has just inserted Mode

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Dean Jackson
On Sep 10, 2012, at 1:03 PM, Rick Waldron wrote: > > > On Mon, Sep 10, 2012 at 3:56 PM, Tobie Langel wrote: > > This is actually what we could do now. We could hide > > window.WebGLRenderingContext > > when we can't create one. But then we'd have to hide all these too: > > > >attribu

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Rick Waldron
On Mon, Sep 10, 2012 at 3:56 PM, Tobie Langel wrote: > > This is actually what we could do now. We could hide > window.WebGLRenderingContext > > when we can't create one. But then we'd have to hide all these too: > > > >attribute [Conditional=WEBGL] WebGLActiveInfoConstructor > WebGLActive

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Tobie Langel
> This is actually what we could do now. We could hide > window.WebGLRenderingContext > when we can't create one. But then we'd have to hide all these too: > >attribute [Conditional=WEBGL] WebGLActiveInfoConstructor > WebGLActiveInfo; >attribute [Conditional=WEBGL] WebGLBufferCons

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Dean Jackson
On Sep 10, 2012, at 12:44 PM, Tobie Langel wrote: >>> What about enabling feature detection by providing a method per context? >>> >>> interface HTMLCanvasElement : HTMLElement { >>> object get2DContext(); >>> object getWebGLContext(any... args); >>> }; >>> >>> That way, developers can use idi

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Tobie Langel
On Sep 10, 2012, at 9:32 PM, Dean Jackson wrote: > > On Sep 10, 2012, at 12:28 PM, Tobie Langel wrote: > >> On Sep 10, 2012, at 8:14 PM, Dean Jackson wrote: >> >>> I propose adding a new method to HTMLCanvasElement: >>> >>> interface HTMLCanvasElement : HTMLElement { >>> boolean supportsContext

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Dean Jackson
On Sep 10, 2012, at 12:35 PM, Ashley Gullen wrote: > Can't Modernizr just lazy load the WebGL context? (i.e. only try to create a > context if the web page actually asks if WebGL is supported) Yes, it could. But we don't control Modernizr or any other scripts people might use. I'd rather pro

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Ashley Gullen
Can't Modernizr just lazy load the WebGL context? (i.e. only try to create a context if the web page actually asks if WebGL is supported) On the other hand I would love to see a supportsContext function which can tell if WebGL is software rendered (i.e. Swiftshader in Chrome). There's been a lot

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Dean Jackson
On Sep 10, 2012, at 12:28 PM, Tobie Langel wrote: > On Sep 10, 2012, at 8:14 PM, Dean Jackson wrote: > >> I propose adding a new method to HTMLCanvasElement: >> >> interface HTMLCanvasElement : HTMLElement { >> boolean supportsContext(DOMString contextId, any... arguments); >> }; >> >> suppo

Re: [whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Tobie Langel
On Sep 10, 2012, at 8:14 PM, Dean Jackson wrote: > I propose adding a new method to HTMLCanvasElement: > > interface HTMLCanvasElement : HTMLElement { > boolean supportsContext(DOMString contextId, any... arguments); > }; > > supportsContext takes the same parameters as getContext, and simply re

[whatwg] [canvas] Proposal for supportsContext

2012-09-10 Thread Dean Jackson
I sent this to the public-h...@w3.org list: http://www.w3.org/mid/b2fff68c-cd91-4273-8087-ec3058d24...@apple.com Copied below. [[[ I propose adding a new method to HTMLCanvasElement: interface HTMLCanvasElement : HTMLElement { boolean supportsContext(DOMString contextId, any... arguments); }