⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243793 in webkit


Ignore:
Timestamp:
Apr 3, 2019, 1:25:26 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

Web Inspector: [GTK] Copy copies to nowhere
https://bugs.webkit.org/show_bug.cgi?id=181228

Reviewed by Michael Catanzaro.

The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
the web process.

  • UIProcess/gtk/WebContextMenuProxyGtk.cpp:

(WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
(WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.

  • UIProcess/gtk/WebContextMenuProxyGtk.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243787 r243793  
     12019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Web Inspector: [GTK] Copy copies to nowhere
     4        https://bugs.webkit.org/show_bug.cgi?id=181228
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
     9        HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
     10        the web process.
     11
     12        * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
     13        (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
     14        (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
     15        * UIProcess/gtk/WebContextMenuProxyGtk.h:
     16
    1172019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp

    r228373 r243793  
    118118}
    119119
     120Vector<WebContextMenuItemGlib> WebContextMenuProxyGtk::populateSubMenu(const WebContextMenuItemData& subMenuItemData)
     121{
     122    Vector<WebContextMenuItemGlib> items;
     123    for (const auto& itemData : subMenuItemData.submenu()) {
     124        if (itemData.type() == SubmenuType)
     125            items.append(WebContextMenuItemGlib(itemData, populateSubMenu(itemData)));
     126        else
     127            items.append(itemData);
     128    }
     129    return items;
     130}
     131
    120132void WebContextMenuProxyGtk::populate(const Vector<WebContextMenuItemGlib>& items)
    121133{
     
    129141    GMenu* sectionMenu = menu.get();
    130142    for (const auto& item : items) {
    131         if (item->data().type() == SeparatorType) {
     143        switch (item->data().type()) {
     144        case SeparatorType: {
    132145            GRefPtr<GMenu> section = adoptGRef(g_menu_new());
    133146            g_menu_append_section(menu.get(), nullptr, G_MENU_MODEL(section.get()));
    134147            sectionMenu = section.get();
    135         } else {
     148            break;
     149        }
     150        case SubmenuType: {
     151            WebContextMenuItemGlib menuitem(item->data(), populateSubMenu(item->data()));
     152            append(sectionMenu, menuitem);
     153            break;
     154        }
     155        case ActionType:
     156        case CheckableActionType: {
    136157            WebContextMenuItemGlib menuitem(item->data());
    137158            append(sectionMenu, menuitem);
     159            break;
     160        }
    138161        }
    139162    }
  • trunk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.h

    r227001 r243793  
    6060    GRefPtr<GMenu> buildMenu(const Vector<WebContextMenuItemGlib>&);
    6161    void populate(const Vector<Ref<WebContextMenuItem>>&);
     62    Vector<WebContextMenuItemGlib> populateSubMenu(const WebContextMenuItemData&);
    6263    static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, WebContextMenuProxyGtk*);
    6364
Note: See TracChangeset for help on using the changeset viewer.