Re: Question & Doubts regarding the embedding of Gecko

Benjamin Smedberg <[email protected]> Mon, 09 Jan 2012 11:50:59 -0500
Newsgroups gmane.comp.mozilla.devel.embedding
Message-ID <[email protected]>
On 1/9/2012 6:34 AM, Leander Bessa wrote:
>
> I'm trying to build an application which'll use html5 and css3 to
> display its interface and a set of C++ apis to introduce features
> beyond the scope of html.
It sounds like you really want XULRunner, not "embedding" in the 
traditional sense. You can write XULRunner apps using HTML (instead of 
XUL), and this is actually recommended because it will insulate you from 
any changes we might make to the (unstable) XUL language itself. And 
most of the special features you need can be implemented as JS modules 
or XPCOM components.
> 1) Does embedding gecko only give me access to the html renderer or
> does it also include the javascript engine?
Our platform is a complete platform including layout, JS, networking, 
and pretty much everything else you need for a complete web experience.
>
> 2) Regarding the new embed api with Qt, how does gecko render html?
> Does it use cairo's or Qt's api? This aspect is important, since
> rendering performance is a must.
I can't answer this question because I don't know what embed API you're 
discussing.
>
> 3) How easy is it to make my c++ apis available to the javascript
> context? In the case of the Qt port, can i use QObject derived classes
> such as in QtWebkit?
No, you cannot. Typically you interface with C++ code using either XPCOM 
interfaces declared in XPIDL, or by writing a glue layer in JavaScript 
and using JS-ctypes. XPCOM is more powerful but you may need to update 
or recompile your code for each release cycle. JS-ctypes is more stable 
although it may require additional work and care to get the interface 
right, especially if you have complex callback mechanisms.
>
> 4) How difficult is it to extend/alter Gecko?  For instance: adding a c
> ++ scene graph to the canvas layer or hooking up a driver to support
> muti-touch input with a touch screen on a desktop pc?
Assuming that you can't just translate your scene graph to SVG or some 
web technology, the best way to implement something like that would 
probably be as an NPAPI plugin.

Gecko already supports multi-touch input natively using DOM events, so 
that probably doesn't require any additional code on your part except 
for JS to react to the multitouch events.

--BDS