18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2007 Apple Inc. All rights reserved. 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met: 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer. 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution. 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * its contributors may be used to endorse or promote products derived 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * from this software without specific prior written permission. 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "config.h" 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "CompositeAnimation.h" 318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 328f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian#include "AnimationControllerPrivate.h" 33f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "CSSPropertyLonghand.h" 348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "CSSPropertyNames.h" 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "ImplicitAnimation.h" 368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "KeyframeAnimation.h" 378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "RenderObject.h" 388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "RenderStyle.h" 392bde8e466a4451c7319e3a072d118917957d6554Steve Block#include "WebKitAnimation.h" 402bde8e466a4451c7319e3a072d118917957d6554Steve Block#include "WebKitAnimationList.h" 418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore { 438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 445f1ab04193ad0130ca8204aadaceae083aca9881Feng QianCompositeAnimation::~CompositeAnimation() 458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 462daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch // Toss the refs to all animations, but make sure we remove them from 472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch // any waiting lists first. 482daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 492daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch clearRenderer(); 508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project m_transitions.clear(); 518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project m_keyframeAnimations.clear(); 528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 53635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 545f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::clearRenderer() 55635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 56635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 57635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // Clear the renderers from all running animations, in case we are in the middle of 58635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // an animation callback (see https://bugs.webkit.org/show_bug.cgi?id=22052) 59635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 60635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 61635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* transition = it->second.get(); 622bde8e466a4451c7319e3a072d118917957d6554Steve Block animationController()->animationWillBeRemoved(transition); 632daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch transition->clear(); 64635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 65635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 66635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 67d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 68635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 69635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 70635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project KeyframeAnimation* anim = it->second.get(); 712bde8e466a4451c7319e3a072d118917957d6554Steve Block animationController()->animationWillBeRemoved(anim); 722daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch anim->clear(); 73635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 74635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 75635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 768f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 775f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::updateTransitions(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle) 788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 790bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // If currentStyle is null or there are no old or new transitions, just skip it 800bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!currentStyle || (!targetStyle->transitions() && m_transitions.isEmpty())) 818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return; 828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 830bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Mark all existing transitions as no longer active. We will mark the still active ones 840bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // in the next loop and then toss the ones that didn't get marked. 850bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); 860bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) 870bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch it->second->setActive(false); 880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 890bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch RefPtr<RenderStyle> modifiedCurrentStyle; 900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Check to see if we need to update the active transitions 920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (targetStyle->transitions()) { 930bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (size_t i = 0; i < targetStyle->transitions()->size(); ++i) { 940bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch const Animation* anim = targetStyle->transitions()->animation(i); 950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch bool isActiveTransition = anim->duration() || anim->delay() > 0; 968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 970bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch int prop = anim->property(); 988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 990bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (prop == cAnimateNone) 1000bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch continue; 1018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1020bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch bool all = prop == cAnimateAll; 1030bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1040bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Handle both the 'all' and single property cases. For the single prop case, we make only one pass 1050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // through the loop. 1060bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (int propertyIndex = 0; propertyIndex < AnimationBase::getNumProperties(); ++propertyIndex) { 1070bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (all) { 1080bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Get the next property which is not a shorthand. 1090bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch bool isShorthand; 1100bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch prop = AnimationBase::getPropertyAtIndex(propertyIndex, isShorthand); 1110bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (isShorthand) 1120bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch continue; 1130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } 1148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // ImplicitAnimations are always hashed by actual properties, never cAnimateAll 1160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ASSERT(prop >= firstCSSProperty && prop < (firstCSSProperty + numCSSProperties)); 1170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // If there is a running animation for this property, the transition is overridden 1190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // and we have to use the unanimatedStyle from the animation. We do the test 1200bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // against the unanimated style here, but we "override" the transition later. 1210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch RefPtr<KeyframeAnimation> keyframeAnim = getAnimationForProperty(prop); 1220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch RenderStyle* fromStyle = keyframeAnim ? keyframeAnim->unanimatedStyle() : currentStyle; 1230bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // See if there is a current transition for this prop 1250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ImplicitAnimation* implAnim = m_transitions.get(prop).get(); 1260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch bool equal = true; 1270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (implAnim) { 1290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // If we are post active don't bother setting the active flag. This will cause 1300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // this animation to get removed at the end of this function. 1310bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!implAnim->postActive()) 1320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch implAnim->setActive(true); 1330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1340bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // This might be a transition that is just finishing. That would be the case 1350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // if it were postActive. But we still need to check for equality because 1360bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // it could be just finishing AND changing to a new goal state. 1370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // 1380bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // This implAnim might also not be an already running transition. It might be 1390bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // newly added to the list in a previous iteration. This would happen if 1400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // you have both an explicit transition-property and 'all' in the same 1410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // list. In this case, the latter one overrides the earlier one, so we 1420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // behave as though this is a running animation being replaced. 1430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!implAnim->isTargetPropertyEqual(prop, targetStyle)) { 1440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch #if USE(ACCELERATED_COMPOSITING) 1450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // For accelerated animations we need to return a new RenderStyle with the _current_ value 1460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // of the property, so that restarted transitions use the correct starting point. 147967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch if (AnimationBase::animationOfPropertyIsAccelerated(prop) && implAnim->isAccelerated()) { 1480bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!modifiedCurrentStyle) 1490bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch modifiedCurrentStyle = RenderStyle::clone(currentStyle); 1500bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1510bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch implAnim->blendPropertyValueInStyle(prop, modifiedCurrentStyle.get()); 1520bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } 1530bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch #endif 15454cdeeebc7adcbcd900e8b6a141a8cae27d9a631Steve Block animationController()->animationWillBeRemoved(implAnim); 1550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch m_transitions.remove(prop); 1560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch equal = false; 1578f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian } 1580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } else { 1590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // We need to start a transition if it is active and the properties don't match 1600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch equal = !isActiveTransition || AnimationBase::propertiesEqual(prop, fromStyle, targetStyle); 1618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 1628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1630bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // We can be in this loop with an inactive transition (!isActiveTransition). We need 1640bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // to do that to check to see if we are canceling a transition. But we don't want to 1650bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // start one of the inactive transitions. So short circuit that here. (See 1660bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // <https://bugs.webkit.org/show_bug.cgi?id=24787> 1670bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!equal && isActiveTransition) { 1680bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Add the new transition 1690bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch m_transitions.set(prop, ImplicitAnimation::create(const_cast<Animation*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle)); 1700bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } 1710bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1720bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // We only need one pass for the single prop case 1730bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!all) 1740bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch break; 1758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 1768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 1778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 1780bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1790bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Make a list of transitions to be removed 1800bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch Vector<int> toBeRemoved; 1810bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch end = m_transitions.end(); 1820bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { 1830bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ImplicitAnimation* anim = it->second.get(); 1842bde8e466a4451c7319e3a072d118917957d6554Steve Block if (!anim->active()) { 1852bde8e466a4451c7319e3a072d118917957d6554Steve Block animationController()->animationWillBeRemoved(anim); 1860bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch toBeRemoved.append(anim->animatingProperty()); 1872bde8e466a4451c7319e3a072d118917957d6554Steve Block } 1880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } 1890bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Now remove the transitions from the list 1910bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (size_t j = 0; j < toBeRemoved.size(); ++j) 1920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch m_transitions.remove(toBeRemoved[j]); 1938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 1948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1955f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle) 1968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 1978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Nothing to do if we don't have any animations, and didn't have any before 1988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project if (m_keyframeAnimations.isEmpty() && !targetStyle->hasAnimations()) 1998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return; 2008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 201d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 202d0825bca7fe65beaee391d30da42e937db621564Steve Block 2038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end(); 2048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (currentStyle && currentStyle->hasAnimations() && targetStyle->hasAnimations() && *(currentStyle->animations()) == *(targetStyle->animations())) { 2060bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // The current and target animations are the same so we just need to toss any 2070bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // animation which is finished (postActive). 2080bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) { 2090bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (it->second->postActive()) 2100bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch it->second->setIndex(-1); 2110bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } 2120bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } else { 2130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Mark all existing animations as no longer active. 2140bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) 2150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch it->second->setIndex(-1); 2168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Toss the animation order map. 2180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch m_keyframeAnimationOrderMap.clear(); 21921939df44de1705786c545cd1bf519d47250322dBen Murdoch 22021939df44de1705786c545cd1bf519d47250322dBen Murdoch DEFINE_STATIC_LOCAL(const AtomicString, none, ("none")); 2210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Now mark any still active animations as active and add any new animations. 2230bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (targetStyle->animations()) { 2240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch int numAnims = targetStyle->animations()->size(); 2250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch for (int i = 0; i < numAnims; ++i) { 2260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch const Animation* anim = targetStyle->animations()->animation(i); 2270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch AtomicString animationName(anim->name()); 2280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (!anim->isValidAnimation()) 2300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch continue; 2310bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // See if there is a current animation for this name. 2330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(animationName.impl()); 2348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (keyframeAnim) { 2360bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // If this animation is postActive, skip it so it gets removed at the end of this function. 2370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (keyframeAnim->postActive()) 2380bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch continue; 2390bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // This one is still active. 2410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Animations match, but play states may differ. Update if needed. 24328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu keyframeAnim->updatePlayState(anim->playState()); 2440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Set the saved animation to this new one, just in case the play state has changed. 2460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch keyframeAnim->setAnimation(anim); 2470bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch keyframeAnim->setIndex(i); 24821939df44de1705786c545cd1bf519d47250322dBen Murdoch } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && animationName != none) { 249dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, targetStyle); 2500bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim); 2510bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch } 2520bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2530bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Add this to the animation order map. 2540bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (keyframeAnim) 2550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch m_keyframeAnimationOrderMap.append(keyframeAnim->name().impl()); 2568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Make a list of animations to be removed. 2618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Vector<AtomicStringImpl*> animsToBeRemoved; 2628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project kfend = m_keyframeAnimations.end(); 2638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) { 2648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project KeyframeAnimation* keyframeAnim = it->second.get(); 2652bde8e466a4451c7319e3a072d118917957d6554Steve Block if (keyframeAnim->index() < 0) { 2668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project animsToBeRemoved.append(keyframeAnim->name().impl()); 2672bde8e466a4451c7319e3a072d118917957d6554Steve Block animationController()->animationWillBeRemoved(keyframeAnim); 2682daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch keyframeAnim->clear(); 2692bde8e466a4451c7319e3a072d118917957d6554Steve Block } 2708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2720bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Now remove the animations from the list. 2738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project for (size_t j = 0; j < animsToBeRemoved.size(); ++j) 2748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project m_keyframeAnimations.remove(animsToBeRemoved[j]); 2758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 2768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2775f1ab04193ad0130ca8204aadaceae083aca9881Feng QianPassRefPtr<RenderStyle> CompositeAnimation::animate(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle) 2788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 2798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project RefPtr<RenderStyle> resultStyle; 2808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2810bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // We don't do any transitions if we don't have a currentStyle (on startup). 2828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project updateTransitions(renderer, currentStyle, targetStyle); 2830bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch updateKeyframeAnimations(renderer, currentStyle, targetStyle); 284d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 2858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project if (currentStyle) { 2878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Now that we have transition objects ready, let them know about the new goal state. We want them 2888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // to fill in a RenderStyle*& only if needed. 289635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 290635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); 291635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { 292635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (ImplicitAnimation* anim = it->second.get()) 2935f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian anim->animate(this, renderer, currentStyle, targetStyle, resultStyle); 294635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 2958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 2978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // Now that we have animation objects ready, let them know about the new goal state. We want them 2998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // to fill in a RenderStyle*& only if needed. 3008f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian for (Vector<AtomicStringImpl*>::const_iterator it = m_keyframeAnimationOrderMap.begin(); it != m_keyframeAnimationOrderMap.end(); ++it) { 3018f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(*it); 3028f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian if (keyframeAnim) 3035f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian keyframeAnim->animate(this, renderer, currentStyle, targetStyle, resultStyle); 3048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 3058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return resultStyle ? resultStyle.release() : targetStyle; 3078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 3088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3095f1ab04193ad0130ca8204aadaceae083aca9881Feng QianPassRefPtr<RenderStyle> CompositeAnimation::getAnimatedStyle() const 3108f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian{ 3118f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian RefPtr<RenderStyle> resultStyle; 3128f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); 3138f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { 3148f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian if (ImplicitAnimation* implicitAnimation = it->second.get()) 3158f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian implicitAnimation->getAnimatedStyle(resultStyle); 3168f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian } 3178f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 318d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 319d0825bca7fe65beaee391d30da42e937db621564Steve Block 3208f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian for (Vector<AtomicStringImpl*>::const_iterator it = m_keyframeAnimationOrderMap.begin(); it != m_keyframeAnimationOrderMap.end(); ++it) { 3218f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian RefPtr<KeyframeAnimation> keyframeAnimation = m_keyframeAnimations.get(*it); 3228f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian if (keyframeAnimation) 3238f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian keyframeAnimation->getAnimatedStyle(resultStyle); 3248f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian } 3258f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 3268f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian return resultStyle; 3278f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian} 3288f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian 3298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project// "animating" means that something is running that requires the timer to keep firing 3305f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::setAnimating(bool animating) 3318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 332635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 333635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 334635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 335635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* transition = it->second.get(); 336635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project transition->setAnimating(animating); 337635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 3388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 339635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 340d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 341635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 342635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 343635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project KeyframeAnimation* anim = it->second.get(); 344635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project anim->setAnimating(animating); 345635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 3468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 3478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 3488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3495f1ab04193ad0130ca8204aadaceae083aca9881Feng Qiandouble CompositeAnimation::timeToNextService() const 3508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 351635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // Returns the time at which next service is required. -1 means no service is required. 0 means 352635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // service is required now, and > 0 means service is required that many seconds in the future. 353635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project double minT = -1; 354635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 355635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 356635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 357635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 358635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* transition = it->second.get(); 3595f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian double t = transition ? transition->timeToNextService() : -1; 360635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (t < minT || minT == -1) 361635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project minT = t; 362635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (minT == 0) 363635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return 0; 364635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 3658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 366635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 367d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 368635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 369635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 370635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project KeyframeAnimation* animation = it->second.get(); 3715f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian double t = animation ? animation->timeToNextService() : -1; 372635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (t < minT || minT == -1) 373635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project minT = t; 374635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (minT == 0) 375635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return 0; 376635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 3778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 3788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 379635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return minT; 3808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 3818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3825f1ab04193ad0130ca8204aadaceae083aca9881Feng QianPassRefPtr<KeyframeAnimation> CompositeAnimation::getAnimationForProperty(int property) const 3838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 384635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project RefPtr<KeyframeAnimation> retval; 3858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // We want to send back the last animation with the property if there are multiples. 3878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // So we need to iterate through all animations 388635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 389d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 390635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 391635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 392635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project RefPtr<KeyframeAnimation> anim = it->second; 393635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim->hasAnimationForProperty(property)) 394635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project retval = anim; 395635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 3968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 3978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return retval; 3998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 4008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4015f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::suspendAnimations() 4028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 40328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (m_suspended) 4048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return; 4058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 40628040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_suspended = true; 4078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 408635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 409d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 410635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 411635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 412635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (KeyframeAnimation* anim = it->second.get()) 41328040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu anim->updatePlayState(AnimPlayStatePaused); 414635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 4158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 416635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 417635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 418635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 419635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* anim = it->second.get(); 420635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim && anim->hasStyle()) 42128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu anim->updatePlayState(AnimPlayStatePaused); 422635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 4238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 4248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 4258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4265f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::resumeAnimations() 4278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 42828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu if (!m_suspended) 4298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return; 4308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 43128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu m_suspended = false; 4328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 433635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 434d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 435635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 436635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 437635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project KeyframeAnimation* anim = it->second.get(); 438635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim && anim->playStatePlaying()) 43928040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu anim->updatePlayState(AnimPlayStatePlaying); 440635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 4418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 4428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 443635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 444635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 445635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 446635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* anim = it->second.get(); 447635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim && anim->hasStyle()) 44828040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu anim->updatePlayState(AnimPlayStatePlaying); 449635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 4508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 4518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 4528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4535f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::overrideImplicitAnimations(int property) 4548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 4558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); 456635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 457635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { 458635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* anim = it->second.get(); 459635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim && anim->animatingProperty() == property) 460635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project anim->setOverridden(true); 461635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 4628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 4638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 4648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4655f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianvoid CompositeAnimation::resumeOverriddenImplicitAnimations(int property) 4668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 467635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 468635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); 469635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { 470635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* anim = it->second.get(); 471635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim && anim->animatingProperty() == property) 472635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project anim->setOverridden(false); 473635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 474635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 475635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project} 476635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 477967717af5423377c967781471ee106e2bb4e11c8Ben Murdochbool CompositeAnimation::isAnimatingProperty(int property, bool acceleratedOnly, bool isRunningNow) const 478635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 479635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 480d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 481635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 482635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 483635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project KeyframeAnimation* anim = it->second.get(); 484967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow)) 485635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return true; 486635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 487635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 488635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 489635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 490635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 491635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 492635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* anim = it->second.get(); 493967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow)) 494635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return true; 495635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 4968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 497635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return false; 4988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 4998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5005f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianbool CompositeAnimation::pauseAnimationAtTime(const AtomicString& name, double t) 501635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project{ 502635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!name) 503635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return false; 5048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 505d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 506d0825bca7fe65beaee391d30da42e937db621564Steve Block 507635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(name.impl()); 508635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!keyframeAnim || !keyframeAnim->running()) 509635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return false; 5108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 511635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project int count = keyframeAnim->m_animation->iterationCount(); 512635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if ((t >= 0.0) && (!count || (t <= count * keyframeAnim->duration()))) { 5130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch keyframeAnim->freezeAtTime(t); 514635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return true; 5158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 5168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 517635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return false; 5188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 5198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5205f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianbool CompositeAnimation::pauseTransitionAtTime(int property, double t) 5218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 522635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if ((property < firstCSSProperty) || (property >= firstCSSProperty + numCSSProperties)) 523635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return false; 524635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 525635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* implAnim = m_transitions.get(property).get(); 526f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (!implAnim) { 527f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch // Check to see if this property is being animated via a shorthand. 528f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch // This code is only used for testing, so performance is not critical here. 529f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch HashSet<int> shorthandProperties = AnimationBase::animatableShorthandsAffectingProperty(property); 530f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch bool anyPaused = false; 531f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch HashSet<int>::const_iterator end = shorthandProperties.end(); 532f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch for (HashSet<int>::const_iterator it = shorthandProperties.begin(); it != end; ++it) { 533f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (pauseTransitionAtTime(*it, t)) 534f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch anyPaused = true; 535f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch } 536f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return anyPaused; 537f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch } 538f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 539f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (!implAnim->running()) 540635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return false; 5418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 542635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if ((t >= 0.0) && (t <= implAnim->duration())) { 5430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch implAnim->freezeAtTime(t); 544635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return true; 5458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project } 546635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 5478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project return false; 5488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 5498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5505f1ab04193ad0130ca8204aadaceae083aca9881Feng Qianunsigned CompositeAnimation::numberOfActiveAnimations() const 5518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 552635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project unsigned count = 0; 553635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 554635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_keyframeAnimations.isEmpty()) { 555d0825bca7fe65beaee391d30da42e937db621564Steve Block m_keyframeAnimations.checkConsistency(); 556635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); 557635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { 558635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project KeyframeAnimation* anim = it->second.get(); 559635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim->running()) 560635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ++count; 561635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 562635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 563635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 564635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (!m_transitions.isEmpty()) { 565635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); 566635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { 567635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ImplicitAnimation* anim = it->second.get(); 568635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project if (anim->running()) 569635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project ++count; 570635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 571635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project } 572635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 573635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project return count; 5748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 5758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 5762bde8e466a4451c7319e3a072d118917957d6554Steve BlockPassRefPtr<WebKitAnimationList> CompositeAnimation::animations() const 5772bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 5782bde8e466a4451c7319e3a072d118917957d6554Steve Block RefPtr<WebKitAnimationList> animations = WebKitAnimationList::create(); 5792bde8e466a4451c7319e3a072d118917957d6554Steve Block if (!m_keyframeAnimations.isEmpty()) { 5802bde8e466a4451c7319e3a072d118917957d6554Steve Block m_keyframeAnimations.checkConsistency(); 5812bde8e466a4451c7319e3a072d118917957d6554Steve Block for (Vector<AtomicStringImpl*>::const_iterator it = m_keyframeAnimationOrderMap.begin(); it != m_keyframeAnimationOrderMap.end(); ++it) { 5822bde8e466a4451c7319e3a072d118917957d6554Steve Block RefPtr<KeyframeAnimation> keyframeAnimation = m_keyframeAnimations.get(*it); 5832bde8e466a4451c7319e3a072d118917957d6554Steve Block if (keyframeAnimation) { 5842bde8e466a4451c7319e3a072d118917957d6554Steve Block RefPtr<WebKitAnimation> anim = WebKitAnimation::create(keyframeAnimation); 5852bde8e466a4451c7319e3a072d118917957d6554Steve Block animations->append(anim); 5862bde8e466a4451c7319e3a072d118917957d6554Steve Block } 5872bde8e466a4451c7319e3a072d118917957d6554Steve Block } 5882bde8e466a4451c7319e3a072d118917957d6554Steve Block } 5892bde8e466a4451c7319e3a072d118917957d6554Steve Block return animations; 5902bde8e466a4451c7319e3a072d118917957d6554Steve Block} 5912bde8e466a4451c7319e3a072d118917957d6554Steve Block 5928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore 593