Bug 208032 - Animations sometimes don't start before the next requestAnimationFrame
Summary: Animations sometimes don't start before the next requestAnimationFrame
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-20 14:43 PST by Simon Fraser (smfr)
Modified: 2020-02-20 16:32 PST (History)
4 users (show)

See Also:


Attachments
Testcase (2.73 KB, text/html)
2020-02-20 14:43 PST, Simon Fraser (smfr)
no flags Details
This isn't reliable in WTR either (3.01 KB, text/html)
2020-02-20 15:10 PST, Simon Fraser (smfr)
no flags Details
Another flakey version (3.01 KB, text/html)
2020-02-20 16:02 PST, Simon Fraser (smfr)
no flags Details
And another (3.02 KB, text/html)
2020-02-20 16:04 PST, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2020-02-20 14:43:41 PST
Created attachment 391337 [details]
Testcase

Attached testcase shows that we don't always trigger animations before the next requestAnimationFrame. Chrome and Firefox do.

Need two drop the testcase into LayoutTests/animations.
Comment 1 Simon Fraser (smfr) 2020-02-20 14:44:55 PST
One extra setTimeout(, 0) fixes this.
Comment 2 Simon Fraser (smfr) 2020-02-20 14:46:23 PST
(In reply to Simon Fraser (smfr) from comment #1)
> One extra setTimeout(, 0) fixes this.

Actually no. Even a rAF is super flakey.
Comment 3 Simon Fraser (smfr) 2020-02-20 15:08:41 PST
In general, it seems that we don't reliably start animations (and fire events) before the next rAF. This makes it really hard to write compatible animation code.
Comment 4 Radar WebKit Bug Importer 2020-02-20 15:09:03 PST
<rdar://problem/59646027>
Comment 5 Simon Fraser (smfr) 2020-02-20 15:10:13 PST
Created attachment 391340 [details]
This isn't reliable in WTR either
Comment 6 Simon Fraser (smfr) 2020-02-20 16:00:10 PST
I found that forcing layout after the document.body.classList.remove('changed'); makes things better; we seem to batch the document.body.classList.remove('changed')/document.body.classList.add('changed') and think nothing changed.
Comment 7 Simon Fraser (smfr) 2020-02-20 16:02:29 PST
Created attachment 391351 [details]
Another flakey version
Comment 8 Simon Fraser (smfr) 2020-02-20 16:04:47 PST
Created attachment 391352 [details]
And another
Comment 9 Simon Fraser (smfr) 2020-02-20 16:32:41 PST
Hmm, I was testing with "CSS animations via web animations" turned off. Turn then on and things are better.