Bug 210069

Summary: [GTK] Use gdk_window_move_to_rect() to position popup menus
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, jadahl, jmason, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=210603
Attachments:
Description Flags
Patch
mcatanzaro: review+
Regression: dropdown select menus mispositioned none

Description Michael Catanzaro 2020-04-06 13:26:34 PDT
Bug title: [GTK] Use gdk_window_move_to_rect() to position popup menus

WebPopupMenuProxyGtk::showPopupMenu currently uses gtk_window_move() to position the popup menu. Jonas doesn't like this; he says it can cause the menu to be positioned offscreen. Indeed, we have a longstanding bug where context menus near the bottom of the window will exceed the length of the screen. Jonas says Firefox doesn't have this problem, and that the fix would be to use gdk_window_move_to_rect() instead. Our code already has a FIXME to do this, with a pointer to a bug report asking for that API (which was private at the time) to be exported:

// FIXME: We can't ensure the menu will be on screen in Wayland.
// https://blog.gtk.org/2016/07/15/future-of-relative-window-positioning/
// https://gitlab.gnome.org/GNOME/gtk/issues/997

I looked into trying this, but it didn't look simple.
Comment 1 Carlos Garcia Campos 2020-04-11 05:58:00 PDT
Created attachment 396162 [details]
Patch
Comment 2 Carlos Garcia Campos 2020-04-12 02:28:52 PDT
Committed r259944: <https://trac.webkit.org/changeset/259944>
Comment 3 Jim Mason 2020-04-16 04:17:07 PDT
Created attachment 396632 [details]
Regression: dropdown select menus mispositioned

With this patch, I am finding that dropdown SELECT menus are mispositioned.  See attachment.

GTK 3.24.11 / X11

(If I should be opening new slips for regressions, please let me know.)