Bug 212637 - getClientBoundingRect values sometimes wrong at end of CSS transition
Summary: getClientBoundingRect values sometimes wrong at end of CSS transition
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: Safari 13
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-02 08:33 PDT by ian
Modified: 2023-05-10 12:09 PDT (History)
6 users (show)

See Also:


Attachments
Repro (1.80 KB, text/html)
2020-06-02 08:33 PDT, ian
no flags Details
Image of issue. (325.76 KB, image/png)
2020-06-02 08:33 PDT, ian
no flags Details
Test using "left" and "top" properties (2.10 KB, text/html)
2020-07-31 07:09 PDT, Antoine Quint
no flags Details
Test using "transform" property (2.00 KB, text/html)
2020-07-31 07:09 PDT, Antoine Quint
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ian 2020-06-02 08:33:05 PDT
Created attachment 400824 [details]
Repro

On the last frame of a css transition of transform, the values of getClientBoundingBox are _sometimes_ the same as the values that would be returned at the beginning of the transition. Once the transition-end event is fired, the values will snap back to the final values. The behavior is intermittent but not difficult to produce (every five or so transitions). When using getClientBoundingBox to pin an element to another transforming one, this leads to visual pops/glitches in Safari. 

The attached example reproduces in Safari 13.1 and STP 107, macOS 10.15.4, 2017 mbp. 

I can not reproduce the issue in Chrome 83.0.4103.61 or FF 76.0.1

For what it's worth, I've also noticed the same behavior in window.getComputedStyles(el).transform, where at the end the transition, the value is the starting value, but then snaps to the correct ending value.


While using getClientBoundingBox in an animation is not ideal, it (and getComputedStyles) is the only way I know of to get a correct coordinate in a separate element that's transitioning its transform.
Comment 1 ian 2020-06-02 08:33:54 PDT
Created attachment 400826 [details]
Image of issue.
Comment 2 ian 2020-06-02 08:45:57 PDT
Correction! : In my original post I meant "getBoundingClientRect" not "getClientBoundingBox"
Comment 3 Radar WebKit Bug Importer 2020-06-02 18:35:14 PDT
<rdar://problem/63902997>
Comment 4 Antoine Quint 2020-07-31 07:08:45 PDT
Just like bug 212640, this does not happen when transitioning "left" and "top" but does happen when transitioning "transform". These two issues are likely duplicates.
Comment 5 Antoine Quint 2020-07-31 07:09:27 PDT
Created attachment 405689 [details]
Test using "left" and "top" properties
Comment 6 Antoine Quint 2020-07-31 07:09:40 PDT
Created attachment 405690 [details]
Test using "transform" property
Comment 7 Antoine Quint 2023-05-10 12:09:37 PDT
I believe this no longer reproduces with shipping Safari. Ian, if you feel I'm mistaken, please reopen the bug, but the logged values all seem to animate linearly now.