<?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>257910</bug_id>
          
          <creation_ts>2023-06-09 13:54:52 -0700</creation_ts>
          <short_desc>[GTK] No key modifier present in wheel event</short_desc>
          <delta_ts>2023-06-12 23:08:39 -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>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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="Elie Donadio">elidoset</reporter>
          <assigned_to name="Michael Catanzaro">mcatanzaro</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1960825</commentid>
    <comment_count>0</comment_count>
      <attachid>466656</attachid>
    <who name="Elie Donadio">elidoset</who>
    <bug_when>2023-06-09 13:54:52 -0700</bug_when>
    <thetext>Created attachment 466656
test case of the bug

The modifier key (ctrlKey, shiftKey,...) properties of the WheelEvent are always false when read from a wheel event callback. 

Tested in Epiphany 44.3-1 and in an embedded application using Webkit2gtk 2.40.2-1, on Arch Linux. 

A test case is provided as an attachement. When scrolling over the red square while the Ctrl key is held down, should turn green. Passes on Firefox 114.0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960928</commentid>
    <comment_count>1</comment_count>
    <who name="Elie Donadio">elidoset</who>
    <bug_when>2023-06-10 02:25:33 -0700</bug_when>
    <thetext>I&apos;ve done a first investigation myself on the question, and I found the problem to be here : https://github.com/WebKit/WebKit/blob/ef93c1b412c09e10975907c8fd683269eb36a413/Source/WebKit/Shared/gtk/NativeWebWheelEventGtk.cpp#LL41C13-L41C13

The modifier events that could have been extracted from the GtkEventScroll are not transmitted to the constructor of WebEvent. This is handled better for key presses (https://github.com/WebKit/WebKit/blob/ef93c1b412c09e10975907c8fd683269eb36a413/Source/WebKit/Shared/gtk/WebEventFactory.cpp#L259), where a factory function parses the GtkEventScroll.state property and transmits the modifier keys using the modifiersForEvent(const GdkEvent*) function. 

This is my first time delving into the Webkit codebase and I&apos;m not a professional programmer so I don&apos;t really want to make the change myself, but I can try if nobody&apos;s up for it...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960929</commentid>
    <comment_count>2</comment_count>
    <who name="Elie Donadio">elidoset</who>
    <bug_when>2023-06-10 02:35:09 -0700</bug_when>
    <thetext>See also https://github.com/WebKit/WebKit/blob/ef93c1b412c09e10975907c8fd683269eb36a413/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp#L1409 for where the event is handled on the Gtk side and first dispatched to the page Proxy. Strangely enough the key modifiers are even queried a few lines up (l402), but never checked again further down the call stack.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960933</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2023-06-10 07:15:55 -0700</bug_when>
    <thetext>Nice investigation. This probably explains why all those &quot;hold Ctrl to scroll&quot; maps on various websites do not work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1961046</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2023-06-12 08:19:58 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/14863</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1961247</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-06-12 23:08:36 -0700</bug_when>
    <thetext>Committed 265104@main (c313668f2cf7): &lt;https://commits.webkit.org/265104@main&gt;

Reviewed commits have been landed. Closing PR #14863 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>466656</attachid>
            <date>2023-06-09 13:54:52 -0700</date>
            <delta_ts>2023-06-09 13:54:52 -0700</delta_ts>
            <desc>test case of the bug</desc>
            <filename>testbug.html</filename>
            <type>text/html</type>
            <size>686</size>
            <attacher name="Elie Donadio">elidoset</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KCjxoZWFkPgogICAgPG1ldGEgY2hhcnNl
dD0iVVRGLTgiPgogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmlj
ZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLjAiPgogICAgPHRpdGxlPlRlc3Qgd2hlZWw8L3RpdGxl
Pgo8L2hlYWQ+Cgo8Ym9keT4KICAgIDxkaXYgaWQ9InRlc3QiPjwvZGl2PgoKICAgIDxzY3JpcHQ+
CgoKICAgICAgICBjb25zb2xlLmxvZygibmlrIikKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVj
dG9yKCIjdGVzdCIpLmFkZEV2ZW50TGlzdGVuZXIoIndoZWVsIiwgKGUpID0+IHsKICAgICAgICAg
ICAgZS5wcmV2ZW50RGVmYXVsdCgpOwogICAgICAgICAgICBjb25zb2xlLmxvZyhlLnR5cGUpCiAg
ICAgICAgICAgIGlmIChlLmN0cmxLZXkpCiAgICAgICAgICAgICAgICBlLnRhcmdldC5jbGFzc0xp
c3QuYWRkKCJwYXNzZWQiKQogICAgICAgIH0pCgogICAgPC9zY3JpcHQ+CjwvYm9keT4KCjxzdHls
ZT4KICAgICN0ZXN0IHsKICAgICAgICB3aWR0aDogMTAwcHg7CiAgICAgICAgaGVpZ2h0OiAxMDBw
eDsKICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZWQ7CiAgICB9CgogICAgI3Rlc3QucGFzc2Vk
IHsKICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiBncmVlbjsKICAgIH0KPC9zdHlsZT4KCjwvaHRt
bD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>