Index: Source/core/svg/graphics/SVGImageChromeClient.cpp |
diff --git a/Source/core/svg/graphics/SVGImageChromeClient.cpp b/Source/core/svg/graphics/SVGImageChromeClient.cpp |
index 5c197ba7fcf80d6b68facd3ac5cd9a9aaf87c28e..ecbe952bb0b06272c6d75f7083711d1a385f9fab 100644 |
--- a/Source/core/svg/graphics/SVGImageChromeClient.cpp |
+++ b/Source/core/svg/graphics/SVGImageChromeClient.cpp |
@@ -32,9 +32,12 @@ |
#include "core/frame/FrameView.h" |
#include "core/svg/graphics/SVGImage.h" |
#include "platform/graphics/ImageObserver.h" |
+#include "wtf/CurrentTime.h" |
namespace WebCore { |
+static const double animationFrameDelay = 0.025; |
+ |
SVGImageChromeClient::SVGImageChromeClient(SVGImage* image) |
: m_image(image) |
, m_animationTimer(this, &SVGImageChromeClient::animationTimerFired) |
@@ -67,7 +70,12 @@ void SVGImageChromeClient::scheduleAnimation() |
// approach. |
if (m_animationTimer.isActive()) |
return; |
- m_animationTimer.startOneShot(0); |
+ // Schedule the 'animation' ASAP if the image does not contain any |
+ // animations, but prefer a fixed, jittery, frame-delay if there're any |
+ // animations. Checking for pending/active animations could be more |
+ // stringent. |
+ double fireTime = m_image->hasAnimations() ? animationFrameDelay : 0; |
+ m_animationTimer.startOneShot(fireTime); |
} |
void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*) |
@@ -75,7 +83,7 @@ void SVGImageChromeClient::animationTimerFired(Timer<SVGImageChromeClient>*) |
// In principle, we should call requestAnimationFrame callbacks here, but |
// we know there aren't any because script is forbidden inside SVGImages. |
if (m_image) { |
- m_image->frameView()->page()->animator().serviceScriptedAnimations(0); |
+ m_image->frameView()->page()->animator().serviceScriptedAnimations(currentTime()); |
m_image->frameView()->updateLayoutAndStyleIfNeededRecursive(); |
} |
} |