Bug 40847

Summary: [GTK] Fix DOM event dispatch
Product: WebKit Reporter: Xan Lopez <xan.lopez>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: gustavo, lauragwd, mrobinson, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
eventlisteres.diff
none
unittestdispatch.diff
none
Updated patch
none
uievents.diff
none
uievents.diff none

Description Xan Lopez 2010-06-18 11:12:45 PDT
Patches coming.
Comment 1 Xan Lopez 2010-06-18 11:14:43 PDT
Created attachment 59136 [details]
eventlisteres.diff

Fix eventlistener creation.
Comment 2 Xan Lopez 2010-06-18 11:15:25 PDT
Created attachment 59138 [details]
unittestdispatch.diff

Unit test event dispatch.
Comment 3 WebKit Review Bot 2010-06-18 11:19:09 PDT
Attachment 59136 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebCore/bindings/gobject/WebKitDOMObject.cpp:25:  prop_id is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebCore/bindings/gobject/WebKitDOMObject.cpp:34:  prop_id is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Martin Robinson 2010-06-18 11:48:15 PDT
Looks good to me!

Only one suggestion: Perhaps move the coreObject->ref() into the GObject itself. Since the object is responsible for the deref(), it makes sense for it to do the ref() as well.

You've exposed addEventListener to the bindings (I think). Is that part of some later work, or required for this patch?
Comment 5 Xan Lopez 2010-06-18 13:07:39 PDT
(In reply to comment #4)
> Looks good to me!
> 
> Only one suggestion: Perhaps move the coreObject->ref() into the GObject itself. Since the object is responsible for the deref(), it makes sense for it to do the ref() as well.

Yeah, I actually planned to do this, but the issue is you cannot know the type of the coreObject in WebKitDOMObject, where that code lives, so you cannot do the casting we do in the wrap method to call ->ref(). On the other hand I don't think that's really needed, I suppose if you cast it to some really low level class where ref/deref are defined it should be more than enough.

> 
> You've exposed addEventListener to the bindings (I think). Is that part of some later work, or required for this patch?

I actually didn't, they are blacklisted in CodeGeneratorGObject. I just removed the guards that were there so that the Node wrapper correctly adds its event listeners.
Comment 6 Martin Robinson 2010-06-18 13:29:57 PDT
(In reply to comment #5)
> Yeah, I actually planned to do this, but the issue is you cannot 
> know the type of the coreObject in WebKitDOMObject, where that code
> lives, so you cannot do the casting we do in the wrap method to call ->ref().

You're right, of course. I don't think there is shared reference counted
class between them. The only approach that I can think of is a vmethod
in the GObject. Not sure if it is worth it here.
Comment 7 WebKit Review Bot 2010-06-18 16:29:19 PDT
Attachment 59138 [details] did not build on gtk:
Build output: http://webkit-commit-queue.appspot.com/results/3299372
Comment 8 Gustavo Noronha (kov) 2010-06-23 06:25:26 PDT
Comment on attachment 59136 [details]
eventlisteres.diff

This looks very good to me. The only conceptual problem I have is with the property - I don't think we should expose a core object in public API (which a property ends up being). Having said that, I understand it would be difficult to deal with this in another way, and approve of the method. Time for GObject to grow private/protected properties? =)
Comment 9 Xan Lopez 2010-06-28 07:41:31 PDT
Comment on attachment 59136 [details]
eventlisteres.diff

Landed as r62004.
Comment 10 Xan Lopez 2010-07-11 03:18:59 PDT
Comment on attachment 59138 [details]
unittestdispatch.diff

This needs a bit of updating, removing from the queue.
Comment 11 lauragwd 2010-07-20 15:05:17 PDT
(In reply to comment #10)
> (From update of attachment 59138 [details])
> This needs a bit of updating, removing from the queue.

I have added an updated patch which builds against the latest commit (apart from the constant changing Changelog)
Comment 12 lauragwd 2010-07-20 15:05:55 PDT
Created attachment 62119 [details]
Updated patch
Comment 13 Xan Lopez 2010-08-02 12:14:11 PDT
Created attachment 63244 [details]
uievents.diff

Updated patch. Adds a custom kit method for Event* instead off doing an ad-hoc create_event in Document, it's less code \o/
Comment 14 WebKit Review Bot 2010-08-02 12:20:26 PDT
Attachment 63244 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WARNING: File exempt from style guide. Skipping: "WebKit/gtk/tests/testdomdomwindow.c"
WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h:25:  Alphabetical sorting problem.  [build/include_order] [4]
WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h:28:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 2 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Xan Lopez 2010-08-02 13:45:46 PDT
Created attachment 63255 [details]
uievents.diff
Comment 16 Gustavo Noronha (kov) 2010-08-03 11:42:58 PDT
Comment on attachment 63255 [details]
uievents.diff

Seems sane.
Comment 17 Xan Lopez 2010-08-03 12:41:40 PDT
Comment on attachment 63255 [details]
uievents.diff

Thank you, landed as r64580.
Comment 18 Xan Lopez 2010-08-03 12:41:53 PDT
All patches landed, closing bug.