Bug 185837

Summary: Animated GIFs with a 90 degree X or Y rotation do not animate
Product: WebKit Reporter: Jonathan Deutsch <jonathan>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, sabouhallawa, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: All   
OS: macOS 10.13   
Attachments:
Description Flags
Repro html and gif file none

Description Jonathan Deutsch 2018-05-21 13:46:18 PDT
Created attachment 340881 [details]
Repro html and gif file

If an animated GIF (either via background-image or img tag) is set to have a 90 degree rotation on the X or Y axis (3d) then it will not animate.

If there is no perspective this may make sense as a performance optimization, but it occurs even if perspective is set and the image is being shown.

Attachment has a simple repro case.

Resizing the window causes a single frame re-render.
Comment 1 Jonathan Deutsch 2018-05-21 13:49:45 PDT
This occurs on Safari 11.
This does not affect Chrome, nor Safari v6.
Comment 2 Radar WebKit Bug Importer 2018-05-23 11:10:51 PDT
<rdar://problem/40491727>
Comment 3 Said Abou-Hallawa 2018-05-23 11:15:39 PDT
This happens because when the <img> element is drawn with perspective css, it is drawn to a layer by getting the current frame and setting its to the layer through GraphicsLayerCA::setContentsToImage().

Getting the current frame by calling BitmapImage::frameImageAtIndexCacheIfNeeded() forces sync image decoding and does start the animation timer for the next frame.
Comment 4 Simon Fraser (smfr) 2018-05-23 11:45:02 PDT
So the "set layer contents to image" code path does the wrong thing with rotated frames? We should turn off the optimization in that case.