News for hackers. Stuff that matters.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by RussianCow on Wednesday February 18, 2015 @06:46PM (#9071655)
You use WebGL to create standard GUI applications on the desktop? WebGL and canvas are in no way replacements for the DOM.
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.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by runeks on Wednesday February 18, 2015 @07:28PM (#9071796)
Perhaps it's to make it backward compatible, so that, for example, the traditional DOM is implemented as a Javascript library that parses HTML and renders it onto a WebGL surface?
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by coldtea on Wednesday February 18, 2015 @06:57PM (#9071691)
>You use WebGL to create standard GUI applications on the desktop?

Increasinly high end apps do.

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by RussianCow on Wednesday February 18, 2015 @08:00PM (#9071888)
Graphically intensive apps do it for performance. But the tradeoff is you lose all the native UI controls that the OS gives you--form fields, text selection, animation, etc. So I don't think replacing the DOM with OpenGL or similar is a good solution for general-purpose apps.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Wednesday February 18, 2015 @08:05PM (#9071903)
All of those would be implemented in a framework.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by bzbarsky on Wednesday February 18, 2015 @09:25PM (#9072117)
Yes, they already are. That framework is called the DOM. People keep complaining about it and trying to come up with replacement frameworks that end up slower and less capable...

The DOM definitely has its problems, mind you. Investing some time in designing a proper replacement for it is worth it, as long as people understand going in that the project might well fail.

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by coldtea on Thursday February 19, 2015 @05:08AM (#9073292)
>Yes, they already are. That framework is called the DOM. People keep complaining about it and trying to come up with replacement frameworks that end up slower and less capable...

The ones I've seen are actually faster -- Flipboard for one gets to 60fps scrolling on mobile, IIRC. And of course all WebGL based interfaces on native mobile apps that re-implement parts of Cocoa Touch et al, are not that shabby either.

Sure, it doesn't have as much accesibility, but that's something that can be fixed in the future (and of course people needing more accessibility can always use more conservative alternatives).

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Wednesday February 18, 2015 @09:39PM (#9072143)
Which framework has tried to replace the DOM?
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by bzbarsky on Wednesday February 18, 2015 @09:50PM (#9072169)
None have tried to replace all of it that I know of.

People have tried to replace things like text editing (with canvas-based editors), CSS layout of the DOM (with various JS solutions involving absolute positioning), native MathML support (MathJax; this one has of necessity done better than most, because of so many browsers not having native MathML support). There are a bunch of things out there that attempt to replace or augment the built-in form controls, with varying degrees of success.

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by xxgreg on Saturday February 21, 2015 @04:34AM (#9085155)
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Wednesday February 18, 2015 @10:22PM (#9072252)
That's my point. Currently, you cannot really replace the DOM since that's kind of the extent of the exposed APIs.

None of the projects that you mention are really relevant to the discussion. I agree that they didn't change shit but it's precisely because they are still built on the DOM and cannot really go below that in the abstraction layer.

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by coldtea on Thursday February 19, 2015 @05:12AM (#9073302)
>I agree that they didn't change shit but it's precisely because they are still built on the DOM and cannot really go below that in the abstraction layer.

There exist UIs done in Canvas and WebGL that are arguably below the DOM in the "abstraction layer" and don't need to use much more DOM nodes besides opening a canvas/gl panel...

(Most full screen 2G/3G web games fall into this, for starters, and those are in the tens of thousands. But there are also lotsa apps).

Re:Bringing asm.js to the Chakra JavaScript engine in Window... by comex on Thursday February 19, 2015 @02:45AM (#9072918)
Flipboard's from the recent story? The resulting site breaks accessibility and the layout obviously has less capability, but it's certainly not slower.
Re:Bringing asm.js to the Chakra JavaScript engine in Window... by adamnemecek on Thursday February 19, 2015 @03:51AM (#9073070)
Huh, that's actually seeming not that dissimilar from what I had in mind.