<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>145866</bug_id>
          
          <creation_ts>2015-06-10 19:47:23 -0700</creation_ts>
          <short_desc>[GTK] Attach popup menu to web view widget</short_desc>
          <delta_ts>2017-04-11 04:24:01 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonas Ådahl">jadahl</reporter>
          <assigned_to name="Adrian Perez">aperez</assigned_to>
          <cc>aperez</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cdumez</cc>
    
    <cc>cgarcia</cc>
    
    <cc>commit-queue</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>ysuzuki</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1101201</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Ådahl">jadahl</who>
    <bug_when>2015-06-10 19:47:23 -0700</bug_when>
    <thetext>In order to avoid having the GDK backend guess what the parent widget of the popup is, set it explicitly. This makes popup menus work more reliably under Wayland, as a popup menu is always required to be attached to a parent window.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1101210</commentid>
    <comment_count>1</comment_count>
      <attachid>254704</attachid>
    <who name="Jonas Ådahl">jadahl</who>
    <bug_when>2015-06-10 20:18:52 -0700</bug_when>
    <thetext>Created attachment 254704
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1107464</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-07-07 10:03:04 -0700</bug_when>
    <thetext>Zan, can you review this please? It&apos;s a one-liner. I will just say that the patch should use nullptr instead of 0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1108127</commentid>
    <comment_count>3</comment_count>
      <attachid>254704</attachid>
    <who name="Zan Dobersek">zan</who>
    <bug_when>2015-07-08 23:02:26 -0700</bug_when>
    <thetext>Comment on attachment 254704
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=254704&amp;action=review

&gt; Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp:133
&gt; +    gtk_menu_attach_to_widget(GTK_MENU(m_popup), GTK_WIDGET(m_webView), 0);

Right, nullptr is preferred.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296004</commentid>
    <comment_count>4</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-10 09:36:16 -0700</bug_when>
    <thetext>This is related to bug #170553, which is to move to non-deprecated
functions which handle positioning of popups more reliably. I think
it is still desirable to attach the popup to the web view because
even when we will be using gtk_menu_popup_at_{rect,widget,pointer}
those functions do not attach the menu to the widget (at least that&apos;s
my understanding from reading the GTK+ documentation).

Jonas, will you be updating this patch, or do you want me to update
it and land it for you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296228</commentid>
    <comment_count>5</comment_count>
    <who name="Jonas Ådahl">jadahl</who>
    <bug_when>2017-04-10 17:19:07 -0700</bug_when>
    <thetext>(In reply to Adrian Perez from comment #4)
&gt; This is related to bug #170553, which is to move to non-deprecated
&gt; functions which handle positioning of popups more reliably. I think
&gt; it is still desirable to attach the popup to the web view because
&gt; even when we will be using gtk_menu_popup_at_{rect,widget,pointer}
&gt; those functions do not attach the menu to the widget (at least that&apos;s
&gt; my understanding from reading the GTK+ documentation).
&gt; 
&gt; Jonas, will you be updating this patch, or do you want me to update
&gt; it and land it for you?

Seems I had forgotten about this. If you could rebase and land, that would be great, as I don&apos;t have a recent tree checked out nor built. If your time is limited, I&apos;ll try to get it done in the coming days.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296304</commentid>
    <comment_count>6</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-11 00:48:34 -0700</bug_when>
    <thetext>(In reply to Jonas Ådahl from comment #5)
&gt; (In reply to Adrian Perez from comment #4)
&gt; &gt; This is related to bug #170553, which is to move to non-deprecated
&gt; &gt; functions which handle positioning of popups more reliably. I think
&gt; &gt; it is still desirable to attach the popup to the web view because
&gt; &gt; even when we will be using gtk_menu_popup_at_{rect,widget,pointer}
&gt; &gt; those functions do not attach the menu to the widget (at least that&apos;s
&gt; &gt; my understanding from reading the GTK+ documentation).
&gt; &gt; 
&gt; &gt; Jonas, will you be updating this patch, or do you want me to update
&gt; &gt; it and land it for you?
&gt; 
&gt; Seems I had forgotten about this. If you could rebase and land, that would
&gt; be great, as I don&apos;t have a recent tree checked out nor built. If your time
&gt; is limited, I&apos;ll try to get it done in the coming days.

I have been hunting popup menu bugs the last days, so I&apos;ll just go ahead
and get this landed — I&apos;ll credit you in the log. Thanks for the patch and
for stopping by for commenting :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296305</commentid>
    <comment_count>7</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-11 00:50:52 -0700</bug_when>
    <thetext>FWIW, this does not apply cleanly after the patch for bug #170553 has
landed and needed a rebase. I am now waiting for a build that I can
smoketest before posting an updated version.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296337</commentid>
    <comment_count>8</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-11 03:29:09 -0700</bug_when>
    <thetext>This seems to fix the remaining issue that we had with popup menus
in Wayland: after applying this on current “master”, menus with a
lot of elements are correctly resized and repositioned to fit in the
current screen when running *under Mutter* (and hence GNOME Shell).

Under Weston, long menus still bleed outside of the screen. Most likely
my Weston is too old for the version of the “xdg_popup” interface (part
of “xdg_shell”) that GTK+ is using. Probably this could happen with
other Wayland compositors as well. I think this is fine: we do all
that is possible from our part with what GTK+ provides, and IMHO the
ball would be now in the court of the compositors that don&apos;t implement
the “xdg_popup” interface.

I&apos;ll upload the patch in a moment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296338</commentid>
    <comment_count>9</comment_count>
      <attachid>306793</attachid>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2017-04-11 03:32:45 -0700</bug_when>
    <thetext>Created attachment 306793
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296347</commentid>
    <comment_count>10</comment_count>
      <attachid>306793</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-04-11 04:19:57 -0700</bug_when>
    <thetext>Comment on attachment 306793
Patch

Clearing flags on attachment: 306793

Committed r215225: &lt;http://trac.webkit.org/changeset/215225&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296348</commentid>
    <comment_count>11</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-04-11 04:19:58 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1296349</commentid>
    <comment_count>12</comment_count>
    <who name="Jonas Ådahl">jadahl</who>
    <bug_when>2017-04-11 04:24:01 -0700</bug_when>
    <thetext>(In reply to Adrian Perez from comment #8)
&gt; This seems to fix the remaining issue that we had with popup menus
&gt; in Wayland: after applying this on current “master”, menus with a
&gt; lot of elements are correctly resized and repositioned to fit in the
&gt; current screen when running *under Mutter* (and hence GNOME Shell).
&gt; 
&gt; Under Weston, long menus still bleed outside of the screen. Most likely
&gt; my Weston is too old for the version of the “xdg_popup” interface (part
&gt; of “xdg_shell”) that GTK+ is using. Probably this could happen with
&gt; other Wayland compositors as well. I think this is fine: we do all
&gt; that is possible from our part with what GTK+ provides, and IMHO the
&gt; ball would be now in the court of the compositors that don&apos;t implement
&gt; the “xdg_popup” interface.

This is only because libweston-desktop (used by &quot;weston&quot;) only having partially implemented xdg-shell (last time I checked this was the case). It implements the positioning, but not the constraining, which is fine according to spec, but less good from a UX point of view. There is nothing WebKit or GTK+ should do about anything about however.

&gt; 
&gt; I&apos;ll upload the patch in a moment.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>254704</attachid>
            <date>2015-06-10 20:18:52 -0700</date>
            <delta_ts>2017-04-11 03:32:35 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-145866-20150611111822.patch</filename>
            <type>text/plain</type>
            <size>1785</size>
            <attacher name="Jonas Ådahl">jadahl</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTg1MzEwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0Mi9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViS2l0Mi9DaGFuZ2VMb2cKaW5kZXggMzQ5YTg4MDFlZWZlZjUz
Zjk4MzU2NjlmZWEyMDI3YTc5ZjRiNDczNy4uMTQwYzI5MGVlZDI3OGNmYzkzZTUxMmVhYzdhNGRh
ZWExZTMwYzlhYiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYktpdDIvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJLaXQyL0NoYW5nZUxvZwpAQCAtMSwzICsxLDEzIEBACisyMDE1LTA2LTEwICBKb25h
cyDDhWRhaGwgIDxqYWRhaGxAZ21haWwuY29tPgorCisgICAgICAgIFtHVEtdIEF0dGFjaCBwb3B1
cCBtZW51IHRvIHdlYiB2aWV3IHdpZGdldAorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l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wgInVubWFwIiwgR19DQUxMQkFDSyhtZW51
VW5tYXBwZWQpLCB0aGlzKTsKIAogICAgIGNvbnN0IEdka0V2ZW50KiBldmVudCA9IG1fY2xpZW50
LT5jdXJyZW50bHlQcm9jZXNzZWRNb3VzZURvd25FdmVudCgpID8gbV9jbGllbnQtPmN1cnJlbnRs
eVByb2Nlc3NlZE1vdXNlRG93bkV2ZW50KCktPm5hdGl2ZUV2ZW50KCkgOiBudWxscHRyOworICAg
IGd0a19tZW51X2F0dGFjaF90b193aWRnZXQoR1RLX01FTlUobV9wb3B1cCksIEdUS19XSURHRVQo
bV93ZWJWaWV3KSwgMCk7CiAgICAgZ3RrX21lbnVfcG9wdXBfZm9yX2RldmljZShHVEtfTUVOVSht
X3BvcHVwKSwgZXZlbnQgPyBnZGtfZXZlbnRfZ2V0X2RldmljZShldmVudCkgOiBudWxscHRyLCBu
dWxscHRyLCBudWxscHRyLAogICAgICAgICBbXShHdGtNZW51KiwgZ2ludCogeCwgZ2ludCogeSwg
Z2Jvb2xlYW4qIHB1c2hJbiwgZ3BvaW50ZXIgdXNlckRhdGEpIHsKICAgICAgICAgICAgIC8vIFdl
IGNhbiBwYXNzIGEgcG9pbnRlciB0byB0aGUgbWVudVBvc2l0aW9uIGxvY2FsIHZhcmlhYmxlIGJl
Y2F1c2UgdGhlIG5lc3RlZCBtYWluIGxvb3AgZW5zdXJlcyB0aGlzIGlzIGNhbGxlZCBpbiB0aGUg
ZnVuY3Rpb24gY29udGV4dC4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>306793</attachid>
            <date>2017-04-11 03:32:45 -0700</date>
            <delta_ts>2017-04-11 04:19:57 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-145866-20170411133244.patch</filename>
            <type>text/plain</type>
            <size>1899</size>
            <attacher name="Adrian Perez">aperez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE1MjIzCmRpZmY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