[whatwg] Proposal: createImageBitmap should return a Promise instead of using a callback

2013-06-19 Thread Justin Novosad
I was about to launch the implementation of window.createImageBitmap in Blink, and I received feedback on the blink-dev mailing list that the Promise API is the wave of the future for asynchronous JS, and that the new createImageBitmap method should use Promises. Current spec:

Re: [whatwg] @aria-labelledby | Re: @generator-unable-to-provide-required-alt, figure with figcaption

2013-06-19 Thread Martin Janecke
Am 17.06.2013 um 22:58 schrieb Ian Hickson: On Mon, 17 Jun 2013, Martin Janecke wrote: Am 17.06.2013 um 11:35 schrieb Steve Faulkner: the restriction on figure/figcaption is only in the whawtg spec not the W3C HTML spec as it was not deemed a useful or practical restriction when reviewed

[whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Benoit Jacob
Dear list, I'd like to question the usefulness of canvas.supportsContext. I tried to think of an actual application use case for it, and couldn't find one. It also doesn't seem like any valid application use case was given on this list when this topic was discussed around September 2012. The

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Tab Atkins Jr.
On Wed, Jun 19, 2013 at 11:17 AM, Benoit Jacob jacob.benoi...@gmail.com wrote: So let's look at the naive application usage pattern for supportsContext: if (canvas.supportsContext(webgl)) { context = canvas.getContext(webgl); } The problem is that the same can be achieved with just

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Benoit Jacob
2013/6/19 Tab Atkins Jr. jackalm...@gmail.com On Wed, Jun 19, 2013 at 11:17 AM, Benoit Jacob jacob.benoi...@gmail.com wrote: So let's look at the naive application usage pattern for supportsContext: if (canvas.supportsContext(webgl)) { context = canvas.getContext(webgl); }

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Boris Zbarsky
On 6/19/13 2:17 PM, Benoit Jacob wrote: The closest thing that I could find being discussed, was use cases by JS frameworks or libraries that already expose similar feature-detection APIs. However, that only shifts the question to: what is the reason for them to expose such APIs? I _think_ the

Re: [whatwg] @aria-labelledby | Re: @generator-unable-to-provide-required-alt, figure with figcaption

2013-06-19 Thread Ian Hickson
On Wed, 19 Jun 2013, Martin Janecke wrote: Am 17.06.2013 um 22:58 schrieb Ian Hickson: On Mon, 17 Jun 2013, Martin Janecke wrote: Am 17.06.2013 um 11:35 schrieb Steve Faulkner: the restriction on figure/figcaption is only in the whawtg spec not the W3C HTML spec as it was not deemed a

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Tab Atkins Jr.
On Wed, Jun 19, 2013 at 11:29 AM, Boris Zbarsky bzbar...@mit.edu wrote: On 6/19/13 2:17 PM, Benoit Jacob wrote: The closest thing that I could find being discussed, was use cases by JS frameworks or libraries that already expose similar feature-detection APIs. However, that only shifts the

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Kenneth Russell
Looking back at the previous discussion: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-September/037229.html (and succeeding emails) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-October/037693.html Accurate feature detection in libraries like Modernizr was mentioned as

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Boris Zbarsky
On 6/19/13 3:43 PM, Kenneth Russell wrote: Accurate feature detection in libraries like Modernizr was mentioned as a key use case: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-September/037249.html Right, this is the use case that's not really making sense to me. The fact

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Boris Zbarsky
On 6/19/13 3:34 PM, Tab Atkins Jr. wrote: This is missing the point. You don't want to wait until it's actually time to create the context. Unless you torture your code flow, by the time you're creating a context you should already know that the context is supported. The knowledge of which

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Brandon Benvie
On 6/19/2013 12:46 PM, Boris Zbarsky wrote: On 6/19/13 3:43 PM, Kenneth Russell wrote: Accurate feature detection in libraries like Modernizr was mentioned as a key use case: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-September/037249.html Right, this is the use case that's not

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Boris Zbarsky
On 6/19/13 4:22 PM, Brandon Benvie wrote: The point of using Modernizr or something like it is to detect availability of features on page load, and then conditionally load polyfills/alternate fallback implementations. It specifically does need to do eager detection to be useful. It can't wait

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread James Robinson
On Wed, Jun 19, 2013 at 1:22 PM, Brandon Benvie bben...@mozilla.com wrote: On 6/19/2013 12:46 PM, Boris Zbarsky wrote: On 6/19/13 3:43 PM, Kenneth Russell wrote: Accurate feature detection in libraries like Modernizr was mentioned as a key use case:

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Benoit Jacob
2013/6/19 Boris Zbarsky bzbar...@mit.edu On 6/19/13 3:34 PM, Tab Atkins Jr. wrote: This is missing the point. You don't want to wait until it's actually time to create the context. Unless you torture your code flow, by the time you're creating a context you should already know that the

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Brandon Benvie
On 6/19/2013 2:05 PM, James Robinson wrote: What would a page using Modernizr (or other library) to feature detect WebGL do if the supportsContext('webgl') call succeeds but the later getContext('webgl') call fails? I don't have an example, I was just explaining how Mozernizr is often used.

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Tab Atkins Jr.
On Wed, Jun 19, 2013 at 2:20 PM, Brandon Benvie bben...@mozilla.com wrote: On 6/19/2013 2:05 PM, James Robinson wrote: I'm also failing to see the utility of the supportsContext() call. It's impossible for a browser to promise that supportsContext('webgl') implies that getContext('webgl')

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Paul Irish
On the Modernizr side, an old version did indeed create a context for feature detection. For the past two years we have advocated the soft `WebGLRenderingContext in window` test instead. There, of course, is some gap between the results of that detect and how successful a getContext call will be,

[whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Gregg Tavares
In order for ImageBitmap to be useful for WebGL we need more options Specifically premultipliedAlpha: true/false (default true) Nearly all GL games use non-premultipiled alpha textures. So all those games people want to port to WebGL will require non-premultipied textures. Often in games the

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Tab Atkins Jr.
On Wed, Jun 19, 2013 at 2:47 PM, Gregg Tavares g...@google.com wrote: If it was up to me I'd make createImageBitmap take on object with properties so that new options can be added later as in createImageBitmap(src, callback, { premultipliedAlpha: false,

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Kenneth Russell
On Wed, Jun 19, 2013 at 2:20 PM, Brandon Benvie bben...@mozilla.com wrote: On 6/19/2013 2:05 PM, James Robinson wrote: What would a page using Modernizr (or other library) to feature detect WebGL do if the supportsContext('webgl') call succeeds but the later getContext('webgl') call fails?

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread James Robinson
On Wed, Jun 19, 2013 at 3:04 PM, Kenneth Russell k...@google.com wrote: On Wed, Jun 19, 2013 at 2:20 PM, Brandon Benvie bben...@mozilla.com wrote: On 6/19/2013 2:05 PM, James Robinson wrote: What would a page using Modernizr (or other library) to feature detect WebGL do if the

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Rik Cabanier
On Wed, Jun 19, 2013 at 2:47 PM, Gregg Tavares g...@google.com wrote: In order for ImageBitmap to be useful for WebGL we need more options Specifically premultipliedAlpha: true/false (default true) Nearly all GL games use non-premultipiled alpha textures. So all those games people want to

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Kenneth Russell
On Wed, Jun 19, 2013 at 3:06 PM, James Robinson jam...@google.com wrote: On Wed, Jun 19, 2013 at 3:04 PM, Kenneth Russell k...@google.com wrote: On Wed, Jun 19, 2013 at 2:20 PM, Brandon Benvie bben...@mozilla.com wrote: On 6/19/2013 2:05 PM, James Robinson wrote: What would a page using

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Gregg Tavares
On Wed, Jun 19, 2013 at 3:13 PM, Rik Cabanier caban...@gmail.com wrote: On Wed, Jun 19, 2013 at 2:47 PM, Gregg Tavares g...@google.com wrote: In order for ImageBitmap to be useful for WebGL we need more options Specifically premultipliedAlpha: true/false (default true) Nearly all GL

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Tab Atkins Jr.
On Wed, Jun 19, 2013 at 3:24 PM, Kenneth Russell k...@google.com wrote: That's true, but the answer still doesn't promise anything about what getContext() will do. It may still return null and code will have to check for that. What's the use case for calling supportsContext() without calling

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread James Robinson
On Wed, Jun 19, 2013 at 3:24 PM, Kenneth Russell k...@google.com wrote: On Wed, Jun 19, 2013 at 3:06 PM, James Robinson jam...@google.com wrote: On Wed, Jun 19, 2013 at 3:04 PM, Kenneth Russell k...@google.com wrote: supportsContext() can give a much more accurate answer than

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Kenneth Russell
On Wed, Jun 19, 2013 at 3:39 PM, James Robinson jam...@google.com wrote: On Wed, Jun 19, 2013 at 3:24 PM, Kenneth Russell k...@google.com wrote: On Wed, Jun 19, 2013 at 3:06 PM, James Robinson jam...@google.com wrote: On Wed, Jun 19, 2013 at 3:04 PM, Kenneth Russell k...@google.com wrote:

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Rik Cabanier
On Wed, Jun 19, 2013 at 3:24 PM, Gregg Tavares g...@google.com wrote: On Wed, Jun 19, 2013 at 3:13 PM, Rik Cabanier caban...@gmail.com wrote: On Wed, Jun 19, 2013 at 2:47 PM, Gregg Tavares g...@google.com wrote: In order for ImageBitmap to be useful for WebGL we need more options

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Rik Cabanier
On Wed, Jun 19, 2013 at 3:24 PM, Gregg Tavares g...@google.com wrote: On Wed, Jun 19, 2013 at 3:13 PM, Rik Cabanier caban...@gmail.com wrote: On Wed, Jun 19, 2013 at 2:47 PM, Gregg Tavares g...@google.com wrote: In order for ImageBitmap to be useful for WebGL we need more options

Re: [whatwg] Challenging canvas.supportsContext

2013-06-19 Thread Benoit Jacob
2013/6/19 Kenneth Russell k...@google.com In my experience, in Chromium, creation of the underlying OpenGL context for a WebGLRenderingContext almost never fails in isolation. Instead, more general failures happen such as the GPU process failing to boot, or creation of all OpenGL contexts

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Gregg Tavares
On Wed, Jun 19, 2013 at 4:03 PM, Rik Cabanier caban...@gmail.com wrote: On Wed, Jun 19, 2013 at 3:24 PM, Gregg Tavares g...@google.com wrote: On Wed, Jun 19, 2013 at 3:13 PM, Rik Cabanier caban...@gmail.com wrote: On Wed, Jun 19, 2013 at 2:47 PM, Gregg Tavares g...@google.com wrote:

Re: [whatwg] Proposal: createImageBitmap should return a Promise instead of using a callback

2013-06-19 Thread Anne van Kesteren
On Wed, Jun 19, 2013 at 10:19 PM, Justin Novosad ju...@google.com wrote: The proposal is to change the ImageBitmapFactories IDL to something like this: [NoInterfaceObject] interface ImageBitmapFactories { Promise createImageBitmap(ImageBitmapSource image, optional long sx, long sy, long

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

2013-06-19 Thread Rik Cabanier
On Wed, Jun 19, 2013 at 4:47 PM, Gregg Tavares g...@google.com wrote: On Wed, Jun 19, 2013 at 4:03 PM, Rik Cabanier caban...@gmail.com wrote: On Wed, Jun 19, 2013 at 3:24 PM, Gregg Tavares g...@google.com wrote: On Wed, Jun 19, 2013 at 3:13 PM, Rik Cabanier caban...@gmail.comwrote: