[webkit-changes] [WebKit/WebKit] fd1f0b: [GTK] Remove key event reinjection

Michael Catanzaro noreply at github.com
Thu Feb 1 10:16:49 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fd1f0b783bb7b0b957f17c4e9594f11747e2be33
      https://github.com/WebKit/WebKit/commit/fd1f0b783bb7b0b957f17c4e9594f11747e2be33
  Author: Michael Catanzaro <mcatanzaro at redhat.com>
  Date:   2024-02-01 (Thu, 01 Feb 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h

  Log Message:
  -----------
  [GTK] Remove key event reinjection
https://bugs.webkit.org/show_bug.cgi?id=261348

Reviewed by Carlos Garcia Campos.

Event processing in GTK is synchronous, but in WebKit it is asynchronous
because we don't want to block the UI process waiting for the web
process to decide whether a DOM event has been handled (e.g. by using
Event.stopPropagation). Currently we use a complicated scheme to
synthesize and reinject new key and wheel events to continue event
processing when the event is not handled by the web content, which the
GTK developers do not approve of, and which is causing serious problems
where Epiphany has to choose between processing events in an infinite
loop vs. handling events too soon and blocking the web view from
receiving them. Neither option is great.

https://gitlab.gnome.org/GNOME/epiphany/-/issues/1915
https://gitlab.gnome.org/GNOME/epiphany/-/issues/2173

The solution is to just never reinject events, and instead always handle
them. We do not need event reinjection anymore if we activate
application accelerators manually. See the long comment embedded in this
commit for full details of why this is necessary.

This patch removes the key event reinjection. Wheel event reinjection is
not yet removed because this would break when WebKit is used within
scrolled windows.

 * Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:
 (WebKit::PageClientImpl::doneWithKeyEvent):
 * Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
 (shouldForwardKeyEvent):
 (webkitWebViewBaseProcessAcceleratorsForKeyPressEvent):
 (webkitWebViewBaseKeyPressed):
 (handleScroll):
 (webkitWebViewBasePropagateKeyEvent):
 * Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h:

Canonical link: https://commits.webkit.org/273922@main




More information about the webkit-changes mailing list