Index: Source/core/animation/CompositorAnimations.cpp |
diff --git a/Source/core/animation/CompositorAnimations.cpp b/Source/core/animation/CompositorAnimations.cpp |
index 24dd788a64118288112626a1d749c5b5dab4ea58..22f42099c29ada7e90a8217f0a5020ebefb8a1a5 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(CSSPropertyTransform)) |
+ || effectToAdd.affects(PropertyHandle(CSSPropertyTranslate)) |
+ || effectToAdd.affects(PropertyHandle(CSSPropertyRotate)) |
+ || effectToAdd.affects(PropertyHandle(CSSPropertyScale)); |
const bool affectsFilter = effectToAdd.affects(PropertyHandle(CSSPropertyWebkitFilter)); |
if (!targetElement.hasAnimations()) |
@@ -111,6 +114,9 @@ bool hasIncompatibleAnimations(const Element& targetElement, const Animation& an |
continue; |
if ((affectsOpacity && attachedAnimation->affects(targetElement, CSSPropertyOpacity)) |
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTranslate)) |
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyScale)) |
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyRotate)) |
|| (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTransform)) |
|| (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, |
+ CSSPropertyTransform, |
+ CSSPropertyWebkitFilter, |
+ CSSPropertyTranslate, |
+ CSSPropertyRotate, |
+ CSSPropertyScale |
}; |
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() != CSSPropertyTransform |
+ || property.cssProperty() != CSSPropertyTranslate |
+ || property.cssProperty() != CSSPropertyRotate |
+ || property.cssProperty() != CSSPropertyScale) |
continue; |
const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropertySpecificKeyframes(property); |
@@ -200,10 +214,17 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
if (properties.isEmpty()) |
return false; |
+ unsigned transformOperationCount = 0; |
for (const auto& property : properties) { |
if (!property.isCSSProperty()) |
return false; |
+ if (property.cssProperty() == CSSPropertyTransform |
+ || property.cssProperty() == CSSPropertyTranslate |
+ || property.cssProperty() == CSSPropertyScale |
+ || property.cssProperty() == CSSPropertyRotate) |
+ transformOperationCount++; |
+ |
const PropertySpecificKeyframeVector& keyframes = keyframeEffect.getPropertySpecificKeyframes(property); |
ASSERT(keyframes.size() >= 2); |
for (const auto& keyframe : keyframes) { |
@@ -215,6 +236,10 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
switch (property.cssProperty()) { |
case CSSPropertyOpacity: |
break; |
+ /* Intentional fallthrough */ |
+ case CSSPropertyTranslate: |
+ case CSSPropertyRotate: |
+ case CSSPropertyScale: |
case CSSPropertyTransform: |
if (toAnimatableTransform(keyframe->getAnimatableValue().get())->transformOperations().dependsOnBoxSize()) |
return false; |
@@ -231,6 +256,8 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim |
} |
} |
} |
+ if (transformOperationCount > 1) |
+ return false; |
if (animationToAdd && hasIncompatibleAnimations(targetElement, *animationToAdd, effect)) |
return false; |
@@ -244,8 +271,12 @@ 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(CSSPropertyTransform)) |
+ || effectToAdd.affects(PropertyHandle(CSSPropertyTranslate)) |
+ || effectToAdd.affects(PropertyHandle(CSSPropertyRotate)) |
+ || effectToAdd.affects(PropertyHandle(CSSPropertyScale)); |
const bool affectsFilter = effectToAdd.affects(PropertyHandle(CSSPropertyWebkitFilter)); |
if (!targetElement.hasAnimations()) |
@@ -260,6 +291,9 @@ void CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(const Elemen |
continue; |
if ((affectsOpacity && attachedAnimation->affects(targetElement, CSSPropertyOpacity)) |
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTranslate)) |
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyScale)) |
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyRotate)) |
|| (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTransform)) |
|| (affectsFilter && attachedAnimation->affects(targetElement, CSSPropertyWebkitFilter))) |
attachedAnimation->cancelAnimationOnCompositor(); |
@@ -630,6 +664,10 @@ void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, in |
curve = adoptPtr(filterCurve); |
break; |
} |
+ /* Intentional fallthrough */ |
+ case CSSPropertyTranslate: |
+ case CSSPropertyRotate: |
+ case CSSPropertyScale: |
case CSSPropertyTransform: { |
targetProperty = WebCompositorAnimation::TargetPropertyTransform; |
WebTransformAnimationCurve* transformCurve = Platform::current()->compositorSupport()->createTransformAnimationCurve(); |