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

Unified Diff: Source/core/svg/graphics/SVGImage.cpp

Issue 206033005: Rewind the timeline for SVG-in-<img> when resetAnimation() is called (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
Index: Source/core/svg/graphics/SVGImage.cpp
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp
index 50112683e71a9d0dd6f2553cb5ca3a8d7de991af..02ee9054b96882c98f6f853f4c7e5216310a3dfb 100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -282,6 +282,8 @@ void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
if (imageObserver())
imageObserver()->didDraw(this);
+
+ startAnimation();
kouhei (in TOK) 2014/03/20 15:27:29 This line took me a while to understand. This call
fs 2014/03/20 17:02:17 Added a comment to that effect.
}
RenderBox* SVGImage::embeddedContentBox() const
@@ -351,10 +353,9 @@ void SVGImage::startAnimation(bool /* catchUpIfNecessary */)
return;
LocalFrame* frame = m_page->mainFrame();
SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
- if (!rootElement)
+ if (!rootElement || !rootElement->animationsPaused())
return;
rootElement->unpauseAnimations();
- rootElement->setCurrentTime(0);
}
void SVGImage::stopAnimation()
@@ -370,7 +371,14 @@ void SVGImage::stopAnimation()
void SVGImage::resetAnimation()
{
- stopAnimation();
+ if (!m_page)
+ return;
+ LocalFrame* frame = m_page->mainFrame();
+ SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();
+ if (!rootElement)
+ return;
+ rootElement->pauseAnimations();
+ rootElement->setCurrentTime(0);
}
bool SVGImage::hasAnimations() const

Powered by Google App Engine
This is Rietveld 408576698