[webkit-reviews] review requested: [Bug 77835] [GObject bindings] EventListeners as first-class GObjects: WebKitDOMEventListener : [Attachment 214724] Another approach using a closure

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 21 03:59:28 PDT 2013


Carlos Garcia Campos <cgarcia at igalia.com> has asked  for review:
Bug 77835: [GObject bindings] EventListeners as first-class GObjects:
WebKitDOMEventListener
https://bugs.webkit.org/show_bug.cgi?id=77835

Attachment 214724: Another approach using a closure
https://bugs.webkit.org/attachment.cgi?id=214724&action=review

------- Additional Comments from Carlos Garcia Campos <cgarcia at igalia.com>
This patch adds two new methods add_event_listener_with_closure and
remove_event_listener_with_closure that receive a GClosure instead of a
GObject. They are only to be used by bindings, that expose them as
add_event_listener and remove_event_listener. This keeps the API compatible,
and consistent with the DOM spec. ABI is ot broken either, because nobody could
be using the virtual methods outside of WebKit, since all implementations use
private API (GObjectEventListener). With this patch and changing the test case
attached to this bug to use the new API:

link.add_event_listener('click', self.on_click, True)

Running the test case and clicking on the button gives:

on_click (<DOMHTMLButtonElement object at 0x12d3870 (WebKitDOMHTMLButtonElement
at 0x13ac740)>, <DOMMouseEvent object at 0x15be280 (WebKitDOMMouseEvent at
0x1637930)>) {}

So, it seems to be working fine.


More information about the webkit-reviews mailing list