Bug 139528 - Image animation is not always stopped if used as background-image of a div that is outside viewport
Summary: Image animation is not always stopped if used as background-image of a div th...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 139435
Blocks:
  Show dependency treegraph
 
Reported: 2014-12-10 21:28 PST by Chris Dumez
Modified: 2015-01-06 14:35 PST (History)
7 users (show)

See Also:


Attachments
Patch (5.98 KB, patch)
2014-12-10 21:36 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (5.98 KB, patch)
2014-12-10 22:01 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (6.02 KB, patch)
2014-12-10 22:06 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 2014-12-10 21:28:57 PST
Image animation is not always stopped if used as background-image of a div that is outside viewport. In particular, the animation is not stopped if the div has content overflowing *inside* the viewport (even though the animated gif is not visible, only the overflowing content is). This is because shouldRepaintForImageAnimation() relies on the renderer's overflow rect instead of its bounding box to determine if it is inside viewport.
Comment 1 Chris Dumez 2014-12-10 21:36:59 PST
Created attachment 243098 [details]
Patch
Comment 2 Chris Dumez 2014-12-10 22:01:31 PST
Created attachment 243103 [details]
Patch
Comment 3 Chris Dumez 2014-12-10 22:06:53 PST
Created attachment 243104 [details]
Patch
Comment 4 Chris Dumez 2014-12-10 23:46:25 PST
I regressed this in http://trac.webkit.org/changeset/176212 when refactoring the code to detect if we're inside viewport to be shared between animated images and DOM Timer throttling.
Comment 5 Simon Fraser (smfr) 2014-12-11 10:20:53 PST
Comment on attachment 243104 [details]
Patch

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

> Source/WebCore/rendering/RenderElement.cpp:1371
> +    LayoutRect backgroundPaintingRect = backgroundIsPaintedByRoot ? renderer.view().backgroundRect(&renderer.view()) : renderer.absoluteBoundingBoxRect();

But doesn't this regress the reflection case, and possibly others?
Comment 6 Chris Dumez 2014-12-11 10:23:39 PST
Comment on attachment 243104 [details]
Patch

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

>> Source/WebCore/rendering/RenderElement.cpp:1371
>> +    LayoutRect backgroundPaintingRect = backgroundIsPaintedByRoot ? renderer.view().backgroundRect(&renderer.view()) : renderer.absoluteBoundingBoxRect();
> 
> But doesn't this regress the reflection case, and possibly others?

Hmm, I will have to check. It is indeed possible. If so, it is better to be conservative and use the overflow rect.