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 b2b0bd35c5e3c1b19fa93bdee967f1d711b6d942..b5a59b9501570522fafcf567ea2977935f711674 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; |
| +} |
|
Julien - ping for review
2014/03/21 03:57:25
This function creates a double-standard where some
dstockwell
2014/03/24 21:40:56
We don't ever want to animate both -webkit-transfo
|
| + |
| 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 |
| // Note that the backwards part is required for delay to work. |
| timing.fillMode = Timing::FillModeBoth; |
| - 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)); |
|
Julien - ping for review
2014/03/21 03:57:25
Correct me if I am wrong but won't this only dispa
dstockwell
2014/03/24 21:40:56
Which listeners are called is orthogonal to the pr
|
| 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; |
| } |