`setTimeout` and `requestAnimationFrame` are used somewhat interchangeably on the web. There should be similar features/"affordances" for both so that if a developer decides to use a display-linked animation "loop" instead of a strictly time-based one they're able to do similar things in the callback/handler.
<rdar://problem/75860868>
Created attachment 424298 [details] Patch
Created attachment 424311 [details] Patch
Comment on attachment 424311 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424311&action=review r=me > Source/WebCore/ChangeLog:10 > + There should be similar features/"affordances" for both so that if a developer decides No need to scare-quote affordances -- this is an affordance. > Source/WebCore/dom/ScriptedAnimationController.cpp:170 > + if (userGestureTokenToForward && userGestureTokenToForward->hasExpired(UserGestureToken::maximumIntervalForUserGestureForwarding)) > + userGestureTokenToForward = nullptr; > + UserGestureIndicator gestureIndicator(userGestureTokenToForward); Not new in this patch, but it would be nice (perhaps in a follow-up patch) if the UserGestureIndicator constructor checked the token for expiration, and automatically set the null user gesture state in that case. That could eliminate some boilerplate code and, more importantly, make it impossible to construct an invalid user gesture state.
Comment on attachment 424311 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424311&action=review >> Source/WebCore/ChangeLog:10 >> + There should be similar features/"affordances" for both so that if a developer decides > > No need to scare-quote affordances -- this is an affordance. heh very true :P will remove :) >> Source/WebCore/dom/ScriptedAnimationController.cpp:170 >> + UserGestureIndicator gestureIndicator(userGestureTokenToForward); > > Not new in this patch, but it would be nice (perhaps in a follow-up patch) if the UserGestureIndicator constructor checked the token for expiration, and automatically set the null user gesture state in that case. That could eliminate some boilerplate code and, more importantly, make it impossible to construct an invalid user gesture state. ooo good idea! I'll create a followup :)
Created attachment 424588 [details] Patch
ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.
Created attachment 424591 [details] Patch oops forgot about the LayoutTests changelog 😅
Committed r275187: <https://commits.webkit.org/r275187> All reviewed patches have been landed. Closing bug and clearing flags on attachment 424591 [details].
*** Bug 227671 has been marked as a duplicate of this bug. ***