<?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>213344</bug_id>
          
          <creation_ts>2020-06-18 10:14:44 -0700</creation_ts>
          <short_desc>Cross domain &lt;iframe&gt; animation throttling doesn&apos;t respond to touch events correctly</short_desc>
          <delta_ts>2026-01-12 09:03:30 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Animations</component>
          <version>Safari 13</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=170534</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="Dustin Kerstein">dustin.kerstein</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>dino</cc>
    
    <cc>graouts</cc>
    
    <cc>jason</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1663910</commentid>
    <comment_count>0</comment_count>
    <who name="Dustin Kerstein">dustin.kerstein</who>
    <bug_when>2020-06-18 10:14:44 -0700</bug_when>
    <thetext>In this changeset - https://trac.webkit.org/changeset/215070/webkit - A throttling mechanism was introduced to prevent iFrame Ads from unnecessarily consuming battery when the user wasn&apos;t interacting with them. It defaults a cross-domain iFrame&apos;s requestAnimationFrame frequency to 30fps, until the user &quot;interacts&quot; with the iFrame. This appears to be working correctly with mouse events. However, touch events aren&apos;t working the same way. Ie. If you quickly tap on the iFrame, it will start rendering at 60fps. However, if you swipe/drag/pan (as in for a 360 photo for example) it won&apos;t mark this as &quot;interacted&quot; and stays at 30fps. Here is an easy example to replicate with.

Parent Frame
------------
&lt;html&gt;
  &lt;head&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
    &lt;style&gt;
      body {
          margin: 0;
          padding: 0;
          background-color: #000000; 
          overflow: hidden:;
      } 
      #text {
        width: 100%;
        height: 100%;
        position: fixed;
        font-size: 5vw;
        color: white;
        text-align: center;
        top: 50%;
      }
      #countText {
        position: fixed;
        bottom: 1em;
        right: 1em;
        color: white;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id=&quot;text&quot;&gt;
      Swiping doesn&apos;t trigger &quot;interaction&quot;. Only an actual touch &quot;tap&quot;.
    &lt;/div&gt;
    &lt;div id=&quot;countText&quot;&gt;
    &lt;/div&gt;
    &lt;script&gt;  
      var count = 0;
      window.requestAnimationFrame(animate);

      function animate() {
        window.requestAnimationFrame(animate);
        count++;
        document.getElementById(&quot;countText&quot;).innerHTML = count;
      }

      (function(){var script=document.createElement(&apos;script&apos;);script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src=&apos;//mrdoob.github.io/stats.js/build/stats.min.js&apos;;document.head.appendChild(script);})()
    &lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;




Child Frame
-----------
&lt;html&gt;
  &lt;head&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
    &lt;style&gt;
      body {
          margin: 0;
          padding: 0;
          background-color: #000000;
          overflow: hidden; 
      } 
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;iframe id=&quot;iframe&quot; width=&quot;480px&quot; height=&quot;480px&quot; src=&quot;http://IPADDRESS:PORT/webkitchild.html&quot;&gt;&lt;/iframe&gt;
    &lt;!-- &lt;iframe id=&quot;iframe&quot; width=&quot;480px&quot; height=&quot;480px&quot; src=&quot;http://LOCALHOST:PORT/webkitchild.html&quot;&gt;&lt;/iframe&gt; --&gt;
&lt;/html&gt;

In order to replicate, you need to ensure that the URL of the Parent frame is not the same as the Child frame (ie. it has to be Cross Domain). Using the local server&apos;s IP address and Localhost should allow you to replicate on a single device without having to deal with DNS.

Maybe this is as designed, but I felt that those types of touch events (swiping, dragging, zooming, etc.) should be considered a valid interaction to bypass the throttling code. Does that sound reasonable?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1663911</commentid>
    <comment_count>1</comment_count>
    <who name="Dustin Kerstein">dustin.kerstein</who>
    <bug_when>2020-06-18 10:15:52 -0700</bug_when>
    <thetext>Apologies. The &quot;Parent Frame&quot; and &quot;Child Frame&quot; are labelled backwards in my previous post.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1664646</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-06-19 17:29:43 -0700</bug_when>
    <thetext>&lt;rdar://problem/64550446&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676799</commentid>
    <comment_count>3</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-07-31 06:28:16 -0700</bug_when>
    <thetext>Actually, just loading the files locally shows a cap of 30fps for the frame in the iOS Simulator.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676800</commentid>
    <comment_count>4</comment_count>
      <attachid>405684</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-07-31 06:30:42 -0700</bug_when>
    <thetext>Created attachment 405684
Test

Attached the sample from the bug description as a ZIP archive, opening the 213344-parent.html shows the issue where the stats are capped at 30fps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676801</commentid>
    <comment_count>5</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-07-31 06:31:32 -0700</bug_when>
    <thetext>Cc&apos;ing Simon, who wrote the patch in question (r215070).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1676862</commentid>
    <comment_count>6</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-07-31 10:20:33 -0700</bug_when>
    <thetext>If I add a &quot;pointerup&quot; event listener in the child document, the 30fps throttle is released if I tap in the document. However, if I do a different kind of gesture which does not yield a simulated &quot;click&quot;, the 30fps remains in place.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>405684</attachid>
            <date>2020-07-31 06:30:42 -0700</date>
            <delta_ts>2020-07-31 06:30:42 -0700</delta_ts>
            <desc>Test</desc>
            <filename>213344.zip</filename>
            <type>application/zip</type>
            <size>2005</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">UEsDBBQACAAIALh7/1AAAAAAAAAAAOUBAAASACAAMjEzMzQ0LXBhcmVudC5odG1sVVQNAAfNHCRf
0hwkX84cJF91eAsAAQT1AQAABBQAAABdUU1vwjAMvfMrvOy6QBkcJmg57J+E2G2spUmVpBQ07b8v
oR1C8yF6z/aLv2qTentaAdSGFBaQYU9JgVM9NeLCNA0+JAHau0QuNWJiTKZBurAmeSdvwI4TKyuj
VpaarVg+iulmacYAZ483+F5IsV6Fjt0BquOTc1CI7Lp/3rPSX13wo0OpvfXhAK/V3Z6T/IVCa/10
AMOI5I6wBH9mUG8e/dSbv3Hr0tbS7ouU8Dl2EKiMDFHdIiSjUn44QjR+tJj30BO0wfegALltKeSt
APpesYPzmGDiZLKCsj5nLoHCd1U7RNBqKAWCx1FTXIOUS3VuQxEwNmKGAuZVi/1HNVwFGOLOpAeN
QTfifbvb7fdSG7a4LrcUp3ozy0+rPOX9ur9QSwcIdBjcfSABAADlAQAAUEsDBBQACAAIALh7/1AA
AAAAAAAA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