unsigned CompositeAnimation::numberOfActiveAnimations() const { unsigned count = 0; if (!m_keyframeAnimations.isEmpty()) { m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { KeyframeAnimation* anim = it->second.get(); if (anim->running()) ++count; } } if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { ImplicitAnimation* anim = it->second.get(); if (anim->running()) ++count; } } return count; }
bool CompositeAnimation::pauseTransitionAtTime(CSSPropertyID property, double t) { if ((property < firstCSSProperty) || (property >= firstCSSProperty + numCSSProperties)) return false; ImplicitAnimation* implAnim = m_transitions.get(property); if (!implAnim) { // Check to see if this property is being animated via a shorthand. // This code is only used for testing, so performance is not critical here. HashSet<CSSPropertyID> shorthandProperties = CSSPropertyAnimation::animatableShorthandsAffectingProperty(property); bool anyPaused = false; for (auto propertyID : shorthandProperties) { if (pauseTransitionAtTime(propertyID, t)) anyPaused = true; } return anyPaused; } if (!implAnim->running()) return false; if ((t >= 0.0) && (t <= implAnim->duration())) { implAnim->freezeAtTime(t); return true; } return false; }
bool CompositeAnimation::pauseTransitionAtTime(int property, double t) { if ((property < firstCSSProperty) || (property >= firstCSSProperty + numCSSProperties)) return false; ImplicitAnimation* implAnim = m_transitions.get(property).get(); if (!implAnim) { // Check to see if this property is being animated via a shorthand. // This code is only used for testing, so performance is not critical here. HashSet<int> shorthandProperties = AnimationBase::animatableShorthandsAffectingProperty(property); bool anyPaused = false; HashSet<int>::const_iterator end = shorthandProperties.end(); for (HashSet<int>::const_iterator it = shorthandProperties.begin(); it != end; ++it) { if (pauseTransitionAtTime(*it, t)) anyPaused = true; } return anyPaused; } if (!implAnim->running()) return false; if ((t >= 0.0) && (t <= implAnim->duration())) { implAnim->freezeAtTime(t); return true; } return false; }
bool CompositeAnimation::pauseTransitionAtTime(int property, double t) { if ((property < firstCSSProperty) || (property >= firstCSSProperty + numCSSProperties)) return false; ImplicitAnimation* implAnim = m_transitions.get(property).get(); if (!implAnim || !implAnim->running()) return false; if ((t >= 0.0) && (t <= implAnim->duration())) { implAnim->freezeAtTime(t); return true; } return false; }
bool CompositeAnimation::animating() { CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { ImplicitAnimation* transition = it->second; if (transition && transition->animating() && transition->running()) return true; } AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) { KeyframeAnimation* anim = it->second; if (anim && !anim->paused() && anim->animating() && anim->active()) return true; } return false; }