[Webkit-unassigned] [Bug 77835] [GObject bindings] EventListeners as first-class GObjects: WebKitDOMEventListener

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


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


Carlos Garcia Campos <cgarcia at igalia.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #214724|                            |review?
               Flag|                            |




--- Comment #55 from Carlos Garcia Campos <cgarcia at igalia.com>  2013-10-21 03:58:14 PST ---
Created an attachment (id=214724)
 --> (https://bugs.webkit.org/attachment.cgi?id=214724&action=review)
Another approach using a closure

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.

-- 
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