RESOLVED FIXED 181228
Web Inspector: [GTK] Copy copies to nowhere
https://bugs.webkit.org/show_bug.cgi?id=181228
Summary Web Inspector: [GTK] Copy copies to nowhere
Dan Jacobson
Reported 2018-01-02 16:30:39 PST
Please see https://bugzilla.gnome.org/show_bug.cgi?id=792133 Package: epiphany-browser Version: 3.26.5.1-1 -- System Information: Debian Release: buster/sid APT prefers experimental APT policy: (990, 'experimental'), (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 4.14.0-2-amd64 (SMP w/2 CPU cores) Locale: LANG=zh_TW.UTF-8, LC_CTYPE=zh_TW.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Init: systemd (via /run/systemd/system) Versions of packages epiphany-browser depends on: ii dbus-x11 [dbus-session-bus] 1.12.2-1 ii epiphany-browser-data 3.26.5.1-1 ii gsettings-desktop-schemas 3.24.1-2 ii iso-codes 3.77-1 ii libc6 2.26-0experimental3 ii libcairo2 1.15.8-3 ii libgcr-base-3-1 3.20.0-6 ii libgcr-ui-3-1 3.20.0-6 ii libgdk-pixbuf2.0-0 2.36.11-1 ii libglib2.0-0 2.54.2-5 ii libgmp10 2:6.1.2+dfsg-1.1 ii libgnome-desktop-3-12 3.26.2-4 ii libgtk-3-0 3.22.26-2 ii libhogweed4 3.4-1 ii libicu57 57.1-8 ii libjavascriptcoregtk-4.0-18 2.19.3-1 ii libjson-glib-1.0-0 1.4.2-3 ii libnettle6 3.4-1 ii libnotify4 0.7.7-3 ii libpango-1.0-0 1.40.14-1 ii libsecret-1-0 0.18.5-5 ii libsoup2.4-1 2.60.2-2 ii libsqlite3-0 3.21.0-1 ii libwebkit2gtk-4.0-37 2.19.3-1 ii libxml2 2.9.4+dfsg1-6.1 Versions of packages epiphany-browser recommends: pn browser-plugin-evince <none> ii ca-certificates 20170717 pn evince <none> ii libwebkit2gtk-4.0-37-gtk2 2.19.3-1 pn yelp <none> epiphany-browser suggests no packages. -- no debconf information
Attachments
Patch (3.96 KB, patch)
2019-04-02 03:40 PDT, Carlos Garcia Campos
mcatanzaro: review+
Michael Catanzaro
Comment 1 2018-01-03 08:58:23 PST
Please leave some useful comment when reporting a bug. The problem is that it's impossible to Copy anything out of the web inspector; the Copy context menu item does nothing. I presume it's left unimplemented somewhere in the web inspector code, as if it used the WebCore pasteboard classes it ought to work.
Carlos Garcia Campos
Comment 2 2019-04-02 03:38:29 PDT
This regressed when we decided to complicate the code to use GMenus instead of GtkAction. 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.
Carlos Garcia Campos
Comment 3 2019-04-02 03:40:44 PDT
Michael Catanzaro
Comment 4 2019-04-02 06:08:54 PDT
Comment on attachment 366482 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366482&action=review > Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:158 > + case ActionType: > + case CheckableActionType: { Is there no complaint from -Wimplicit-fallthrough? We have a FALLTHROUGH macro that expands to a suitable attribute to avoid warnings here: case ActionType: FALLTHROUGH; case CheckableActionType: {
Joseph Pecoraro
Comment 5 2019-04-02 11:24:51 PDT
Comment on attachment 366482 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366482&action=review >> Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:158 >> + case CheckableActionType: { > > Is there no complaint from -Wimplicit-fallthrough? We have a FALLTHROUGH macro that expands to a suitable attribute to avoid warnings here: > > case ActionType: > FALLTHROUGH; > case CheckableActionType: { FALLTHROUGH is normally only necessary if there has been some statement between case statements. Here they are grouped directly next to each other so it probably won't be necessary.
Devin Rousso
Comment 6 2019-04-02 14:05:51 PDT
Comment on attachment 366482 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=366482&action=review > Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:126 > + Vector<WebContextMenuItemGlib> subMenuItems; > + populateSubMenu(itemData, subMenuItems); > + items.append(WebContextMenuItemGlib(itemData, WTFMove(subMenuItems))); Rather than pass `subMenuItems` in as a modifiable arguments, could you have `populateSubMenu` return the `Vector<WebContextMenuItemGlib>` instead? ``` Vector<WebContextMenuItemGlib> WebContextMenuProxyGtk::populateSubMenu(const WebContextMenuItemData& subMenuItemData) { Vector<WebContextMenuItemGlib> items; for (const auto& itemData : subMenuItemData.submenu()) { if (itemData.type() == SubmenuType) items.append(WebContextMenuItemGlib(itemData, populateSubMenu(itemData)); else items.append(itemData); } return items; } ``` > Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:153 > + Vector<WebContextMenuItemGlib> subMenuItems; > + populateSubMenu(item->data(), subMenuItems); > + WebContextMenuItemGlib menuitem(item->data(), WTFMove(subMenuItems)); Ditto (>124).
Carlos Garcia Campos
Comment 7 2019-04-03 01:19:21 PDT
(In reply to Joseph Pecoraro from comment #5) > Comment on attachment 366482 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=366482&action=review > > >> Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:158 > >> + case CheckableActionType: { > > > > Is there no complaint from -Wimplicit-fallthrough? We have a FALLTHROUGH macro that expands to a suitable attribute to avoid warnings here: > > > > case ActionType: > > FALLTHROUGH; > > case CheckableActionType: { > > FALLTHROUGH is normally only necessary if there has been some statement > between case statements. Here they are grouped directly next to each other > so it probably won't be necessary. Exactly, FALLTHROUGH is for the cases where it's not obvious if you want to fall through or you forgot to add the break. That's not the case here.
Carlos Garcia Campos
Comment 8 2019-04-03 01:19:49 PDT
(In reply to Devin Rousso from comment #6) > Comment on attachment 366482 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=366482&action=review > > > Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:126 > > + Vector<WebContextMenuItemGlib> subMenuItems; > > + populateSubMenu(itemData, subMenuItems); > > + items.append(WebContextMenuItemGlib(itemData, WTFMove(subMenuItems))); > > Rather than pass `subMenuItems` in as a modifiable arguments, could you have > `populateSubMenu` return the `Vector<WebContextMenuItemGlib>` instead? > ``` > Vector<WebContextMenuItemGlib> > WebContextMenuProxyGtk::populateSubMenu(const WebContextMenuItemData& > subMenuItemData) > { > Vector<WebContextMenuItemGlib> items; > for (const auto& itemData : subMenuItemData.submenu()) { > if (itemData.type() == SubmenuType) > items.append(WebContextMenuItemGlib(itemData, > populateSubMenu(itemData)); > else > items.append(itemData); > } > return items; > } > ``` Yes, much better. Thanks! > > Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp:153 > > + Vector<WebContextMenuItemGlib> subMenuItems; > > + populateSubMenu(item->data(), subMenuItems); > > + WebContextMenuItemGlib menuitem(item->data(), WTFMove(subMenuItems)); > > Ditto (>124).
Carlos Garcia Campos
Comment 9 2019-04-03 01:25:33 PDT
Radar WebKit Bug Importer
Comment 10 2019-04-03 01:26:27 PDT
Note You need to log in before you can comment on or make changes to this bug.