Bug 128632 - GIF animations should be suspended when outside of viewport
Summary: GIF animations should be suspended when outside of viewport
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 112327 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-11 16:13 PST by Antti Koivisto
Modified: 2017-08-24 15:54 PDT (History)
7 users (show)

See Also:


Attachments
patch (21.50 KB, patch)
2014-02-11 17:36 PST, Antti Koivisto
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2014-02-11 16:13:33 PST
Animations are driven by the paint cycle. Speculative tiles keep animations outside the actual viewport going.
Comment 1 Antti Koivisto 2014-02-11 16:13:52 PST
<rdar://problem/15895090>
Comment 2 Antti Koivisto 2014-02-11 17:36:41 PST
Created attachment 223923 [details]
patch
Comment 3 WebKit Commit Bot 2014-02-11 17:38:55 PST
Attachment 223923 [details] did not pass style-queue:


ERROR: Source/WebCore/rendering/RenderView.cpp:1181:  Extra space after ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Andreas Kling 2014-02-11 17:47:39 PST
Comment on attachment 223923 [details]
patch

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

r=me

> Source/WebCore/page/Page.cpp:1149
> +        if (frame->contentRenderer())
> +            frame->contentRenderer()->resumePausedImageAnimationsIfNeeded();

I'd put the renderer in a local.

> Source/WebCore/rendering/RenderElement.cpp:1287
> +    if (document.view()->isOffscreen())
> +        return false;

renderer.frameView().isOffscreen()

> Source/WebCore/rendering/RenderElement.cpp:1290
> +    if (document.frame()->timersPaused())
> +        return false;

renderer.frame().timersPaused()

> Source/WebCore/rendering/RenderElement.cpp:1304
> +    auto visibleRect = document().view()->visibleContentRect();

frameView().visibleContentRect()

> Source/WebCore/rendering/RenderElement.h:206
> +    virtual void newImageAnimationFrameAvailable(CachedImage&) override;

This should be final, too!

> Source/WebCore/rendering/RenderView.cpp:1181
> +void RenderView::addRendererWithPausedImageAnimations( RenderElement& renderer)

Weird space here!

> Source/WebCore/rendering/RenderView.cpp:1203
> +    Vector<RenderElement*> toRemove;

I'd give this some token inline capacity.
Comment 5 Antti Koivisto 2014-02-11 18:51:24 PST
http://trac.webkit.org/changeset/163928
Comment 6 Simon Fraser (smfr) 2014-02-11 19:04:50 PST
Comment on attachment 223923 [details]
patch

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

> Source/WebCore/rendering/RenderElement.cpp:1296
> +    if (!visibleRect.intersects(renderer.absoluteBoundingBoxRect()))

Sad that you have to call renderer.absoluteBoundingBoxRect() here; that walks up the tree!

> LayoutTests/ChangeLog:9
> +        * fast/repaint/no-animation-outside-viewport.html: Added.

Doesn't this need to be a tiled drawing test?
Comment 7 Antti Koivisto 2014-02-11 19:57:23 PST
(In reply to comment #6)
> Sad that you have to call renderer.absoluteBoundingBoxRect() here; that walks up the tree!

Kinda unavoidable.

> Doesn't this need to be a tiled drawing test?

The test works as expected in wk2. I don't know what is tiled drawing test.
Comment 8 Simon Fraser (smfr) 2014-02-11 20:44:17 PST
I guess all WK2 tests are in tiled drawing mode now. That used to not be the case (which is why some tests live in LayoutTests/platform/mac-wk2/tiled-drawing/).
Comment 9 Said Abou-Hallawa 2017-08-24 15:54:57 PDT
*** Bug 112327 has been marked as a duplicate of this bug. ***