Title: [215188] trunk/Source/WebKit2
Revision
215188
Author
commit-qu...@webkit.org
Date
2017-04-10 10:55:50 -0700 (Mon, 10 Apr 2017)

Log Message

[GTK] Opening a popup menu does not pre-select the active item
https://bugs.webkit.org/show_bug.cgi?id=170680

Patch by Adrian Perez de Castro <ape...@igalia.com> on 2017-04-10
Reviewed by Michael Catanzaro.

* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_shell_select_item() to
ensure that the active item appears selected right after popping up the menu.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (215187 => 215188)


--- trunk/Source/WebKit2/ChangeLog	2017-04-10 17:54:49 UTC (rev 215187)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-10 17:55:50 UTC (rev 215188)
@@ -1,3 +1,14 @@
+2017-04-10  Adrian Perez de Castro  <ape...@igalia.com>
+
+        [GTK] Opening a popup menu does not pre-select the active item
+        https://bugs.webkit.org/show_bug.cgi?id=170680
+
+        Reviewed by Michael Catanzaro.
+
+        * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
+        (WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_shell_select_item() to
+        ensure that the active item appears selected right after popping up the menu.
+
 2017-04-10  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Enable DOM timer throttling and CSS animations suspension

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp (215187 => 215188)


--- trunk/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2017-04-10 17:54:49 UTC (rev 215187)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp	2017-04-10 17:55:50 UTC (rev 215188)
@@ -142,6 +142,12 @@
        m_client->failedToShowPopupMenu();
        return;
     }
+
+    // This ensures that the active item gets selected after popping up the menu, and
+    // as it says in "gtkcombobox.c" (line ~1606): it's ugly, but gets the job done.
+    GtkWidget* activeChild = gtk_menu_get_active(GTK_MENU(m_popup));
+    if (activeChild && gtk_widget_get_visible(activeChild))
+        gtk_menu_shell_select_item(GTK_MENU_SHELL(m_popup), activeChild);
 }
 
 void WebPopupMenuProxyGtk::hidePopupMenu()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to