Index: Source/core/animation/css/CSSAnimations.cpp |
diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp |
index a3aca2165a34afc61ed30190ad3326e62f5c4bba..598f691926868a401fd5db918ce337320c91093f 100644 |
--- a/Source/core/animation/css/CSSAnimations.cpp |
+++ b/Source/core/animation/css/CSSAnimations.cpp |
@@ -73,6 +73,30 @@ bool isLaterPhase(TimedItem::Phase target, TimedItem::Phase reference) |
return target > reference; |
} |
+CSSPropertyID propertyForAnimation(CSSPropertyID property) |
+{ |
+ switch (property) { |
+ case CSSPropertyWebkitPerspective: |
+ return CSSPropertyPerspective; |
+ case CSSPropertyWebkitTransform: |
+ return CSSPropertyTransform; |
+ case CSSPropertyWebkitPerspectiveOriginX: |
+ case CSSPropertyWebkitPerspectiveOriginY: |
+ if (RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()) |
+ return CSSPropertyPerspectiveOrigin; |
+ break; |
+ case CSSPropertyWebkitTransformOriginX: |
+ case CSSPropertyWebkitTransformOriginY: |
+ case CSSPropertyWebkitTransformOriginZ: |
+ if (RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled()) |
+ return CSSPropertyTransformOrigin; |
+ break; |
+ default: |
+ break; |
+ } |
+ return property; |
+} |
+ |
static void resolveKeyframes(StyleResolver* resolver, Element* element, const Element& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, |
WillBeHeapVector<KeyframeEffectModel::KeyframeVector>& resolvedKeyframes) |
{ |
@@ -87,7 +111,7 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const El |
return; |
// Construct and populate the style for each keyframe |
- PropertySet specifiedProperties; |
+ PropertySet specifiedPropertiesForUseCounter; |
KeyframeEffectModel::KeyframeVector keyframes; |
for (size_t i = 0; i < styleKeyframes.size(); ++i) { |
const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); |
@@ -100,12 +124,13 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const El |
keyframe->setEasing(defaultTimingFunction); |
const StylePropertySet& properties = styleKeyframe->properties(); |
for (unsigned j = 0; j < properties.propertyCount(); j++) { |
- CSSPropertyID property = properties.propertyAt(j).id(); |
- specifiedProperties.add(property); |
- if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) |
+ specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id()); |
+ CSSPropertyID property = propertyForAnimation(properties.propertyAt(j).id()); |
+ if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) { |
keyframe->setEasing(KeyframeValue::timingFunction(*keyframeStyle)); |
- else if (CSSAnimations::isAnimatableProperty(property)) |
+ } else if (CSSAnimations::isAnimatableProperty(property)) { |
keyframe->setPropertyValue(property, CSSAnimatableValueFactory::create(property, *keyframeStyle).get()); |
+ } |
} |
keyframes.append(keyframe); |
// The last keyframe specified at a given offset is used. |
@@ -115,7 +140,7 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const El |
} |
ASSERT(!keyframes.isEmpty()); |
- for (PropertySet::const_iterator iter = specifiedProperties.begin(); iter != specifiedProperties.end(); ++iter) { |
+ for (PropertySet::const_iterator iter = specifiedPropertiesForUseCounter.begin(); iter != specifiedPropertiesForUseCounter.end(); ++iter) { |
const CSSPropertyID property = *iter; |
ASSERT(property != CSSPropertyInvalid); |
blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); |
@@ -484,7 +509,7 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element) |
CSSPropertyID id = newTransition.id; |
InertAnimation* inertAnimation = newTransition.animation.get(); |
- OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionEventDelegate(element, id)); |
+ OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionEventDelegate(element, newTransition.eventId)); |
RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect(); |
@@ -567,7 +592,8 @@ void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const |
RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create(keyframes); |
- update->startTransition(id, from.get(), to.get(), InertAnimation::create(effect, timing, isPaused)); |
+ CSSPropertyID eventId = anim->animationMode() == CSSAnimationData::AnimateAll ? id : anim->property(); |
+ update->startTransition(id, eventId, from.get(), to.get(), InertAnimation::create(effect, timing, isPaused)); |
ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnimationStyleChange()); |
} |
@@ -609,6 +635,7 @@ void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const |
CSSPropertyID id = propertyList.length() ? propertyList.properties()[j] : anim->property(); |
if (!animateAll) { |
+ id = propertyForAnimation(id); |
if (CSSAnimations::isAnimatableProperty(id)) |
listedProperties.set(id); |
else |
@@ -761,7 +788,6 @@ void CSSAnimations::TransitionEventDelegate::onEventCondition(const TimedItem* t |
} |
} |
- |
bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
{ |
switch (property) { |
@@ -858,24 +884,28 @@ bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
case CSSPropertyWebkitMaskPositionX: |
case CSSPropertyWebkitMaskPositionY: |
case CSSPropertyWebkitMaskSize: |
- case CSSPropertyWebkitPerspective: |
- case CSSPropertyWebkitPerspectiveOriginX: |
- case CSSPropertyWebkitPerspectiveOriginY: |
+ case CSSPropertyPerspective: |
case CSSPropertyShapeInside: |
case CSSPropertyShapeOutside: |
case CSSPropertyShapeMargin: |
case CSSPropertyShapeImageThreshold: |
case CSSPropertyWebkitTextStrokeColor: |
- case CSSPropertyWebkitTransform: |
- case CSSPropertyWebkitTransformOriginX: |
- case CSSPropertyWebkitTransformOriginY: |
- case CSSPropertyWebkitTransformOriginZ: |
+ case CSSPropertyTransform: |
case CSSPropertyWidows: |
case CSSPropertyWidth: |
case CSSPropertyWordSpacing: |
case CSSPropertyZIndex: |
case CSSPropertyZoom: |
return true; |
+ case CSSPropertyPerspectiveOrigin: |
+ case CSSPropertyTransformOrigin: |
+ return RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled(); |
+ case CSSPropertyWebkitPerspectiveOriginX: |
+ case CSSPropertyWebkitPerspectiveOriginY: |
+ case CSSPropertyWebkitTransformOriginX: |
+ case CSSPropertyWebkitTransformOriginY: |
+ case CSSPropertyWebkitTransformOriginZ: |
+ return !RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled(); |
default: |
return false; |
} |