<?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>297596</bug_id>
          
          <creation_ts>2025-08-19 08:34:57 -0700</creation_ts>
          <short_desc>“Infinite” CSS animation durations render page unresponsive</short_desc>
          <delta_ts>2025-08-20 13:43:55 -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>Animations</component>
          <version>Safari 18</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/54429</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="Eric Meyer">eric</reporter>
          <assigned_to name="Antoine Quint">graouts</assigned_to>
          <cc>graouts</cc>
    
    <cc>graouts</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2137422</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Meyer">eric</who>
    <bug_when>2025-08-19 08:34:57 -0700</bug_when>
    <thetext>Given the following CSS applied to a single &lt;div&gt;:

div {
	animation-name: spin;
	animation-duration: calc(infinity * 1s);
}
@keyframes spin {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(100px);
	}
}


…the page is rendered, but becomes effectively unresponsive.

• The browser window can be dragged around the screen, and closed with either mouse or keyboard commands, without apparent lag.
• The page can be scrolled without apparent lag if the content is tall enough to trigger a scrollbar, but the layout is frozen at its initial paint state.
• Resizing the browser window will leave the vertical scrollbar in its initial spot, even if the window is made wider or narrower.
• If not already open at page load, the only way to open the Web Inspector is via the Develop menu.  Once it is open, the Elements tab will either be incomplete or completely empty.
• Contextual menus do not appear, and interactions (including drag-selection of page text) are ignored; indeed, the mouse cursor does not change from a pointer to an I-bar when hovering over text content.
• Some attempts to interact with the browser viewport trigger a brief SBBoD, but more often have no visible effect.

Firefox and Chrome will both render the above while remaining fully responsive.  They do not, of course, show any visible animation, given that the time to complete it would be somewhere around ten times longer than the time at which almost all matter in the universe will have been swallowed by supermassive black holes, or else half again as long as the highest estimate of the time it will take for all nucleons in the observable universe to decay.  (Source: Wikipedia’s “Timeline of the far future” page.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137720</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-08-20 08:58:58 -0700</bug_when>
    <thetext>&lt;rdar://problem/158775366&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137721</commentid>
    <comment_count>2</comment_count>
      <attachid>476465</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-08-20 09:05:57 -0700</bug_when>
    <thetext>Created attachment 476465
Testcase

Attached a test case which shows that using a non-accelerated animation also shows the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137723</commentid>
    <comment_count>3</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-08-20 09:16:02 -0700</bug_when>
    <thetext>The Web process is pegged at 100% CPU usage, we appear to be hung in `UnitBezier::sampleCurveX()`. This all stems from the `epsilon` value computed in `TimingFunction::transformProgress()`:

        auto epsilon = 1.0 / (1000.0 * duration);

We should introduce a cap here to not deal with infinitely small values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137726</commentid>
    <comment_count>4</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-08-20 09:19:04 -0700</bug_when>
    <thetext>This can be worked around by using `animation-timing-function: linear`. This shows that the animation-duration computes to 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368s.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137734</commentid>
    <comment_count>5</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-08-20 09:50:35 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/49660</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137738</commentid>
    <comment_count>6</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2025-08-20 09:54:41 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/54429</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2137798</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-08-20 13:43:53 -0700</bug_when>
    <thetext>Committed 298975@main (179a9082a09b): &lt;https://commits.webkit.org/298975@main&gt;

Reviewed commits have been landed. Closing PR #49660 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>476465</attachid>
            <date>2025-08-20 09:05:57 -0700</date>
            <delta_ts>2025-08-20 09:05:57 -0700</delta_ts>
            <desc>Testcase</desc>
            <filename>bug-297596.html</filename>
            <type>text/html</type>
            <size>415</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">PHN0eWxlPgoKICAgIGRpdiB7CiAgICAgICAgd2lkdGg6IDEwMHB4OwogICAgICAgIGhlaWdodDog
MTAwcHg7CiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogYmxhY2s7CgogICAgCWFuaW1hdGlvbi1u
YW1lOiBzbGlkZTsKICAgIAlhbmltYXRpb24tZHVyYXRpb246IGNhbGMoaW5maW5pdHkgKiAxcyk7
CiAgICB9CgogICAgQGtleWZyYW1lcyBzbGlkZSB7CiAgICAJZnJvbSB7IG1hcmdpbi1sZWZ0OiAw
IH0KICAgIAl0byB7IG1hcmdpbi1sZWZ0OiAxMDBweCB9CiAgICB9CgogICAgQGtleWZyYW1lcyBz
bGlkZS1hY2NlbGVyYXRlZCB7CiAgICAJZnJvbSB7IHRyYW5zZm9ybTogdHJhbnNsYXRlWCgwKSB9
CiAgICAJdG8geyB0cmFuc2Zvcm06IHRyYW5zbGF0ZVgoMTAwcHgpIH0KICAgIH0KICAgIAo8L3N0
eWxlPgo8ZGl2PjwvZGl2Pg==
</data>

          </attachment>
      

    </bug>

</bugzilla>