Created attachment 378442 [details] test case [Win][WK2] Pressing space key sometimes inputs space character, but scrolling the page otherwise 1. Start Windows WK2 MiniBrowser 2. Open test page 3. Hitting space key repeatedly Expected: space characters should be input consistently Actual: Sometimes page scrolling happens.
It seems that the current implementation of WebPage::performDefaultBehaviorForKeyEvent is wrong. Current implementation: https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/WebProcess/WebPage/win/WebPageWin.cpp?rev=244932#L70 Original implementation: https://trac.webkit.org/browser/webkit/trunk/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp?rev=138331#L201
Created attachment 378532 [details] test case
scrolling happens every time.
In Windows, key events are mapped as following: WM_KEYDOWN → WebEvent::RawKeyDown WM_KEYUP → WebEvent::KeyUp WM_CHAR → WebEvent::Char On the other hand, other ports are using only two types: WebEvent::KeyDown WebEvent::KeyUp
In GTK port, WebEvent::KeyDown are converted to keydown and keypress DOM events. And, keypress event are comsumed in WebEditorClient::handleKeyboardEvent. Then, WebPage::performDefaultBehaviorForKeyEvent is not called because it is consumed.
See also: Bug 56612 – Web page shouldn't swallow alt-key combinations on Windows Bug 43665 – Delete key doesn't go Back in WebKit2 windows
After I implemented the logic preventing keypress event if the preceding keydown event is canceled, space characters can't be input anymore in WinCairo WK2. Bug 204694 – [Win] Retrieve all following WM_CHAR events at the beginning of processing WM_KEYDOWN event
Created attachment 388280 [details] Patch
Committed r254897: <https://trac.webkit.org/changeset/254897>
<rdar://problem/58781952>