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

Unified Diff: Source/core/rendering/RenderLayerBacking.cpp

Issue 24198009: RenderLayerBacking::startAnimation() return value has incorrect semantic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Mark virtual/web-animations-css/animations Crash Created 7 years, 3 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
« no previous file with comments | « LayoutTests/animations/two-properties-in-keyframed-animation-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « LayoutTests/animations/two-properties-in-keyframed-animation-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698