Bug 226321 - Animation FPS drops if SVG changes from becomes visible from opacity 0
Summary: Animation FPS drops if SVG changes from becomes visible from opacity 0
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: Safari 14
Hardware: iPhone / iPad iOS 14
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-27 03:08 PDT by Roland Soos
Modified: 2021-05-28 13:05 PDT (History)
6 users (show)

See Also:


Attachments
Screen recording (2.70 MB, video/mp4)
2021-05-27 03:08 PDT, Roland Soos
no flags Details
Long paints in timeline (154.65 KB, image/png)
2021-05-28 13:05 PDT, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Soos 2021-05-27 03:08:38 PDT
Created attachment 429862 [details]
Screen recording

Steps to reproduce:
1. Open https://smartslider3.com/bugs/webkit/opacity0dropfps/

Expected result: FPS should be consistent during the animation

Actual result: When the SVG becomes visible from opacity(opacity:0 and then in the next frame gets bigger than 0) cause the animation to feel sluggish as probably rendering of the resource allocate the main thread.


Workaround: use non-zero small opacity like 0.1 for starting point.

Able to reproduce:
iPad 14.5.1
iPhone 14.6
Comment 1 Roland Soos 2021-05-27 03:11:36 PDT
It's possible that not opacity:0 itself cause this issue as we add visiblity:hidden to the elements which has opacity:0. So the cause could be that visibility:hidden changes to visibility:visible.

[data-force-hidden], [data-force-hidden] * {
    visibility: hidden!important;
}
Comment 2 Alexey Proskuryakov 2021-05-27 18:15:09 PDT
I can reproduce on iPhone 12 Pro; animates smoothly on a Mac.
Comment 3 Simon Fraser (smfr) 2021-05-27 20:22:11 PDT
The SVG takes over 500ms to render on iPhone 7 Plus because of the filters (largely the gaussian blur). There's a layering change when opacity and/or transform transitions finish, which triggers a second paint of the SVG which is the visible stall.

Some `will-change:` should fix this. Or you could remove the filters, since (in this example at least) they don't do anything visible.
Comment 4 Radar WebKit Bug Importer 2021-05-27 20:29:09 PDT
<rdar://problem/78601603>
Comment 5 Roland Soos 2021-05-27 23:04:16 PDT
Thank you Simon, you are right. We dropped those filters and used filter="drop-shadow(...)" on the path and everything is the same.

What is the tool what you used to find that it takes 500ms to render that SVG? Is it a tool in Safari(Mac) what I could use during remote debug of the real device?
Comment 6 Simon Fraser (smfr) 2021-05-28 09:45:35 PDT
I used some internal instrumentation, but I think attaching with Web Inspector and collecting a timeline recording would show you some long paints.
Comment 7 Simon Fraser (smfr) 2021-05-28 13:05:24 PDT
Created attachment 430045 [details]
Long paints in timeline