Index: third_party/WebKit/Source/core/svg/graphics/SVGImage.h |
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.h b/third_party/WebKit/Source/core/svg/graphics/SVGImage.h |
index ea98cf224aa79547f8541b11b5603b09fae1b47f..3de118dc6827ff866f6c5fe93f7564a3ed94fee0 100644 |
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.h |
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.h |
@@ -83,10 +83,25 @@ public: |
bool hasIntrinsicDimensions() const; |
+ // While updating the image's animations the underlying ImageResource needs |
+ // to be kept alive and it should not trigger resetting of animations while |
+ // the update runs. This scope object takes care of the details. |
+ class UpdateAnimationScope { |
+ STACK_ALLOCATED(); |
+ public: |
+ explicit UpdateAnimationScope(SVGImage*); |
+ ~UpdateAnimationScope(); |
+ |
+ private: |
+ SVGImage* m_image; |
+ Member<ImageObserver> m_imageObserver; |
+ }; |
+ |
private: |
friend class AXLayoutObject; |
friend class SVGImageChromeClient; |
friend class SVGImageForContainer; |
+ friend class UpdateAnimationScope; |
~SVGImage() override; |
@@ -113,6 +128,15 @@ private: |
void drawInternal(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatRect& toRect, RespectImageOrientationEnum, |
ImageClampingMode, const KURL&); |
+ void enterNoResetAnimationsScope() |
+ { |
+ // No known need for supporting nested invocations. |
+ DCHECK(!m_updatingAnimations); |
+ m_updatingAnimations = true; |
+ } |
+ |
+ void leaveNoResetAnimationScope(); |
+ |
Persistent<SVGImageChromeClient> m_chromeClient; |
Persistent<Page> m_page; |
@@ -123,6 +147,9 @@ private: |
// SVGImage. SVGImageForContainer carried the final image size, |
// also called concrete object size. |
IntSize m_intrinsicSize; |
+ |
+ bool m_updatingAnimations; |
+ bool m_resetAnimationAfterUpdate; |
}; |
DEFINE_IMAGE_TYPE_CASTS(SVGImage); |