<?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>198191</bug_id>
          
          <creation_ts>2019-05-23 12:11:03 -0700</creation_ts>
          <short_desc>[Pointer Events] Check that capturing data managed by the PointerCaptureController gets cleared upon navigation</short_desc>
          <delta_ts>2019-06-03 02:30:29 -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>UI Events</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=198129</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Antoine Quint">graouts</reporter>
          <assigned_to name="Antoine Quint">graouts</assigned_to>
          <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>dino</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1538740</commentid>
    <comment_count>0</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-05-23 12:11:03 -0700</bug_when>
    <thetext>We capture some pointer state in the PointerCaptureController, and on macOS where the pointer id is always the same, we should check that the state is correctly reset upon navigation in case the user is in the middle of an interaction. This came up in the post-commit discussion of https://bugs.webkit.org/show_bug.cgi?id=198129.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1538742</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-05-23 12:11:22 -0700</bug_when>
    <thetext>&lt;rdar://problem/51077486&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539365</commentid>
    <comment_count>2</comment_count>
      <attachid>370685</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-05-27 03:05:04 -0700</bug_when>
    <thetext>Created attachment 370685
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539435</commentid>
    <comment_count>3</comment_count>
      <attachid>370685</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-05-27 13:11:45 -0700</bug_when>
    <thetext>Comment on attachment 370685
Patch

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

&gt; Source/WebCore/page/Page.cpp:2864
&gt; +    m_pointerCaptureController-&gt;reset();

What about subframe navigation? I don&apos;t think that we want these to leak between documents in frames either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539534</commentid>
    <comment_count>4</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-05-28 05:23:52 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #3)
&gt; Comment on attachment 370685 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=370685&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/page/Page.cpp:2864
&gt; &gt; +    m_pointerCaptureController-&gt;reset();
&gt; 
&gt; What about subframe navigation? I don&apos;t think that we want these to leak
&gt; between documents in frames either.

I don&apos;t think there is anything to do in this case. The problem was that if you called preventDefault() while handling a &quot;pointerdown&quot; event in a page and navigated to the next page without releasing the mouse button, then compatibility mouse events would be prevented in the new page until you released the mouse button.

There is one PointerCaptureController per Page, so the main document and sub-frame documents use the same one. If preventDefault() is called while handling a &quot;pointerdown&quot; event in a sub-frame document, even if that document is navigated, or the whole iframe removed, it sounds fine to me that the state set by the sub-frame document remains valid for the main frame or any other sub-frame.

So I think this patch is correct and all that matters is clearing the state when the Page&apos;s main frame&apos;s document changes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539535</commentid>
    <comment_count>5</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-05-28 05:33:23 -0700</bug_when>
    <thetext>Committed r245809: &lt;https://trac.webkit.org/changeset/245809&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539601</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-05-28 09:12:44 -0700</bug_when>
    <thetext>&gt; There is one PointerCaptureController per Page, so the main document and
&gt; sub-frame documents use the same one. If preventDefault() is called while
&gt; handling a &quot;pointerdown&quot; event in a sub-frame document, even if that
&gt; document is navigated, or the whole iframe removed, it sounds fine to me
&gt; that the state set by the sub-frame document remains valid for the main
&gt; frame or any other sub-frame.

Generally, the reasons why no event state should be preserved over page loads even for subframes are user visible behavior and security. Quickly changing documents in either main frame or subframe results in events being delivered to a wrong document, resulting in unexpected actions getting triggered by them. This is a variation of clickjacking. I don&apos;t see anything critical in this particular case, but this is the kind of behavior that we tend to see as incorrect.

I other words, I guess that what I&apos;m saying is that it&apos;s not right to have a single PointerCaptureController per page, all event dispatch state should be per document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539606</commentid>
    <comment_count>7</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-05-28 09:21:26 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #6)
&gt;
&gt; I other words, I guess that what I&apos;m saying is that it&apos;s not right to have a
&gt; single PointerCaptureController per page, all event dispatch state should be
&gt; per document.

I thought about having a PointerCaptureController per Document, however I&apos;m not sure how it would work in practice. A pointer travels across the main frame&apos;s content and all of its subframes, and as it does that it produces events across all frames. The behavior of the pointer and the event it produces requires coordination across all frames, and as such it makes most sense to me to have a single one per Page.

Of course, we could have one per Document and introduce coordination between them, but it would definitely be a lot more work and the benefits are not obvious to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539826</commentid>
    <comment_count>8</comment_count>
      <attachid>370685</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2019-05-28 17:27:01 -0700</bug_when>
    <thetext>Comment on attachment 370685
Patch

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

&gt; Source/WebCore/page/PointerCaptureController.cpp:151
&gt; +    m_activePointerIdsToCapturingData.set(mousePointerID, capturingData);

Should use add instead of set; set includes unnecessary code to handle the case where the key already exists in the hash table. Impossible in a freshly cleared hash table.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1541202</commentid>
    <comment_count>9</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-06-03 02:29:51 -0700</bug_when>
    <thetext>Committed r246031: &lt;https://trac.webkit.org/changeset/246031&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1541203</commentid>
    <comment_count>10</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-06-03 02:30:29 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #8)
&gt; Comment on attachment 370685 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=370685&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/page/PointerCaptureController.cpp:151
&gt; &gt; +    m_activePointerIdsToCapturingData.set(mousePointerID, capturingData);
&gt; 
&gt; Should use add instead of set; set includes unnecessary code to handle the
&gt; case where the key already exists in the hash table. Impossible in a freshly
&gt; cleared hash table.

Thanks Darin, this was addressed in the additional commit r246031.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>370685</attachid>
            <date>2019-05-27 03:05:04 -0700</date>
            <delta_ts>2019-05-28 05:32:15 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-198191-20190527120502.patch</filename>
            <type>text/plain</type>
            <size>3945</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjQ1Nzc0CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNjAwNzg4MGNmNjQ5MzA2
OTZiZjVjODdhYTE1N2JiMTFiM2YzNjJjYS4uMTU1MmQzMzRiYzgwMGVhYTM1MWM2ZjlhNTUyODY2
ZjJhNDZkYjUzNiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDIyIEBACisyMDE5LTA1LTI3ICBBbnRv
aW5lIFF1aW50ICA8Z3Jhb3V0c0BhcHBsZS5jb20+CisKKyAgICAgICAgW1BvaW50ZXIgRXZlbnRz
XSBDaGVjayB0aGF0IGNhcHR1cmluZyBkYXRhIG1hbmFnZWQgYnkgdGhlIFBvaW50ZXJDYXB0dXJl
Q29udHJvbGxlciBnZXRzIGNsZWFyZWQgdXBvbiBuYXZpZ2F0aW9uCisgICAgICAgIGh0dHBzOi8v
YnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xOTgxOTEKKworICAgICAgICBSZXZpZXdl
ZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBXaGVuIHRoZSBkb2N1bWVudCBvZiB0aGUg
cGFnZSdzIG1haW4gZnJhbWUgY2hhbmdlcywgbWFrZSBzdXJlIHdlIGNsZWFyIGFsbCBvZiB0aGUg
ZGF0YSBhY2N1bXVsYXRlZCBmb3IgdGhlIHByZXZpb3VzIGRvY3VtZW50LgorICAgICAgICBJIGRv
bid0IHRoaW5rIHRoaXMgcGFydGljdWxhciBjaGFuZ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ICAgdm9pZCByZXNldCgpOwogCiAgICAg
dm9pZCBwb2ludGVyTG9ja1dhc0FwcGxpZWQoKTsKICAgICB2b2lkIGVsZW1lbnRXYXNSZW1vdmVk
KEVsZW1lbnQmKTsK
</data>
<flag name="review"
          id="386622"
          type_id="1"
          status="+"
          setter="dino"
    />
          </attachment>
      

    </bug>

</bugzilla>