Title: [260252] trunk/Source/WebKit
Revision
260252
Author
[email protected]
Date
2020-04-17 08:24:56 -0700 (Fri, 17 Apr 2020)

Log Message

[GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11
https://bugs.webkit.org/show_bug.cgi?id=210603

Patch by Carlos Garcia Campos <[email protected]> on 2020-04-17
Reviewed by Michael Catanzaro.

gdk_window_move_to_rect expects the given rectangle in coordinates relative to the top-left corner of the window
that the popup window is transient for. We were using screen coordinates.

* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu): Translate widget coordinates to window coordinates before passing
the rectangle to gdk_window_move_to_rect().

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260251 => 260252)


--- trunk/Source/WebKit/ChangeLog	2020-04-17 15:02:22 UTC (rev 260251)
+++ trunk/Source/WebKit/ChangeLog	2020-04-17 15:24:56 UTC (rev 260252)
@@ -1,3 +1,17 @@
+2020-04-17  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11
+        https://bugs.webkit.org/show_bug.cgi?id=210603
+
+        Reviewed by Michael Catanzaro.
+
+        gdk_window_move_to_rect expects the given rectangle in coordinates relative to the top-left corner of the window
+        that the popup window is transient for. We were using screen coordinates.
+
+        * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
+        (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Translate widget coordinates to window coordinates before passing
+        the rectangle to gdk_window_move_to_rect().
+
 2020-04-17  David Kilzer  <[email protected]>
 
         REGRESSION (r256756): -[WKUserDefaults initWithSuiteName:]: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'

Modified: trunk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp (260251 => 260252)


--- trunk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2020-04-17 15:02:22 UTC (rev 260251)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2020-04-17 15:24:56 UTC (rev 260252)
@@ -276,9 +276,9 @@
     gtk_widget_set_size_request(m_popup, width, -1);
     gtk_scrolled_window_set_min_content_height(swindow, itemCount * itemHeight);
 
-    IntPoint menuPosition = convertWidgetPointToScreenPoint(m_webView, rect.location());
 #if GTK_CHECK_VERSION(3, 24, 0)
-    GdkRectangle windowRect = { menuPosition.x(), menuPosition.y(), rect.width(), rect.height() };
+    GdkRectangle windowRect = { rect.x(), rect.y(), rect.width(), rect.height() };
+    gtk_widget_translate_coordinates(m_webView, toplevel, windowRect.x, windowRect.y, &windowRect.x, &windowRect.y);
     gdk_window_move_to_rect(gtk_widget_get_window(m_popup), &windowRect, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST,
         static_cast<GdkAnchorHints>(GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE | GDK_ANCHOR_RESIZE), 0, 0);
 #else
@@ -285,6 +285,7 @@
     GtkRequisition menuRequisition;
     gtk_widget_get_preferred_size(m_popup, &menuRequisition, nullptr);
 
+    IntPoint menuPosition = convertWidgetPointToScreenPoint(m_webView, rect.location());
     if (menuPosition.x() + menuRequisition.width > area.x + area.width)
         menuPosition.setX(area.x + area.width - menuRequisition.width);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to