Chromium Code Reviews| Index: Source/core/animation/CompositorAnimations.cpp |
| diff --git a/Source/core/animation/CompositorAnimations.cpp b/Source/core/animation/CompositorAnimations.cpp |
| index facbd8e3830f7bd242d0cf3f6969089c3e5f277c..70f2143ccc085a25ca6a66f816576c879adc3175 100644 |
| --- a/Source/core/animation/CompositorAnimations.cpp |
| +++ b/Source/core/animation/CompositorAnimations.cpp |
| @@ -96,7 +96,10 @@ bool considerAnimationAsIncompatible(const Animation& animation, const Animation |
| bool hasIncompatibleAnimations(const Element& targetElement, const Animation& animationToAdd, const EffectModel& effectToAdd) |
| { |
| const bool affectsOpacity = effectToAdd.affects(PropertyHandle(CSSPropertyOpacity)); |
| - const bool affectsTransform = effectToAdd.affects(PropertyHandle(CSSPropertyTransform)); |
| + const bool affectsTransform = effectToAdd.affects(PropertyHandle(CSSPropertyRotate)) |
| + || effectToAdd.affects(PropertyHandle(CSSPropertyScale)) |
| + || effectToAdd.affects(PropertyHandle(CSSPropertyTransform)) |
| + || effectToAdd.affects(PropertyHandle(CSSPropertyTranslate)); |
| const bool affectsFilter = effectToAdd.affects(PropertyHandle(CSSPropertyWebkitFilter)); |
| if (!targetElement.hasAnimations()) |
| @@ -111,7 +114,10 @@ bool hasIncompatibleAnimations(const Element& targetElement, const Animation& an |
| continue; |
| if ((affectsOpacity && attachedAnimation->affects(targetElement, CSSPropertyOpacity)) |
| + || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyRotate)) |
| + || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyScale)) |
| || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTransform)) |
| + || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTranslate)) |
| || (affectsFilter && attachedAnimation->affects(targetElement, CSSPropertyWebkitFilter))) |
| return true; |
| } |
| @@ -121,8 +127,13 @@ bool hasIncompatibleAnimations(const Element& targetElement, const Animation& an |
| } |
| -CSSPropertyID CompositorAnimations::CompositableProperties[3] = { |
| - CSSPropertyOpacity, CSSPropertyTransform, CSSPropertyWebkitFilter |
| +CSSPropertyID CompositorAnimations::CompositableProperties[6] = { |
| + CSSPropertyOpacity, |
| + CSSPropertyRotate, |
| + CSSPropertyScale, |
| + CSSPropertyTransform, |
| + CSSPropertyTranslate, |
| + CSSPropertyWebkitFilter |
| }; |
| bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const EffectModel& effect, double minValue, double maxValue) const |
| @@ -142,7 +153,10 @@ bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const EffectMod |
| continue; |
| // TODO: Add the ability to get expanded bounds for filters as well. |
| - if (property.cssProperty() != CSSPropertyTransform) |
| + if (property.cssProperty() != CSSPropertyRotate |
| + && property.cssProperty() != CSSPropertyScale |
| + && property.cssProperty() != CSSPropertyTransform |
| + && property.cssProperty() != CSSPropertyTranslate) |
| continue; |
| const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropertySpecificKeyframes(property); |
| @@ -200,10 +214,17 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
| if (properties.isEmpty()) |
| return false; |
| + unsigned transformOperationsCount = 0; |
| for (const auto& property : properties) { |
| if (!property.isCSSProperty()) |
| return false; |
| + if (property.cssProperty() == CSSPropertyRotate |
| + || property.cssProperty() == CSSPropertyScale |
| + || property.cssProperty() == CSSPropertyTransform |
| + || property.cssProperty() == CSSPropertyTranslate) |
| + transformOperationsCount++; |
| + |
| const PropertySpecificKeyframeVector& keyframes = keyframeEffect.getPropertySpecificKeyframes(property); |
| ASSERT(keyframes.size() >= 2); |
| for (const auto& keyframe : keyframes) { |
| @@ -215,6 +236,9 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
| switch (property.cssProperty()) { |
| case CSSPropertyOpacity: |
| break; |
| + case CSSPropertyRotate: |
| + case CSSPropertyScale: |
| + case CSSPropertyTranslate: |
| case CSSPropertyTransform: |
| if (toAnimatableTransform(keyframe->getAnimatableValue().get())->transformOperations().dependsOnBoxSize()) |
| return false; |
| @@ -232,6 +256,9 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
| } |
| } |
| + if (transformOperationsCount > 1) |
| + return false; |
|
alancutter (OOO until 2018)
2015/07/01 03:35:47
Add TODO for supporting multiple transform propert
soonm
2015/07/01 07:18:50
Done
|
| + |
| if (animationToAdd && hasIncompatibleAnimations(targetElement, *animationToAdd, effect)) |
| return false; |
| @@ -245,7 +272,10 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
| void CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(const Element& targetElement, const Animation& animationToAdd, const EffectModel& effectToAdd) |
| { |
| const bool affectsOpacity = effectToAdd.affects(PropertyHandle(CSSPropertyOpacity)); |
| - const bool affectsTransform = effectToAdd.affects(PropertyHandle(CSSPropertyTransform)); |
| + const bool affectsTransform = effectToAdd.affects(PropertyHandle(CSSPropertyRotate)) |
| + || effectToAdd.affects(PropertyHandle(CSSPropertyScale)) |
| + || effectToAdd.affects(PropertyHandle(CSSPropertyTransform)) |
| + || effectToAdd.affects(PropertyHandle(CSSPropertyTranslate)); |
| const bool affectsFilter = effectToAdd.affects(PropertyHandle(CSSPropertyWebkitFilter)); |
| if (!targetElement.hasAnimations()) |
| @@ -260,7 +290,10 @@ void CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(const Elemen |
| continue; |
| if ((affectsOpacity && attachedAnimation->affects(targetElement, CSSPropertyOpacity)) |
| + || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyRotate)) |
| + || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyScale)) |
| || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTransform)) |
| + || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTranslate)) |
| || (affectsFilter && attachedAnimation->affects(targetElement, CSSPropertyWebkitFilter))) |
| attachedAnimation->cancelAnimationOnCompositor(); |
| } |
| @@ -630,6 +663,9 @@ void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, in |
| curve = adoptPtr(filterCurve); |
| break; |
| } |
| + case CSSPropertyRotate: |
| + case CSSPropertyScale: |
| + case CSSPropertyTranslate: |
| case CSSPropertyTransform: { |
| targetProperty = WebCompositorAnimation::TargetPropertyTransform; |
| WebTransformAnimationCurve* transformCurve = Platform::current()->compositorSupport()->createTransformAnimationCurve(); |