Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1755)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 754813002: Expose setting API to set ImageAnimationPolicy(Allowed, Once, None) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Support three options for animations Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 0a8a986932c617eb0a17ce44c542e908f3ed58ca..293ecc90a75fb1e3acaf69ef323ef70dbff8ebfe 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -2790,7 +2790,7 @@ void RenderObject::collectAnnotatedRegions(Vector<AnnotatedRegionValue>& regions
curr->collectAnnotatedRegions(regions);
}
-bool RenderObject::willRenderImage(ImageResource*)
+bool RenderObject::willRenderImage(ImageResource*, bool repeated)
{
// Without visibility we won't render (and therefore don't care about animation).
if (style()->visibility() != VISIBLE)
@@ -2800,6 +2800,16 @@ bool RenderObject::willRenderImage(ImageResource*)
if (document().activeDOMObjectsAreSuspended())
return false;
+ // We will not render a new imagePweb
dmazzoni 2014/11/24 17:50:47 Typo?
je_julie(Not used) 2014/11/27 17:22:50 Done.
+ // when AnimatedImageType is set to AnimatedImageTypeNone or
+ // when AnimatedImageType is set to AnimatedImageTypeOnce and frame is last.
+ if (document().settings()) {
+ AnimatedImageType animation = document().settings()->animatedImageType();
+ if (animation == AnimatedImageTypeNone)
+ return false;
+ if (animation == AnimatedImageTypeOnce && repeated)
+ return false;
+ }
// If we're not in a window (i.e., we're dormant from being in a background tab)
// then we don't want to render either.
return document().view()->isVisible();

Powered by Google App Engine
This is Rietveld 408576698