| Index: Source/core/animation/css/CSSAnimations.cpp
|
| diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp
|
| index eb0e21b4dc6d5d3e90b61d5bbac2b1aff0ad754e..bbde17ab9299673c8e97c9defdb58f48ebecf57d 100644
|
| --- a/Source/core/animation/css/CSSAnimations.cpp
|
| +++ b/Source/core/animation/css/CSSAnimations.cpp
|
| @@ -519,22 +519,24 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
|
| }
|
| }
|
|
|
| -void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const CSSAnimationData* anim, const RenderStyle& oldStyle, const RenderStyle& style, const TransitionMap* activeTransitions, CSSAnimationUpdate* update)
|
| +void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const CSSAnimationData* anim, const RenderStyle& oldStyle, const RenderStyle& style, const TransitionMap* activeTransitions, CSSAnimationUpdate* update, const Element* element)
|
| {
|
| - if (CSSPropertyAnimation::propertiesEqual(id, &oldStyle, &style))
|
| - return;
|
| -
|
| - RefPtr<AnimatableValue> to = CSSAnimatableValueFactory::create(id, style);
|
| -
|
| + RefPtr<AnimatableValue> to;
|
| if (activeTransitions) {
|
| TransitionMap::const_iterator activeTransitionIter = activeTransitions->find(id);
|
| if (activeTransitionIter != activeTransitions->end()) {
|
| + to = CSSAnimatableValueFactory::create(id, style);
|
| const AnimatableValue* activeTo = activeTransitionIter->value.to;
|
| if (to->equals(activeTo))
|
| return;
|
| update->cancelTransition(id);
|
| + ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnimationStyleChange());
|
| }
|
| }
|
| + if (CSSPropertyAnimation::propertiesEqual(id, &oldStyle, &style))
|
| + return;
|
| + if (!to)
|
| + to = CSSAnimatableValueFactory::create(id, style);
|
|
|
| RefPtr<AnimatableValue> from = CSSAnimatableValueFactory::create(id, oldStyle);
|
| // If we have multiple transitions on the same property, we will use the
|
| @@ -565,6 +567,7 @@ void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const
|
| timing.fillMode = Timing::FillModeBoth;
|
|
|
| update->startTransition(id, from.get(), to.get(), InertAnimation::create(effect, timing, isPaused));
|
| + ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnimationStyleChange());
|
| }
|
|
|
| void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const Element* element, const RenderStyle& style)
|
| @@ -572,10 +575,18 @@ void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const
|
| ActiveAnimations* activeAnimations = element->activeAnimations();
|
| const TransitionMap* activeTransitions = activeAnimations ? &activeAnimations->cssAnimations().m_transitions : 0;
|
|
|
| +#if ASSERT_DISABLED
|
| + // In release builds we avoid the cost of checking for new and interrupted transitions if the style recalc is due to animation.
|
| + const bool animationStyleRecalc = activeAnimations && activeAnimations->isAnimationStyleChange();
|
| +#else
|
| + // In debug builds we verify that it would have been safe to avoid populating and testing listedProperties if the style recalc is due to animation.
|
| + const bool animationStyleRecalc = false;
|
| +#endif
|
| +
|
| BitArray<numCSSProperties> listedProperties;
|
| bool anyTransitionHadAnimateAll = false;
|
| const RenderObject* renderer = element->renderer();
|
| - if (style.display() != NONE && renderer && renderer->style() && style.transitions()) {
|
| + if (!animationStyleRecalc && style.display() != NONE && renderer && renderer->style() && style.transitions()) {
|
| const RenderStyle& oldStyle = *renderer->style();
|
|
|
| for (size_t i = 0; i < style.transitions()->size(); ++i) {
|
| @@ -604,7 +615,7 @@ void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const
|
| // but this is a bit hard to do with the current applyMatchedProperties system.
|
| if (!update->compositableValuesForAnimations().contains(id)
|
| && (!activeAnimations || !activeAnimations->cssAnimations().m_previousCompositableValuesForAnimations.contains(id))) {
|
| - calculateTransitionUpdateForProperty(id, anim, oldStyle, style, activeTransitions, update);
|
| + calculateTransitionUpdateForProperty(id, anim, oldStyle, style, activeTransitions, update, element);
|
| }
|
| }
|
| }
|
| @@ -614,8 +625,10 @@ void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const
|
| for (TransitionMap::const_iterator iter = activeTransitions->begin(); iter != activeTransitions->end(); ++iter) {
|
| const TimedItem* timedItem = iter->value.transition;
|
| CSSPropertyID id = iter->key;
|
| - if (timedItem->phase() == TimedItem::PhaseAfter || (!anyTransitionHadAnimateAll && !listedProperties.get(id)))
|
| + if (timedItem->phase() == TimedItem::PhaseAfter || (!anyTransitionHadAnimateAll && !animationStyleRecalc && !listedProperties.get(id))) {
|
| + ASSERT(timedItem->phase() == TimedItem::PhaseAfter || !(activeAnimations && activeAnimations->isAnimationStyleChange()));
|
| update->cancelTransition(id);
|
| + }
|
| }
|
| }
|
| }
|
|
|