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

Unified Diff: Source/core/animation/KeyframeEffect.cpp

Issue 1218943002: Compositor animations for Independent CSS Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clean up test Created 5 years, 6 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/animation/KeyframeEffect.cpp
diff --git a/Source/core/animation/KeyframeEffect.cpp b/Source/core/animation/KeyframeEffect.cpp
index 0afa07e9837f71cf7e403be29b4d57eaf5ac9465..8b3a4fd7768c19778893bb09ee135f760970bc72 100644
--- a/Source/core/animation/KeyframeEffect.cpp
+++ b/Source/core/animation/KeyframeEffect.cpp
@@ -139,14 +139,13 @@ void KeyframeEffect::applyEffects()
// Cancel composited animation of transform if a motion path, translate,
// rotate or scale operation has been introduced on the element.
dstockwell 2015/07/03 01:58:41 comment needs update
soonm 2015/07/03 06:34:29 Done.
if (m_target->computedStyle()
- && (m_target->computedStyle()->hasMotionPath()
- || m_target->computedStyle()->translate()
- || m_target->computedStyle()->rotate()
- || m_target->computedStyle()->scale())
+ && m_target->computedStyle()->hasMotionPath()
&& animation()->hasActiveAnimationsOnCompositor()
- && animation()->affects(*m_target, CSSPropertyTransform)) {
+ && (animation()->affects(*m_target, CSSPropertyScale)
+ || animation()->affects(*m_target, CSSPropertyRotate)
+ || animation()->affects(*m_target, CSSPropertyTransform)
+ || animation()->affects(*m_target, CSSPropertyTranslate)))
animation()->cancelAnimationOnCompositor();
- }
double iteration = currentIteration();
ASSERT(iteration >= 0);
@@ -246,9 +245,25 @@ bool KeyframeEffect::isCandidateForAnimationOnCompositor(double animationPlaybac
{
if (!model()
|| !m_target
- || (m_target->computedStyle() && (m_target->computedStyle()->hasMotionPath() || m_target->computedStyle()->translate() || m_target->computedStyle()->rotate() || m_target->computedStyle()->scale())))
+ || (m_target->computedStyle() && m_target->computedStyle()->hasMotionPath()))
return false;
+ // Do not put transforms on compositor if more than one of them are defined
dstockwell 2015/07/03 01:58:40 I'm not sure the above is correct now (in applyEff
soonm 2015/07/03 06:34:29 Add tests to check for cancellations happening whe
+ // in computed style because they need to be explicitly ordered
+ if (m_target->computedStyle()) {
+ unsigned transformOperationsCount = 0;
+ if (m_target->computedStyle()->hasTransformOperations())
+ transformOperationsCount++;
+ if (m_target->computedStyle()->rotate())
+ transformOperationsCount++;
+ if (m_target->computedStyle()->scale())
+ transformOperationsCount++;
+ if (m_target->computedStyle()->translate())
+ transformOperationsCount++;
+ if (transformOperationsCount > 1)
+ return false;
+ }
+
return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor(specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate);
}

Powered by Google App Engine
This is Rietveld 408576698