RESOLVED FIXED Bug 57515
[WK2] [Mac] Implement KeyDown function for WebKit2 EventSender
https://bugs.webkit.org/show_bug.cgi?id=57515
Summary [WK2] [Mac] Implement KeyDown function for WebKit2 EventSender
Chang Shu
Reported 2011-03-30 17:43:48 PDT
Start building framework using KeyDown event.
Attachments
fix patch (92.17 KB, patch)
2011-03-31 09:07 PDT, Chang Shu
no flags
fix patch 2 (92.89 KB, patch)
2011-03-31 11:00 PDT, Chang Shu
no flags
fix patch 2 (92.89 KB, patch)
2011-03-31 11:11 PDT, Chang Shu
eric: review-
fix patch 3 (67.01 KB, patch)
2011-05-25 09:05 PDT, Chang Shu
darin: review+
patch 4 (159.43 KB, patch)
2011-09-13 11:42 PDT, Chang Shu
no flags
Chang Shu
Comment 1 2011-03-31 09:07:29 PDT
Created attachment 87740 [details] fix patch This patch does the following things for KeyDown event: 1. passes function calls from WebKitTestRunner::InjectedBundle to WebKit2::WebProcess::InjectedBundle through WK interface 2. encodes it as a binary buffer attached to a general InjectedBundle message. 3. sends out the message to UIProcess 4. UIProcess passes the general InjectedBundle message to WebKitTestRunner::EventSenderProxy. 5. EventSenderProxy calls the decoding mechanism through WK interface 5. EventSenderProxy further calls the platform-dependent code to trigger the event from the UIProcess side. Note that the platform-dependent implementation on Mac has not been done yet for my lack of experience on objC development.
Chang Shu
Comment 2 2011-03-31 09:10:13 PDT
I changed the title of the bug since my patch is 100% common code except the project files.
Darin Adler
Comment 3 2011-03-31 09:18:58 PDT
Maciej told me an approach like this won’t work due to the behavior of CoreIPC.
Darin Adler
Comment 4 2011-03-31 09:20:17 PDT
We can make it work by enhancing CoreIPC. I don’t know the details. Maybe he can fill us in. Adding him to the cc list. In the mean time I am making a version of eventSender work entirely within the web process. We can still move to the round trip UI process version later, but this will get many tests running and testing what they intend to even though they will not test as much code as the multi-process version we eventually want.
Early Warning System Bot
Comment 5 2011-03-31 09:37:08 PDT
Build Bot
Comment 6 2011-03-31 10:00:25 PDT
Chang Shu
Comment 7 2011-03-31 10:04:59 PDT
(In reply to comment #3) > Maciej told me an approach like this won’t work due to the behavior of CoreIPC. Hi, Darin, I am not sure which part of the code you are referring to. With the similar patch for bug 56485, I have made it work on Qt and fixed at least one test case. It will be good the enhance CoreIPC though and the WK interface will become neater.
Darin Adler
Comment 8 2011-03-31 10:07:58 PDT
I am going to put my patches that work entirely in the web process up for review. I hope that does not make your task more difficult. I think your direction is fine. It’s Maciej and Anders that can explain the concerns. Please also fee free to replace my code with yours if mine lands and yours will work even better.
Chang Shu
Comment 9 2011-03-31 11:00:53 PDT
Created attachment 87766 [details] fix patch 2 fix build break
WebKit Review Bot
Comment 10 2011-03-31 11:03:50 PDT
Attachment 87766 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1 Tools/WebKitTestRunner/EventSenderProxy.h:30: Should have a space between // and comment [whitespace/comments] [4] Total errors found: 1 in 30 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chang Shu
Comment 11 2011-03-31 11:11:23 PDT
Created attachment 87770 [details] fix patch 2
Eric Seidel (no email)
Comment 12 2011-04-26 16:56:33 PDT
Comment on attachment 87770 [details] fix patch 2 I'm told Maciej believes this can't work this way. I'm sorry I don't have more infromation for you than that.
Chang Shu
Comment 13 2011-04-26 17:07:15 PDT
(In reply to comment #12) > (From update of attachment 87770 [details]) > I'm told Maciej believes this can't work this way. I'm sorry I don't have more infromation for you than that. Yes, I understand. Thanks
Chang Shu
Comment 14 2011-05-24 11:11:35 PDT
I am back to this bug now. I had a concern that the synchronous message cannot hop from WebProcess to UIProcess and to WebProcess again. But after I investigated the code, it actually works.
Chang Shu
Comment 15 2011-05-25 09:05:49 PDT
Created attachment 94789 [details] fix patch 3 This patch allows key events being sent from WTR::InjectedBundle to WTR UIProcess and then to WebKit2::WebProcess again, all synchronously.
Adam Roben (:aroben)
Comment 16 2011-08-17 08:05:56 PDT
*** Bug 62576 has been marked as a duplicate of this bug. ***
Darin Adler
Comment 17 2011-09-12 17:05:25 PDT
Comment on attachment 94789 [details] fix patch 3 View in context: https://bugs.webkit.org/attachment.cgi?id=94789&action=review > Source/WebKit2/UIProcess/API/C/WKPagePrivate.h:71 > +WK_EXPORT void WKPageSetSendEventSynchronously(WKPageRef page, bool sync); The name here is not ideal. Given what this does, normally we’d name this WKPageSetShouldSendKeyboardEventsSynchronously. > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1091 > + // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). Do we really need this FIXME? > Source/WebKit2/WebProcess/WebPage/WebPage.messages.in:36 > + KeyEventSync(WebKit::WebKeyboardEvent event) -> (bool handled) I think it would be best if there was some way to indicate this was intended for testing only. > Tools/WebKitTestRunner/EventSenderProxy.h:36 > + EventSenderProxy(TestController* testController) : m_testController(testController) { }; This semicolon is unnecessary. > Tools/WebKitTestRunner/EventSenderProxy.h:38 > + void keyDown(WKStringRef key, WKEventModifiers, unsigned int location, double timestamp); It should be "unsigned", not "unsigned int". > Tools/WebKitTestRunner/TestController.cpp:31 > +#if PLATFORM(MAC) > +#include "EventSenderProxy.h" > +#endif Conditional includes should normally be separate and under unconditional includes. > Tools/WebKitTestRunner/TestController.cpp:502 > +#if PLATFORM(MAC) What is Mac-specific here? > Tools/WebKitTestRunner/TestController.cpp:518 > + unsigned int location = static_cast<unsigned int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, locationKey.get())))); Should just be "unsigned" not "unsigned int".
Chang Shu
Comment 18 2011-09-12 20:45:48 PDT
Thanks a lot for the review, Darin. I'll provide a new patch to accommodate your review and rebase the code. (In reply to comment #17) > (From update of attachment 94789 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=94789&action=review > > > Source/WebKit2/UIProcess/API/C/WKPagePrivate.h:71 > > +WK_EXPORT void WKPageSetSendEventSynchronously(WKPageRef page, bool sync); > > The name here is not ideal. Given what this does, normally we’d name this WKPageSetShouldSendKeyboardEventsSynchronously. > > > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1091 > > + // FIXME: Platform default behaviors should be performed during normal DOM event dispatch (in most cases, in default keydown event handler). > > Do we really need this FIXME? > > > Source/WebKit2/WebProcess/WebPage/WebPage.messages.in:36 > > + KeyEventSync(WebKit::WebKeyboardEvent event) -> (bool handled) > > I think it would be best if there was some way to indicate this was intended for testing only. > > > Tools/WebKitTestRunner/EventSenderProxy.h:36 > > + EventSenderProxy(TestController* testController) : m_testController(testController) { }; > > This semicolon is unnecessary. > > > Tools/WebKitTestRunner/EventSenderProxy.h:38 > > + void keyDown(WKStringRef key, WKEventModifiers, unsigned int location, double timestamp); > > It should be "unsigned", not "unsigned int". > > > Tools/WebKitTestRunner/TestController.cpp:31 > > +#if PLATFORM(MAC) > > +#include "EventSenderProxy.h" > > +#endif > > Conditional includes should normally be separate and under unconditional includes. > > > Tools/WebKitTestRunner/TestController.cpp:502 > > +#if PLATFORM(MAC) > > What is Mac-specific here? > > > Tools/WebKitTestRunner/TestController.cpp:518 > > + unsigned int location = static_cast<unsigned int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, locationKey.get())))); > > Should just be "unsigned" not "unsigned int".
Balazs Kelemen
Comment 19 2011-09-13 05:35:12 PDT
It's strange to me that this patch is a Mac-only fix. I guess the plan is to do the platform independent part and the Mac part in one and later fix it on other platforms, is that right?
Chang Shu
Comment 20 2011-09-13 06:57:31 PDT
Exactly. I will change the title. Thanks. (In reply to comment #19) > It's strange to me that this patch is a Mac-only fix. I guess the plan is to do the platform independent part and the Mac part in one and later fix it on other platforms, is that right?
Chang Shu
Comment 21 2011-09-13 11:42:00 PDT
WebKit Review Bot
Comment 22 2011-09-13 12:25:51 PDT
Comment on attachment 107203 [details] patch 4 Clearing flags on attachment: 107203 Committed r95039: <http://trac.webkit.org/changeset/95039>
WebKit Review Bot
Comment 23 2011-09-13 12:25:57 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.