Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / graphics / SVGImageChromeClient.cpp
index 4df8c47..cb69a78 100644 (file)
 
 #include "core/frame/FrameView.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "platform/ScriptForbiddenScope.h"
 #include "platform/graphics/ImageObserver.h"
 #include "wtf/CurrentTime.h"
 
-namespace WebCore {
+namespace blink {
 
 static const double animationFrameDelay = 0.025;
 
@@ -80,12 +81,13 @@ void SVGImageChromeClient::scheduleAnimation()
 
 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(monotonicallyIncreasingTime());
-        m_image->frameView()->updateLayoutAndStyleForPainting();
-    }
+    if (!m_image)
+        return;
+    // serviceScriptedAnimations runs requestAnimationFrame callbacks, but SVG
+    // images can't have any so we assert there's no script.
+    ScriptForbiddenScope forbidScript;
+    m_image->frameView()->page()->animator().serviceScriptedAnimations(monotonicallyIncreasingTime());
+    m_image->frameView()->updateLayoutAndStyleForPainting();
 }
 
 }