[webkit-dev] Language Bindings

Kevin Ollivier kevino at theolliviers.com
Fri Jan 8 11:37:11 PST 2010


Hi,

On Jan 7, 2010, at 5:15 PM, AS wrote:

> Hello
> 
> I'm looking into adding bindings for Python to the webkit DOM objects. 
> 
> Ideally, what I would like to create is WebKit based application that can use Python for DHTML manipulation. 
> 
> From the code, I can see how there are perl scripts that parse the idl files and generate binding files, such as those for Javascript and Objective C, I would like to add a set that does the same for Python. 
> 
> From the generated files, I a bit unclear as to where the actual objects are instaniated, i.e. if some jscript created a new say node, is there a table of class names / ctores somewhere?
> 
> Would it be possible for someone to give a quick overview of what process should be followed to create a new language binding. 

The wx port actually has this capability to some degree. (Not sure if it has been implemented elsewhere yet.) You can check the wxPython release for Mac and Win (Ubuntu is coming hopefully soon) here: 

http://wxwebkit.wxcommunity.com/index.php?n=Main.Downloads

There's also a sample HTML editor app that uses DOM APIs to do all it's property changes. The source for it is here: 

http://eclass.svn.sourceforge.net/viewvc/eclass/trunk/htmleditor/htmleditor.py?revision=862&view=markup

Some methods in that code that touch the DOM are the GetParent method (finds if the current selection is inside a particular tag, such as A) and ShowEditorForTag, which uses a pre-defined attribute list to grab the current value from the DOM, show an editor, and then set the user-specified value on the DOM element when the editor is closed.

I haven't landed the bindings yet in trunk as they are a somewhat large project and I'm still working on them. To create them, what I did was add a new bindings generator in WebCore/bindings/scripts that generated C++ bindings. (I based it off the CodeGeneratorCOM.pm script but I had to modify it quite a bit to output COM-free C++ code.) Then I used SWIG to wrap those as Python objects. 

Regards,

Kevin

> thanks
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100108/566849f9/attachment.html>


More information about the webkit-dev mailing list