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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.h

Issue 2005693002: Delay SVGImage animations reset while being updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698