Use a html renderer in an embedded environment

tkarls picture tkarls · Feb 22, 2012 · Viewed 9.2k times · Source

I'm working on a project where I will design a GUI for an embedded device and would love to go with HTML for this. I hope you guys can help me find a render engine that suits my needs.

Requirements:

  • The web-page must be rendered into a memory buffer. I will then transfer the memory buffer to the display.

  • I must be notified though callback or event that the render engine need to fetch a new item. HTML page, image, etc. The reason for this is that I must fetch the resource and feed it to the render engine (the reason is that the device does not have TCP/IP in all configurations and will then need to fetch the item over serial line, and also for security I need to validate that the request is allowed).

  • I must be able to inject mouse and keyboard events into the rendering engine.

  • Only C and/or C++

  • Must be easily portable and lack dependencies to libraries that only exist for win/linux/mac. The device I have runs a custom OS...

  • Small footprint and memory consumption, I can probably get away with 10MB footprint and 5-10 MB allocated memory during rendering. But not much more.

  • Both open source as well as commercial solutions are welcome

  • I do NOT need full HTML5 and CSS3 support, I mean if I can use "basic HTML and some CSS" I'm more than happy.

I have looked at some WebKit, chromium, gecko, berkelium and awesomium but not really found that they fit my needs.

Is there anything out there that comes close to what I need? Or should I just give up this idea and build the GUI in some other way? I appreciate any help!

Answer

MrGomez picture MrGomez · Apr 15, 2012

Good question! It turns out there are a few options within this space, and as you've surmised, many of them are based on Webkit. Some of them aren't, though, and those are the ones that I believe you're most interested in.

Links

The simplest, 0th-level browser that's going to meet your needs is the graphical version of the Links web browser. It's suitably cross-platform (admittedly, you will require some of the libraries from Cygwin for Windows environments), open source, carries a small memory footprint, and in some of its forked or enhanced incarnations (for example, Elinks), has enhanced functionality like Javascript support, full mouse functionality, and the bells and whistles that you desire in your problem statement.

Of course, it's written in C.

Konqueror/Embedded

Exploring some of the other options within this space, Konqueror/Embedded is something to consider and watch in the future. Yes, it is based on Qt/Embedded and Webkit (mumble mumble), but they're aiming to provide a slimmed down version of both their browser and their library stack to meet this need specifically. Once again, Windows is going to be the odd child out here, but it's workable.

Fennec

One last cross-platform option to explore is the slim version of Mozilla Firefox, Fennec. While providing a much larger code base, Mozilla is working on its embedded version very aggressively, and any help you can provide here would be greatly appreciated. From what I understand, the slimmed version is still pre-alpha (Fennec, however, lives on), but it should become a workable option in the future.

And a Gamut of Others to Explore

In addition to the gamut of web browsers currently competing in this space, proprietary options like ANT Galio may also meet your needs. It seems there are many other proprietary solutions out there, but the majority of them (for example, Internet Explorer Mobile, Mobile Safari) only service a small number of platforms. Good, proprietary, cross-platform solutions that aren't based on Webkit seem to be quite rare.

SpliFF also offered an excellent suggestion in his answer: try libRocket. As he recommends, it's lightweight, cross-platform, currently and actively maintained, easy for you to hook into, and provides for the automation cases that you seek. In this case, it's programmed in C++, with Python bindings for additional convenience.


In conclusion, given your needs, you'll still need to evaluate the strengths, weaknesses, and API specifications for the options listed above.

I recommend starting with Links, because it's the most feature-rich and robust option while optimizing on a very small memory footprint and codebase. Its biggest strength is that this was a design goal from the outset, and the entire code tree is built with this design philosophy in mind.

Do let us know what you go for. This is a common enough need in the community that I'm sure others will benefit from your experience.