News for hackers. Stuff that matters.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Wednesday February 18, 2015 @06:59PM (#9071697)
E.g. Mac OS X uses OpenGL to render GUI, I guess I should have made myself more clear.

> WebGL and canvas are in no way replacements for the DOM.

That's kind of debatable. If you have access to a fast graphics layer from the browser, you can build a DOM replacement of sorts. I think that famo.us works kind of like that.

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by pavlov on Wednesday February 18, 2015 @07:34PM (#9071815)
It's true that OS X uses OpenGL for GUI compositing, but that's only the lowest level. Above, there's a very important piece of the GUI stack called Core Animation which provides layer compositing.

Core Animation is used by both the native GUI as well as the browser DOM. When you use layer-backed compositing on a web page (e.g. CSS 3D transforms), WebKit implements it with a Core Animation layer. So DOM-based rendering enjoys the same benefits of GPU-accelerated compositing as native apps -- although obviously with rather different semantics since HTML+CSS doesn't map directly to Core Animation.

If you implement your own GUI framework on top of WebGL or Canvas, you're not getting Core Animation compositing for free, so you need to replicate that functionality in your custom framework. (This applies equally to native apps: a WebGL app is equivalent to a Cocoa app that renders everything into a single OpenGL view, and a HTML Canvas app is equivalent to using a single CoreGraphics view.)

I don't think the WebGL/Canvas route makes sense for most apps other than games and highly visual 3D apps. You'll just spend a huge amount of time building your own implementations of all high-level functionality that is already provided by the OS and/or the browser: layer compositing, text layout, view autosizing, and so on. If you're doing standard GUIs, why go to all that trouble?

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by RussianCow on Wednesday February 18, 2015 @07:57PM (#9071881)
> You'll just spend a huge amount of time building your own implementations of all high-level functionality that is already provided by the OS and/or the browser

Not only that, but you can't make a 100% guarantee that your implementation will look and work exactly the same as the native one on the underlying OS. For instance, I can re-create all the native Windows UI controls and re-implement all their behavior in exactly the same way, but what if the user has a custom theme installed? Everything breaks. (WPF has a similar problem.)

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Wednesday February 18, 2015 @07:48PM (#9071852)
I agree that it would be a lot of effort to pull off since you'd have to duplicate a lot of the standard OS features in the browser but if eventually the DOM becomes an even bigger bottleneck, it might be a viable solution.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by RussianCow on Wednesday February 18, 2015 @07:31PM (#9071808)
To some degree, yes. You just have to be able to re-use system UI controls like fields. So you wouldn't be able to just use WebGL/canvas/whatever in place of the DOM, you'd need to come up with a new API.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Wednesday February 18, 2015 @07:44PM (#9071843)
I know. I was thinking that there'd be something like Qt that would render the widgets using WebGL.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by RussianCow on Wednesday February 18, 2015 @08:16PM (#9071934)
Until the web becomes the dominant operating system, I don't think that's reasonable because you'd have to implement an entire UI kit (with all UI components, behaviors, animations, etc) but can't guarantee that it will behave at all like the underlying OS. There's only so much you can re-create in the browser.