Bug 225871 - Transition started from requestAnimationFrame differs from other browsers
Summary: Transition started from requestAnimationFrame differs from other browsers
Status: NEW
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: 2021-05-17 08:09 PDT by Simon Fraser (smfr)
Modified: 2021-05-24 08:10 PDT (History)
9 users (show)

See Also:


Attachments
Test (1.27 KB, text/html)
2021-05-18 00:40 PDT, Antoine Quint
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-05-17 08:09:55 PDT
https://safari-raf-bug.glitch.me shows an issue where WebKit behavior differs from Chrome and Firefox. The testcase is:

document.querySelector('button').addEventListener('click', () => {
  const test = document.querySelector('.test');
  test.style.transform = 'translate(400px, 0)';
  
  requestAnimationFrame(() => {
    test.style.transition = 'transform 3s linear';
    test.style.transform = 'translate(200px, 0)';
  });
});

Safari transitions from 400px to 200px. Other browsers transition from 0 to 200px;
Comment 1 Antoine Quint 2021-05-18 00:40:05 PDT
Created attachment 428917 [details]
Test

I rewrote the test to make it so the transition can be re-started and not using transform to remove accelerated animations from the equation. This may be a style resolution issue where we see the style as the value set on the inline style before the animation frame is triggered, where other browsers don't. Indeed, forcing a style recalc by calling getComputedStyle() after the animation frame shows the same behavior across browsers.
Comment 2 Simon Fraser (smfr) 2021-05-18 09:17:44 PDT
Does it reproduce with a software animation (e.g. on 'left')?
Comment 3 Antoine Quint 2021-05-18 12:59:42 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Does it reproduce with a software animation (e.g. on 'left')?

Yes, the test I've attached uses margin-left.

This has been broken for a long time, I tried with r236648, the oldest I could find for my system, and it was already broken this way.
Comment 4 Radar WebKit Bug Importer 2021-05-24 08:10:20 PDT
<rdar://problem/78400632>