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 6ce4345c2c685b45d244aff8daf680c279ce6a48..90f7b7b2f7317bff8374a20f104b252421ac121b 100644 |
| --- a/Source/core/animation/css/CSSAnimations.cpp |
| +++ b/Source/core/animation/css/CSSAnimations.cpp |
| @@ -33,6 +33,7 @@ |
| #include "StylePropertyShorthand.h" |
| #include "core/animation/ActiveAnimations.h" |
| +#include "core/animation/CompositorAnimations.h" |
| #include "core/animation/DocumentTimeline.h" |
| #include "core/animation/KeyframeAnimationEffect.h" |
| #include "core/animation/css/CSSAnimatableValueFactory.h" |
| @@ -519,8 +520,9 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element) |
| // The event delegate is set on the the first animation only. We |
| // rely on the behavior of OwnPtr::release() to achieve this. |
| RefPtr<Animation> animation = Animation::create(element, inertAnimation->effect(), inertAnimation->specified(), Animation::DefaultPriority, eventDelegate.release()); |
| - RefPtr<Player> player = element->document().timeline()->play(animation.get()); |
| + RefPtr<Player> player = element->document().timeline()->createPlayer(animation.get()); |
| player->setPaused(inertAnimation->paused()); |
| + element->document().cssPendingAnimations().add(player.get()); |
| players.add(player.release()); |
| } |
| m_animations.set(iter->name, players); |
| @@ -542,7 +544,8 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element) |
| InertAnimation* inertAnimation = newTransition.animation.get(); |
| OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionEventDelegate(element, id)); |
| RefPtr<Animation> transition = Animation::create(element, inertAnimation->effect(), inertAnimation->specified(), Animation::TransitionPriority, eventDelegate.release()); |
| - element->document().transitionTimeline()->play(transition.get()); |
| + RefPtr<Player> player = element->document().transitionTimeline()->createPlayer(transition.get()); |
| + element->document().cssPendingAnimations().add(player.get()); |
| runningTransition.transition = transition.get(); |
| m_transitions.set(id, runningTransition); |
| ASSERT(id != CSSPropertyInvalid); |
| @@ -686,6 +689,35 @@ void CSSAnimations::calculateTransitionCompositableValues(CSSAnimationUpdate* up |
| update->adoptCompositableValuesForTransitions(compositableValuesForTransitions); |
| } |
| +bool CSSAnimations::hasPendingCandidateWhichShouldComposite(bool inCompositingMode) const |
| +{ |
| + if (!m_pendingUpdate) |
| + return false; |
| + |
| + for (size_t i = 0; i < m_pendingUpdate->newAnimations().size(); ++i) { |
| + HashSet<RefPtr<InertAnimation> > animations = m_pendingUpdate->newAnimations()[i].animations; |
| + for (HashSet<RefPtr<InertAnimation> >::const_iterator it = animations.begin(); it != animations.end(); ++it) { |
| + ASSERT((*it)->effect()); |
| + AnimationEffect* effect = (*it)->effect(); |
| + // FIXME: Perhaps pass a predicate funciton so that we can remove the explicit checks from this file? |
| + if ((effect->affects(CSSPropertyOpacity) && inCompositingMode) |
| + || effect->affects(CSSPropertyWebkitTransform) |
| + || effect->affects(CSSPropertyWebkitFilter)) |
| + return true; |
| + } |
| + } |
| + |
| + for (size_t i = 0; i < m_pendingUpdate->newTransitions().size(); ++i) { |
| + AnimationEffect* effect = m_pendingUpdate->newTransitions()[i].animation->effect(); |
| + if ((effect->affects(CSSPropertyOpacity) && inCompositingMode) |
| + || effect->affects(CSSPropertyWebkitTransform) |
| + || effect->affects(CSSPropertyWebkitFilter)) |
| + return true; |
|
Steve Block
2013/11/18 05:03:03
It's a shame that the logic regarding these 3 prop
dstockwell
2013/11/18 06:11:20
There's a FIXME on line 702 with a possible soluti
|
| + } |
| + |
| + return false; |
| +} |
| + |
| void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime) |
| { |
| if (m_target->document().hasListenerType(listenerType)) |