You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
https://bugs.webkit.org/show_bug.cgi?id=170553
Source/WebCore:
Reviewed by Carlos Garcia Campos.
* platform/gtk/GtkVersioning.h: Add replacements for GtkPopover functions which are no longet available in GTK4.
(gtk_popover_menu_new): Added.
(gtk_popover_bind_model): Added.
(gtk_popover_set_relative_to): Added.
Source/WebKit:
Reviewed by Carlos Garcia Campos.
Replace GtkMenuShell with a GtkPopoverMenu for context menus. The former is not available
at all in GTK4, and the later allows for simplifying the positioning code: it is enough
to provide a point in WebKitWebView widget where to place the popup, and GTK takes care
of everything. This removes the custom positioning code (as it is not needed anymore),
which did GdkScreen-relative calculations that GTK4 does not support.
No new tests needed.
* Shared/glib/WebContextMenuItemGlib.h:
* UIProcess/API/glib/WebKitWebView.cpp:
(contextMenuDismissed): Change parameter from GtkMenuShell to GtkMenuShell to GtkWidget.
(webkitWebViewPopulateContextMenu): Connect to the GtkPopover::closed signal instead of
GtkMenuShell::deactivate.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(activeContextMenuClosed): Renamed from activeContextMenuUnmapped(), changed parameter
from GtkMenuShell to GtkWidget, and compare with WebContextMenuProxyGtk::gtkWidget().
(activeContextMenuUnmapped): Renamed to activeContextMenuClosed().
(webkitWebViewBaseSetActiveContextMenuProxy): Connect to the GtkPopover::closed signal
instead of GtkMenuShell::deactivate.
(webkitWebViewBaseGetActiveContextMenuProxy):
* UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
* UIProcess/gtk/WebContextMenuProxyGtk.cpp: Arrange to use GtkPopoverMenu instead of
GtkMenuShell.
* UIProcess/gtk/WebContextMenuProxyGtk.cpp:
(WebKit::WebContextMenuProxyGtk::populate):
(WebKit::WebContextMenuProxyGtk::showContextMenuWithItems): Simplify using
m_context.menuLocation() to obtain the location where to make the context menu popup
next to, which allows removing the ::menuPositionFunction() callback as well.
(WebKit::WebContextMenuProxyGtk::WebContextMenuProxyGtk):
(WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
* UIProcess/gtk/WebContextMenuProxyGtk.h: Remove declarations for ::menuPositionFunction()
and ::m_popupPosition, which are now unneeded.
(WebKit::WebContextMenuProxyGtk::gtkWidget const): Renamed from ::gtkMenu(), and made it
return a GtkWidget.
Tools:
Minor adaptations needed in the API tests to account for the differences between
GtkMenuShell and GtkPopoverMenu.
Reviewed by Carlos Garcia Campos.
* TestWebKitAPI/Tests/WebKitGtk/TestContextMenu.cpp:
(lookupWidgetsWalkChild): Added.
(lookupWidgets): Added.
Canonical link: https://commits.webkit.org/224079@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
0 commit comments