Bug 201632 - [Win][WK2] Pressing space key on text input form scrolls the page
Summary: [Win][WK2] Pressing space key on text input form scrolls the page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-09 22:22 PDT by Fujii Hironori
Modified: 2020-01-21 17:57 PST (History)
7 users (show)

See Also:


Attachments
test case (107 bytes, text/html)
2019-09-09 22:22 PDT, Fujii Hironori
no flags Details
test case (130 bytes, text/html)
2019-09-10 19:47 PDT, Fujii Hironori
no flags Details
Patch (2.27 KB, patch)
2020-01-20 22:29 PST, Fujii Hironori
ross.kirsling: review+
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-09-09 22:22:12 PDT
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.
Comment 1 Fujii Hironori 2019-09-09 22:26:13 PDT
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
Comment 2 Fujii Hironori 2019-09-10 19:47:44 PDT
Created attachment 378532 [details]
test case
Comment 3 Fujii Hironori 2019-09-10 19:48:41 PDT
scrolling happens every time.
Comment 4 Fujii Hironori 2019-09-10 23:15:43 PDT
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
Comment 5 Fujii Hironori 2019-09-10 23:19:44 PDT
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.
Comment 6 Fujii Hironori 2019-09-11 01:01:19 PDT
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
Comment 7 Fujii Hironori 2020-01-20 21:02:57 PST
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
Comment 8 Fujii Hironori 2020-01-20 22:29:46 PST
Created attachment 388280 [details]
Patch
Comment 9 Fujii Hironori 2020-01-21 17:56:22 PST
Committed r254897: <https://trac.webkit.org/changeset/254897>
Comment 10 Radar WebKit Bug Importer 2020-01-21 17:57:12 PST
<rdar://problem/58781952>