| Index: Source/core/animation/KeyframeEffect.cpp
|
| diff --git a/Source/core/animation/KeyframeEffect.cpp b/Source/core/animation/KeyframeEffect.cpp
|
| index 0afa07e9837f71cf7e403be29b4d57eaf5ac9465..c9bd7b003633e008e143ca6f7b4231095ffeefc6 100644
|
| --- a/Source/core/animation/KeyframeEffect.cpp
|
| +++ b/Source/core/animation/KeyframeEffect.cpp
|
| @@ -129,6 +129,31 @@ static AnimationStack& ensureAnimationStack(Element* element)
|
| return element->ensureElementAnimations().defaultStack();
|
| }
|
|
|
| +bool KeyframeEffect::hasIncompatibleStyle()
|
| +{
|
| + if (!m_target->computedStyle())
|
| + return false;
|
| +
|
| + bool affectsTransform = animation()->affects(*m_target, CSSPropertyTransform)
|
| + || animation()->affects(*m_target, CSSPropertyScale)
|
| + || animation()->affects(*m_target, CSSPropertyRotate)
|
| + || animation()->affects(*m_target, CSSPropertyTranslate);
|
| +
|
| + if (animation()->hasActiveAnimationsOnCompositor()) {
|
| + if (m_target->computedStyle()->hasMotionPath() && affectsTransform)
|
| + return true;
|
| +
|
| + if ((m_target->computedStyle()->hasTransformOperations()
|
| + || m_target->computedStyle()->rotate()
|
| + || m_target->computedStyle()->scale()
|
| + || m_target->computedStyle()->translate())
|
| + && affectsTransform)
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| void KeyframeEffect::applyEffects()
|
| {
|
| ASSERT(isInEffect());
|
| @@ -136,17 +161,10 @@ void KeyframeEffect::applyEffects()
|
| if (!m_target || !m_model)
|
| return;
|
|
|
| - // Cancel composited animation of transform if a motion path, translate,
|
| - // rotate or scale operation has been introduced on the element.
|
| - if (m_target->computedStyle()
|
| - && (m_target->computedStyle()->hasMotionPath()
|
| - || m_target->computedStyle()->translate()
|
| - || m_target->computedStyle()->rotate()
|
| - || m_target->computedStyle()->scale())
|
| - && animation()->hasActiveAnimationsOnCompositor()
|
| - && animation()->affects(*m_target, CSSPropertyTransform)) {
|
| + // Cancel composited animation of transform, translate, rotate or scale
|
| + // if a motion path has been introduced on the element.
|
| + if (hasIncompatibleStyle())
|
| animation()->cancelAnimationOnCompositor();
|
| - }
|
|
|
| double iteration = currentIteration();
|
| ASSERT(iteration >= 0);
|
| @@ -246,9 +264,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
|
| + // in computed style because they need to be explicitly ordered
|
| + if (m_target->computedStyle()) {
|
| + unsigned transformPropertysCount = 0;
|
| + if (m_target->computedStyle()->hasTransformOperations())
|
| + transformPropertysCount++;
|
| + if (m_target->computedStyle()->rotate())
|
| + transformPropertysCount++;
|
| + if (m_target->computedStyle()->scale())
|
| + transformPropertysCount++;
|
| + if (m_target->computedStyle()->translate())
|
| + transformPropertysCount++;
|
| + if (transformPropertysCount > 1)
|
| + return false;
|
| + }
|
| +
|
| return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor(specifiedTiming(), *m_target, animation(), *model(), animationPlaybackRate);
|
| }
|
|
|
|
|