Re: Gtk2::MozEmbed + DOM



On Tue, 2005-03-29 at 12:52 +0200, Scott Lanning wrote:

Figured that out, so all the POD is done.
I got the dom_* signal docs mostly from the DOM specs.
The only thing I don't know for sure is what the return
value of those signals means. I assume it's similar to `open_uri',
where returning true means the signal has already been handled
and returning false means to let the default handling continue.

That would also be consistent with the semantics of signal handling in
glib and gtk+.

I attached what is probably the final patch for this,
unless it needs further refining.

I think the patch is fine apart from minor things (the LD argument to
WriteMakefile needs to use the LD_RUN_PATH=... trick the old one uses,
and DOCTYPES => 'doctypes' needs to be added to the call to
Glib::MakeHelper->postamble_docs_full).

Note: I don't in any way _expect_ you to commit the patch.
It might be that you find it to be too much complication
for the little it gains. (In any case, I've gained experience
in XS, XS + C++, and gtk-perl; so I'm thankful for your patience
in helping me to understand how this stuff works.)

I think the newly bound API is great and I would also like support for
it in Gtk2::MozEmbed.  But see below.

Now that I see what's possible, I'm anxious to add a lot
of things. nsIDOMKeyEvent and nsIDOMMouseEvent are both
of type nsIDOMUIEvent, which is in turn an nsIDOMEvent.
There are methods for finding out more about the event
and its targets, for initiating events, adding listeners.
   And, as you mentioned, nsIWebBrowser has a GetContentDOMWindow
method, which returns an nsIDOMWindow, from which you can
get an nsIDOMDocument, which has methods like GetElementsByTagName
and CreateElement (familiar from javascript).
   Then combining those two (events and DOM), presumably
somebody could implement things like "click on this button"
and "select this item". That's what I envisage, at least.
Do you think it's beyond the scope of Gtk2::MozEmbed?

Yeah, actually, I do think this is beyond the scope of Gtk2::MozEmbed.
Gtk2::MozEmbed is a binding for the Mozilla/gtk+ embedding widget.  Not
for the Mozilla API.

What do you think about creating a separate Mozilla module?  You could
wrap all the API you like, and you would have cool namespaces like
Mozilla::DOM::MouseEvent or Mozilla::DOM::Window.  Gtk2::MozEmbed could
optionally depend on Mozilla and enable the custom signal marshallers if
it's installed -- everything would work just like it does now.  If it's
not installed, the normal signal marshallers would kick in and simply
marshal the event pointers as integers, which is fine too if all you
want is render some HTML in a widget.

There are already some Mozilla::LDAP::* modules on CPAN, so I think
you'd also have no problem using Mozilla as a namespace.

If you look for a template for a completely new (top-level-namespace)
module, the new GStreamer is probably a good candidate.  You'd just need
to get rid of the Glib dependency, which Mozilla presumably doesn't
require.

-- 
Bye,
-Torsten




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]