void CompositeAnimation::resetTransitions(RenderObject* renderer) { CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { ImplicitAnimation* transition = it->second; transition->reset(renderer); delete transition; } m_transitions.clear(); }
void CompositeAnimation::cleanupFinishedAnimations(RenderObject* renderer) { if (suspended()) return; // Make a list of transitions to be deleted Vector<int> finishedTransitions; CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { ImplicitAnimation* anim = it->second; if (!anim) continue; if (anim->postActive() && !anim->waitingForEndEvent()) finishedTransitions.append(anim->animatingProperty()); } // Delete them for (Vector<int>::iterator it = finishedTransitions.begin(); it != finishedTransitions.end(); ++it) { ImplicitAnimation* anim = m_transitions.get(*it); if (anim) { anim->reset(renderer); delete anim; } m_transitions.remove(*it); } // Make a list of animations to be deleted Vector<AtomicStringImpl*> finishedAnimations; AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) { KeyframeAnimation* anim = it->second; if (!anim) continue; if (anim->postActive() && !anim->waitingForEndEvent()) finishedAnimations.append(anim->name().impl()); } // delete them for (Vector<AtomicStringImpl*>::iterator it = finishedAnimations.begin(); it != finishedAnimations.end(); ++it) { KeyframeAnimation* kfanim = m_keyframeAnimations.get(*it); if (kfanim) { kfanim->reset(renderer); delete kfanim; } m_keyframeAnimations.remove(*it); } }
void CompositeAnimation::updateTransitions(RenderObject* renderer, const RenderStyle* currentStyle, RenderStyle* targetStyle) { // If currentStyle is null, we don't do transitions if (!currentStyle || !targetStyle->transitions()) return; // Check to see if we need to update the active transitions for (size_t i = 0; i < targetStyle->transitions()->size(); ++i) { const Animation* anim = (*targetStyle->transitions())[i].get(); double duration = anim->duration(); double delay = anim->delay(); // If this is an empty transition, skip it if (duration == 0 && delay <= 0) continue; int prop = anim->property(); bool all = prop == cAnimateAll; // Handle both the 'all' and single property cases. For the single prop case, we make only one pass // through the loop for (int propertyIndex = 0; ; ++propertyIndex) { if (all) { if (propertyIndex >= AnimationBase::getNumProperties()) break; // get the next prop prop = AnimationBase::getPropertyAtIndex(propertyIndex); } // ImplicitAnimations are always hashed by actual properties, never cAnimateAll ASSERT(prop > firstCSSProperty && prop < (firstCSSProperty + numCSSProperties)); // See if there is a current transition for this prop ImplicitAnimation* implAnim = m_transitions.get(prop); bool equal = true; if (implAnim) { // There is one, has our target changed? if (!implAnim->isTargetPropertyEqual(prop, targetStyle)) { implAnim->reset(renderer); delete implAnim; m_transitions.remove(prop); equal = false; } } else { // See if we need to start a new transition equal = AnimationBase::propertiesEqual(prop, currentStyle, targetStyle); } if (!equal) { // Add the new transition ImplicitAnimation* animation = new ImplicitAnimation(const_cast<Animation*>(anim), prop, renderer, this); m_transitions.set(prop, animation); } // We only need one pass for the single prop case if (!all) break; } } }