[webkit-dev] getting back to sub-classes of gobjects

Luke Kenneth Casson Leighton lkcl at lkcl.net
Thu Aug 28 04:55:28 PDT 2008

>  > btw just to reassure you: i really _do_ mean thank you for such a simple
>  > answer: this is the first time, this week, that i've done gobject programming,
>  > and i didn't exactly start with a small unambitious task ha ha :)
>  Big go go go here! From a PyGTK enthusiast ;-)

 ha ha thank you alberto :)

 btw i worked out what the issue is: i need a "hash map" which records the link
between the c++ objects and the glib objects.  instead of creating a _new_ glib
object (to wrap the same c++ object but possibly with an entirely different glib
type - that's my bug) i need to check the hash map and return the glib object
that was _originally_ created when the c++ object was created / looked up.

both the JS bindings and the ObjC bindings follow this trick.  ScriptInterpreter
in the JS bindings case and WebScriptObject in the ObjC case.

where that kinda breaks down, though, is if the glib object doesn't exist
already (having never had a glib function called before which resulted in the
correct corresponding glib object wrapper being created for the c++ object) .

in this instance, i am somewhat screwed :)  i located ... oh hell, i worked it
out.  i located DOM.mm (the objective C) and there's a function
_wrapNode:(WebCore::Node *)impl which does a switch statement on the c++
object's nodeType()... it goes through the types, mapping them each to a wrapper
class. (how in god's name i'm going to do that in the glib case... hmmm...)

so, that covers the cases where there is no glib object.

good grief.

.. why couldn't this be... easy??  why couldn't webkit have been written in
python, where everything would be nice, and we'd all be friends? :)


More information about the webkit-dev mailing list