[Webkit-unassigned] [Bug 77835] [GObject bindings] Missing scope annotations for add/remove_event_listener

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 20 13:48:42 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=77835





--- Comment #22 from Zan Dobersek <zandobersek at gmail.com>  2012-02-20 13:48:42 PST ---
(In reply to comment #21)
> i think i can come up with a way to maintain current API, but also support the old, by using some form of _full, or similar, but internally the GObjectEventListener would need to convert ... is this worth it?
> 

I don't think there's any sense in keeping the current API, because it's not idiomatically parallel to the DOM specification.

If it is presumed that instead of a GCallback or WebKitDOMEventHandler a proper binding to the EventListener interface is introduced (as it is planned), API should reflect the DOM specification perfectly, probably like this:

EventTarget:
http://www.w3.org/TR/DOM-Level-3-Events/#interface-EventTarget

addEventListener(DOMString type, EventListener listener, boolean useCapture) ->
webkit_dom_event_target_add_event_listener(WebKitDOMEventTarget* target, gchar* type, WebKitDOMEventListener* listener, gboolean useCapture)

removeEventListener(DOMString type, EventListener listener, boolean useCapture) ->
webkit_dom_event_target_remove_event_listener(WebKitDOMEventTarget* target, gchar* type, WebKitDOMEventListener* listener, gboolean useCapture)

dispatchEvent(Event event) ->
webkit_dom_event_target_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event)

EventListener:
http://www.w3.org/TR/DOM-Level-3-Events/#events-EventListener

To create a WebKitDOMEventListener:
webkit_dom_event_listener_create(WebKitDOMEventListenerFunc callback, gpointer data, GDestroyNotify notify)
WebKitDOMEventListenerFunc:
typedef void (*WebKitDOMEventListenerFunc)(GObject*, WebKitDOMEvent*, void*);
(the same as GObjectEventListenerCallback)

handleEvent(Event event) ->
webkit_dom_event_listener_handle_event(WebKitDOMEventListener* self, WebKitDOMEvent* event)

Most of your work in the latest patch already has this covered, it just requires some more polishing.

> also, as stated above, DOMEventListener triggers the generation of WebKitDOMEventListener.(h|cpp) from the corresponding IDL file ... however, looking it over, it *almost* looks correct.  it looks like it might be possible to tweak CodeGenerator to make WebKitDOMEventListener wrap *WebCore::GObjectEventListener* objects instead (basically adding `GObject` in the right places)
> 

WebKitDOMEventListener.* files should probably be manually written to properly execute the handleEvent method and to properly call the notify callback when necessary. To avoid triggering the autogeneration, the build rules for these files should follow the ones for WebKitDOMEventTarget* files in Source/WebCore/bindings/gobject/GNUmakefile.am.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list