Chromium Code Reviews| Index: Source/core/animation/css/CSSAnimations.cpp |
| diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp |
| index d90ebc6d18fce6ff34f4f412a0329d600c281a99..87005bd3c4a4b899f5ef4948c468c7c96d0f4d1d 100644 |
| --- a/Source/core/animation/css/CSSAnimations.cpp |
| +++ b/Source/core/animation/css/CSSAnimations.cpp |
| @@ -72,6 +72,17 @@ bool isLaterPhase(TimedItem::Phase target, TimedItem::Phase reference) |
| return target > reference; |
| } |
| +CSSPropertyID propertyForAnimation(CSSPropertyID property) |
| +{ |
| + switch (property) { |
|
eseidel
2014/03/27 23:13:22
Why the switch? I guess your'e going to add more?
dstockwell
2014/03/27 23:21:09
Yes.
|
| + case CSSPropertyWebkitPerspective: |
| + return CSSPropertyPerspective; |
| + 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) |
| { |
| @@ -86,7 +97,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(); |
| @@ -99,12 +110,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. |
| @@ -114,7 +126,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)); |
| @@ -483,7 +495,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(); |
| @@ -566,7 +578,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()); |
| } |
| @@ -608,6 +621,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 |
| @@ -857,7 +871,7 @@ bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
| case CSSPropertyWebkitMaskPositionX: |
| case CSSPropertyWebkitMaskPositionY: |
| case CSSPropertyWebkitMaskSize: |
| - case CSSPropertyWebkitPerspective: |
| + case CSSPropertyPerspective: |
| case CSSPropertyWebkitPerspectiveOriginX: |
| case CSSPropertyWebkitPerspectiveOriginY: |
| case CSSPropertyShapeInside: |