<?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>211839</bug_id>
          
          <creation_ts>2020-05-13 06:34:20 -0700</creation_ts>
          <short_desc>[Web Animations] Use CA animations when playbackRate != 1 and direction != normal</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>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=204717</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="Nobody">webkit-unassigned</assigned_to>
          <cc>dino</cc>
    
    <cc>graouts</cc>
    
    <cc>mattgperry</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1652200</commentid>
    <comment_count>0</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-05-13 06:34:20 -0700</bug_when>
    <thetext>When fixing bug 204717 we made it so that we wouldn&apos;t attempt to run a CA animation if the animation&apos;s playback rate is different than 1. This bug is about trying to lift this restriction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1652201</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-05-13 06:34:36 -0700</bug_when>
    <thetext>&lt;rdar://problem/63182225&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1654586</commentid>
    <comment_count>2</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-05-20 12:47:00 -0700</bug_when>
    <thetext>Looks like we can make this work with this approach:

    1. create a CAAnimation
        1. set `animation.duration` to `webAnimation.duration`
        2. set `animation.beginTime` to `-webAnimation.currentTime`
    2. create a CAAnimationGroup
        1. set `group.speed` to `webAnimation.playbackRate`
        2. set `group.duration` to `webAnimation.effect.duration - webAnimation.currentTime`
        3. set `group.animations` to `[animation]`</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1655829</commentid>
    <comment_count>3</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2020-05-25 05:04:25 -0700</bug_when>
    <thetext>Actually, I think the solution is to set the CAAnimation timeOffset to match the Web Animation&apos;s currentTime and set speed to match playbackRate, but set the computed duration on a parent CAANimationGroup to clip.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1787570</commentid>
    <comment_count>4</comment_count>
    <who name="Matt Perry">mattgperry</who>
    <bug_when>2021-08-26 06:40:21 -0700</bug_when>
    <thetext>In creating a library built upon WAAPI the only bugs I&apos;ve encountered are in Webkit, and the majority of those have involved accelerated animations.

These aren&apos;t bugs I can reasonably ship to users, and setting playbackRate to 1.000001 to force animations onto the main thread in Webkit has fixed them all.

If this ticket gets resolved can you also offer a way to flag to Webkit that an animation shouldn&apos;t run on the main thread? Because looking through many of the tickets here, and indeed the linked bug in this one, a quick fix has often been to add conditions when an animation shouldn&apos;t run on Core Animation. It would be great if you could extend to developers this same opportunity, as I&apos;m concerned that my hacky solution will re-expose users to timing bugs if they&apos;re not fixed before this ticket is resolved.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1787571</commentid>
    <comment_count>5</comment_count>
    <who name="Matt Perry">mattgperry</who>
    <bug_when>2021-08-26 06:42:41 -0700</bug_when>
    <thetext>(In reply to Matt Perry from comment #4)

&gt; If this ticket gets resolved can you also offer a way to flag to Webkit that
&gt; an animation shouldn&apos;t run on the main thread? 


Apologises, that should read &quot;should run on the main thread&quot;. Specifically something like

element.animate(keyframes, { _webkitRunOnMainThread: true })

would be appreciated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1791455</commentid>
    <comment_count>6</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2021-09-08 07:26:31 -0700</bug_when>
    <thetext>Matt, while I understand where you&apos;re coming from, I don&apos;t think offering a way to explicitly disable accelerated animations is the right approach. Rather, we need to fix bugs related to accelerated animations, so thanks for filing the bugs you have filed for now and to keep filing them as you find them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1791472</commentid>
    <comment_count>7</comment_count>
    <who name="Matt Perry">mattgperry</who>
    <bug_when>2021-09-08 08:37:06 -0700</bug_when>
    <thetext>I agree it’s not an ideal approach. In lieu of that would it be possible to consider the main-thread/accelerated synchronisation bugs in https://bugs.webkit.org/show_bug.cgi?id=229399 as a higher priority than this ticket? As it’s the only remaining blocker as of iOS 15</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1791841</commentid>
    <comment_count>8</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2021-09-09 04:05:47 -0700</bug_when>
    <thetext>Agreed, bug 229399 is something I will look into soon.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>