Bug 4247 - addEventListener in Obj-C does not work
Summary: addEventListener in Obj-C does not work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Critical
Assignee: Darin Adler
URL: http://lists.apple.com/archives/Webki...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2005-07-31 22:34 PDT by Adriaan Tijsseling
Modified: 2006-05-30 15:23 PDT (History)
0 users

See Also:


Attachments
patch to implement this (3.39 KB, patch)
2005-07-31 23:38 PDT, Darin Adler
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adriaan Tijsseling 2005-07-31 22:34:31 PDT
See the thread here:
http://lists.apple.com/archives/Webkitsdk-dev/2005/May/msg00050.html
In short, adding event listeners via Obj-C has no effect. WebKit doesn't call handleEvent on the target 
(which conforms to the EventListener protocol).
Comment 1 Darin Adler 2005-07-31 22:35:58 PDT
Uh oh. I see why:

- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
{
    ERROR("unimplemented");
}

- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
{
    ERROR("unimplemented");
}
Comment 2 Darin Adler 2005-07-31 23:38:42 PDT
Created attachment 3190 [details]
patch to implement this
Comment 3 Darin Adler 2005-09-11 11:01:50 PDT
Comment on attachment 3190 [details]
patch to implement this

Anders said he tried this out and it worked.
Comment 4 Eric Seidel (no email) 2005-09-17 14:33:28 PDT
Comment on attachment 3190 [details]
patch to implement this

Looks fine.  Two comments:

1.  I don't understand the ListenerMap map = listenerMap; dance that you do in
two places.  You had made some comment before about locals being faster to
access... but particularly in the ObjCEventListener::find case it seems
superfluous.

2.  Although I personally agree with the style of returning objects
ref-counted... ObjCEventListener::create differs from the rest of the C++ code
in WebCore by doing so.  I think that wrapper should be returned floating and
stuck into a SharedPtr if necessary, or simply returned as a
SharedPtr<ObjCEventListener> for consistancy.

I'll leave those corrections to your discression.  r=me.
Comment 5 Eric Seidel (no email) 2005-09-18 14:44:44 PDT
As ggaren correctly points out, all of these really should have layout tests.  For better or worse I ignored 
that fact, realizing that we don't currently (AFAIK) have any way of testing the Obj-C DOM API.  I talked 
with andersca a bit on IRC, he said he started the py-objc Obj-C DOM testing system, but hasn't finished 
yet.
Comment 6 Geoffrey Garen 2005-09-20 00:51:51 PDT
OK, since we don't have a way to test the bindings yet, I'm landing this without a test.
Comment 7 Alice Liu 2006-05-30 15:23:31 PDT
<rdar://problem/4562444>