WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 204694
200558
[Win][WebKit2] Can't prevent input events by canceling keydown events
https://bugs.webkit.org/show_bug.cgi?id=200558
Summary
[Win][WebKit2] Can't prevent input events by canceling keydown events
Fujii Hironori
Reported
2019-08-08 19:11:19 PDT
[Win][WebKit2] Can't prevent input events by canceling keydown events You can test it by using
https://javascript.info/keyboard-events
In old Windows WK2, this issue was fixed in
Bug 56020
– WebKit2: Pressing Tab in Web Inspector's console does not cycle through completion options
r83633
In Windows WK1, WM_CHAR event is removed if WM_DOWN is consumed. WebView::keyDown ::PeekMessage(&msg, m_viewWindow, WM_CHAR, WM_CHAR, PM_REMOVE);
https://trac.webkit.org/browser/webkit/trunk/Source/WebKitLegacy/win/WebView.cpp?rev=248454#L2393
r23462
r25377
r28620
(
Bug 13916
)
Attachments
WIP patch
(907 bytes, patch)
2019-10-03 21:50 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(2.59 KB, patch)
2019-10-03 22:07 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Patch
(2.59 KB, patch)
2019-10-03 22:08 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2019-10-03 21:33:11 PDT
Test cases testing preventing a keydown event. fast/events/inputText-never-fired-on-keydown-cancel.html fast/events/keydown-keypress-preventDefault.html
Fujii Hironori
Comment 2
2019-10-03 21:44:54 PDT
In old WebKit2 approach, TranslateMessage was called if a keydown event isn't comsumed. This has two problems: 1. This method can't be used in applications which is using TranslateMessage normally. For example and particularly, MiniBrowser can't use it because it supports WK1 and WK2 windows. 2. keypress event could be dispatched after keyup event unexpectedly. For example, if I type VK_A and VK_B quickly. Following native key events are queued: WM_KEYDOWN (VK_A) WM_KEYUP (VK_A) WM_KEYDOWN (VK_B) WM_KEYUP (VK_B) The first WM_KEYDOWN is sent to web process, and remaining events are queued in m_keyEventQueue. In didNotHandleKeyEvent of the first event, WM_CHAR (a) is posted by TranslateMessage. This is too late.
Fujii Hironori
Comment 3
2019-10-03 21:50:04 PDT
Created
attachment 380184
[details]
WIP patch This WIP patch removed queued WebEvent::Char events if WebEvent::RawKeyDown is handled. This WIP patch works fine for MiniBrowser, but for WebKitTestRunner because WebKitTestRunner processes IPC messages synchronously.
Fujii Hironori
Comment 4
2019-10-03 22:07:19 PDT
Created
attachment 380185
[details]
Patch
Fujii Hironori
Comment 5
2019-10-03 22:08:12 PDT
Created
attachment 380186
[details]
Patch
Fujii Hironori
Comment 6
2019-10-04 00:27:30 PDT
(In reply to Fujii Hironori from
comment #2
)
> In old WebKit2 approach, TranslateMessage was called if a keydown > event isn't comsumed. > > This has two problems: > 1. This method can't be used in applications which is using TranslateMessage > normally. > For example and particularly, MiniBrowser can't use it because it > supports WK1 and WK2 windows.
This might be possible by checking the target window is WK1.
> while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { > if (isWebKit1BrowserWindow(msg.hwnd)) > TranslateMessage(&msg); > DispatchMessage(&msg); > }
Fujii Hironori
Comment 7
2019-10-08 06:25:07 PDT
Comment on
attachment 380186
[details]
Patch This approach doesn't seem good for
Bug 202183
. Cleared r? flag.
Fujii Hironori
Comment 8
2019-12-01 19:21:41 PST
Fixed in
r252976
. *** This bug has been marked as a duplicate of
bug 204694
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug