Index: Source/core/rendering/RenderLayerBacking.cpp |
diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp |
index d313007cabba36281e765e16723c13e6a23a7915..5a16fab63c2b8c1f7d4ce94fb24d7b6615220379 100644 |
--- a/Source/core/rendering/RenderLayerBacking.cpp |
+++ b/Source/core/rendering/RenderLayerBacking.cpp |
@@ -1772,15 +1772,32 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const CSSAnimationDat |
if (animations.isEmpty()) |
return false; |
- bool didAnimate = false; |
- if (animations.m_transformAnimation && m_graphicsLayer->addAnimation(animations.m_transformAnimation.get())) |
- didAnimate = true; |
- if (animations.m_opacityAnimation && m_graphicsLayer->addAnimation(animations.m_opacityAnimation.get())) |
- didAnimate = true; |
- if (animations.m_filterAnimation && m_graphicsLayer->addAnimation(animations.m_filterAnimation.get())) |
- didAnimate = true; |
- |
- return didAnimate; |
+ bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity); |
+ bool hasFilter = keyframes.containsProperty(CSSPropertyWebkitFilter); |
+ int animationId = m_animationProvider->getWebAnimationId(keyframes.animationName()); |
+ |
+ // Animating only some properties of the animation is not supported. So if the |
+ // GraphicsLayer rejects any property of the animation, we have to remove the |
+ // animation and return false to indicate un-accelerated animation is required. |
+ if (hasTransform) { |
+ if (!animations.m_transformAnimation || !m_graphicsLayer->addAnimation(animations.m_transformAnimation.get())) |
+ return false; |
+ } |
+ if (hasOpacity) { |
+ if (!animations.m_opacityAnimation || !m_graphicsLayer->addAnimation(animations.m_opacityAnimation.get())) { |
+ if (hasTransform) |
+ m_graphicsLayer->removeAnimation(animationId); |
+ return false; |
+ } |
+ } |
+ if (hasFilter) { |
+ if (!animations.m_filterAnimation || !m_graphicsLayer->addAnimation(animations.m_filterAnimation.get())) { |
+ if (hasTransform || hasOpacity) |
+ m_graphicsLayer->removeAnimation(animationId); |
+ return false; |
+ } |
+ } |
+ return true; |
} |
void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName) |