Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Let's imagine a browser (UA) that supports basics of HTML (language portion of HTML5) and CSS (e.g. v 2.1).

Yet it has WebVM instead of JS. WebVM is a virtual machine similar to JavaVM but with DOM, CSSOM and layout APIs exposed in it as a runtime.

So if some site needs flexbox in its CSS then it can be included as:

    <link href=".../css-flexbox.bytecodes" rel="extension">
If JS then

    <link href=".../es6-compiler.bytecodes" rel="extension">
and so on.

This would allow a) keep browser small and maintainable and b) open room for innovations in Web technology beyond browser vendors and comities.

As an example: TypeScript can be compiled to WebVM bytecodes instead of JS.



What is needed in some ability to identify the extension, so that the user may substitute their own, or may want to cache it instead. This would also improve speed, since it can avoid download it for each separate web page, and can also substitute a native code implementation.


Not bad an idea at all! Hadn't considered bytecodes for layout algorithms, though I guess it would work with regular js as well, and I AFAICS Project Houdini is about providing the necessary core rendering API.


> would work with regular js as well

In principle JS may work but it is too slow for that. Function calls are too pricey, no integer arithmetic, etc.

At least in my Sciter (https://sciter.com) element's layout controller must have three methods:

    void calc_min_maxes() // calculates min-content and max-content
    int layout_width(int px_new_width);
    int layout_height(int px_new_height);
so it is quite easy to add new layout modes. This way I've added ()

    flow:grid(...); // a la display:grid
    flow:horizontal; // a la display:flexbox  
    flow:stack; // no alternatives in standard CSS
    etc.
Modern Java (and C# for that matter) are almost ideal for such things, especially considering modern effective JITs and VMs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: