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

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

Issue 179293004: Drive SVG Animations via requestAnimationFrame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 10 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/SVGImageChromeClient.cpp
diff --git a/Source/core/svg/graphics/SVGImageChromeClient.cpp b/Source/core/svg/graphics/SVGImageChromeClient.cpp
index 5c197ba7fcf80d6b68facd3ac5cd9a9aaf87c28e..290c821eb986a4ccaad5bf1b0fd24e84d55ad9ce 100644
--- a/Source/core/svg/graphics/SVGImageChromeClient.cpp
+++ b/Source/core/svg/graphics/SVGImageChromeClient.cpp
@@ -35,6 +35,8 @@
namespace WebCore {
+static const double animationFrameDelay = 0.025;
dstockwell 2014/03/04 01:19:04 Is this 40hz, why?
fs 2014/03/04 10:28:19 I used the old value from the SVG animations code
+
SVGImageChromeClient::SVGImageChromeClient(SVGImage* image)
: m_image(image)
, m_animationTimer(this, &SVGImageChromeClient::animationTimerFired)
@@ -67,7 +69,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>*)
« Source/core/svg/animation/SMILTimeContainer.cpp ('K') | « Source/core/svg/graphics/SVGImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698