Bug 152817 - Directly-composited animated GIFs never resume once scrolled offscreen
Summary: Directly-composited animated GIFs never resume once scrolled offscreen
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-01-06 17:01 PST by Chris Dumez
Modified: 2016-01-07 11:41 PST (History)
8 users (show)

See Also:


Attachments
Patch (9.92 KB, patch)
2016-01-07 10:03 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (9.91 KB, patch)
2016-01-07 10:52 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-01-06 17:01:08 PST
Animated GIFs inside compositing layers never resume once scrolled offscreen.

Repro case:
1. Go to https://jsfiddle.net/a0xudfLw/5/
2. See how the image is animated in the lower left frame
3. Scroll that image out of the viewport
4. Scroll the image back inside the viewport
-> The image animation is not properly resumed :(
Comment 1 Chris Dumez 2016-01-06 17:01:30 PST
rdar://problem/19982020
Comment 2 Chris Dumez 2016-01-07 10:03:17 PST
Created attachment 268461 [details]
Patch
Comment 3 Daniel Bates 2016-01-07 10:37:26 PST
Comment on attachment 268461 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268461&action=review

> Source/WebCore/ChangeLog:14
> +        RenderBoxModelObject::contentChanched(ImageChanged) in addition to

contentChanched => contentChanged

> Source/WebCore/ChangeLog:26
> +        Call RenderBoxModelObject::contentChanched(ImageChanged) in addition to

Ditto

> Source/WebCore/ChangeLog:38
> +        to cover this bug as our rendering code believed it has unpaused the

Nit: "has unpaused" => "had resumed"

> Source/WebCore/rendering/RenderElement.cpp:1519
> +    // Calling repaint() does not suffice to restart the animation in the case of
> +    // directly-composited animated GIFs so we need to do this.

Maybe a better way to write this is:

Mark the image as changed to resume directly-composited animated GIFs.

OR

For directly-composited animated GIFs it does not suffice to call repaint() to resume animation. We need to mark the image as changed.

> LayoutTests/fast/images/composited-animated-gif-outside-viewport.html:7
> +<img id="testImage" src="resources/animated.gif" style="-webkit-transform: translatez(0);" />

Please remove the trailing slash character as the img tag does not have a closing tag among other reasons.

> LayoutTests/fast/images/composited-animated-gif-outside-viewport.html:36
> +function scrollDown() {

Nit: The position of the opening curly brace for this function differs from the position of the opening curly brace used in other functions in this file (e.g. scrollUp). I suggest we place the opening brace on its own line. Regardless, we should pick one style and stick with it throughout this file.

> LayoutTests/fast/images/composited-animated-gif-outside-viewport.html:42
> +function runTest() {

Ditto.
Comment 4 Daniel Bates 2016-01-07 10:40:13 PST
Comment on attachment 268461 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268461&action=review

> Source/WebCore/ChangeLog:10
> +        Directly-composited animated GIFs would never resume once scrolled
> +        offscreen. This is because calling repaint() in this case would not

Would this also affect SVG images? If so, we should add a test for this.
Comment 5 Daniel Bates 2016-01-07 10:44:59 PST
(In reply to comment #4)
> Comment on attachment 268461 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=268461&action=review
> 
> > Source/WebCore/ChangeLog:10
> > +        Directly-composited animated GIFs would never resume once scrolled
> > +        offscreen. This is because calling repaint() in this case would not
> 
> Would this also affect SVG images? If so, we should add a test for this.

Tim Horton mentioned on IRC today that that this does not affect SVG images as they are not directly composited.
Comment 6 Chris Dumez 2016-01-07 10:52:08 PST
Created attachment 268468 [details]
Patch
Comment 7 WebKit Commit Bot 2016-01-07 11:41:03 PST
Comment on attachment 268468 [details]
Patch

Clearing flags on attachment: 268468

Committed r194706: <http://trac.webkit.org/changeset/194706>
Comment 8 WebKit Commit Bot 2016-01-07 11:41:07 PST
All reviewed patches have been landed.  Closing bug.