Bug 200464 - [Win][MiniBrowser][WK2] Unhandled key events should be bubbled up to the parent window
Summary: [Win][MiniBrowser][WK2] Unhandled key events should be bubbled up to the pare...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-05 20:44 PDT by Fujii Hironori
Modified: 2019-08-05 23:48 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.21 KB, patch)
2019-08-05 20:48 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (4.21 KB, patch)
2019-08-05 23:16 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2019-08-05 20:44:03 PDT
[MiniBrowser][WK2] Unhandled key events should be bubbled up to the parent window

When WK2 WebView is focused, short cut keys (e.g. Alt-F to open File
menu, Alt-F4 to close window, and etc) don't work.

WK1 WebView doesn't have this issue because it processes key events
properly.
Comment 1 Fujii Hironori 2019-08-05 20:48:10 PDT
Created attachment 375597 [details]
Patch
Comment 2 Ross Kirsling 2019-08-05 22:08:01 PDT
Comment on attachment 375597 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375597&action=review

> Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:385
> +    SendMessage(thisWindow.m_hMainWnd, event->message, event->wParam, event->lParam);

What's the difference of SendMessage here from the DefWindowProc that's used in these places?
https://github.com/WebKit/webkit/blob/master/Source/WebKitLegacy/win/WebView.cpp#L2818
https://github.com/WebKit/webkit/blob/master/Source/WebKit/UIProcess/win/WebView.cpp#L179
Comment 3 Fujii Hironori 2019-08-05 23:15:48 PDT
Comment on attachment 375597 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375597&action=review

>> Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:385
>> +    SendMessage(thisWindow.m_hMainWnd, event->message, event->wParam, event->lParam);
> 
> What's the difference of SendMessage here from the DefWindowProc that's used in these places?
> https://github.com/WebKit/webkit/blob/master/Source/WebKitLegacy/win/WebView.cpp#L2818
> https://github.com/WebKit/webkit/blob/master/Source/WebKit/UIProcess/win/WebView.cpp#L179

In WK1, key events are handled synchronously. If WebView doesn't handle the key event, it will be passed to DefWindowProc which sends it to the parent window.

On the other hand, in WK2, key events are handled asynchronously in WebProcess.
handled is always set true here.
https://github.com/WebKit/webkit/tree/69699b3c92158cb980cf7d4356dfd6edaab4a35f/Source/WebKit/UIProcess/win/WebView.cpp#L451,L453

So, I need to re-post the key event in didNotHandleKeyEvent.

Thanks for your comment, I realized I think I should use DefWindowProc instead of SendMessage.
Comment 4 Fujii Hironori 2019-08-05 23:16:32 PDT
Created attachment 375603 [details]
Patch
Comment 5 Fujii Hironori 2019-08-05 23:47:50 PDT
Comment on attachment 375603 [details]
Patch

Clearing flags on attachment: 375603

Committed r248291: <https://trac.webkit.org/changeset/248291>
Comment 6 Fujii Hironori 2019-08-05 23:47:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-08-05 23:48:16 PDT
<rdar://problem/53974077>