OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 m_transitions.clear(); | 652 m_transitions.clear(); |
653 m_pendingUpdate = nullptr; | 653 m_pendingUpdate = nullptr; |
654 } | 654 } |
655 | 655 |
656 void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u
pdate, const Element* element) | 656 void CSSAnimations::calculateAnimationActiveInterpolations(CSSAnimationUpdate* u
pdate, const Element* element) |
657 { | 657 { |
658 ActiveAnimations* activeAnimations = element ? element->activeAnimations() :
0; | 658 ActiveAnimations* activeAnimations = element ? element->activeAnimations() :
0; |
659 AnimationStack* animationStack = activeAnimations ? &activeAnimations->defau
ltStack() : 0; | 659 AnimationStack* animationStack = activeAnimations ? &activeAnimations->defau
ltStack() : 0; |
660 | 660 |
661 if (update->newAnimations().isEmpty() && update->cancelledAnimationAnimation
Players().isEmpty()) { | 661 if (update->newAnimations().isEmpty() && update->cancelledAnimationAnimation
Players().isEmpty()) { |
662 HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolationsForAn
imations(AnimationStack::activeInterpolations(animationStack, 0, 0, Animation::D
efaultPriority)); | 662 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > act
iveInterpolationsForAnimations(AnimationStack::activeInterpolations(animationSta
ck, 0, 0, Animation::DefaultPriority)); |
663 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAn
imations); | 663 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAn
imations); |
664 return; | 664 return; |
665 } | 665 } |
666 | 666 |
667 Vector<InertAnimation*> newAnimations; | 667 Vector<InertAnimation*> newAnimations; |
668 for (size_t i = 0; i < update->newAnimations().size(); ++i) { | 668 for (size_t i = 0; i < update->newAnimations().size(); ++i) { |
669 HashSet<RefPtr<InertAnimation> > animations = update->newAnimations()[i]
.animations; | 669 HashSet<RefPtr<InertAnimation> > animations = update->newAnimations()[i]
.animations; |
670 for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = a
nimations.begin(); animationsIter != animations.end(); ++animationsIter) | 670 for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = a
nimations.begin(); animationsIter != animations.end(); ++animationsIter) |
671 newAnimations.append(animationsIter->get()); | 671 newAnimations.append(animationsIter->get()); |
672 } | 672 } |
673 HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolationsForAnimat
ions(AnimationStack::activeInterpolations(animationStack, &newAnimations, &updat
e->cancelledAnimationAnimationPlayers(), Animation::DefaultPriority)); | 673 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > activeI
nterpolationsForAnimations(AnimationStack::activeInterpolations(animationStack,
&newAnimations, &update->cancelledAnimationAnimationPlayers(), Animation::Defaul
tPriority)); |
674 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimat
ions); | 674 update->adoptActiveInterpolationsForAnimations(activeInterpolationsForAnimat
ions); |
675 } | 675 } |
676 | 676 |
677 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate*
update, const Element* element) | 677 void CSSAnimations::calculateTransitionActiveInterpolations(CSSAnimationUpdate*
update, const Element* element) |
678 { | 678 { |
679 ActiveAnimations* activeAnimations = element ? element->activeAnimations() :
0; | 679 ActiveAnimations* activeAnimations = element ? element->activeAnimations() :
0; |
680 AnimationStack* animationStack = activeAnimations ? &activeAnimations->defau
ltStack() : 0; | 680 AnimationStack* animationStack = activeAnimations ? &activeAnimations->defau
ltStack() : 0; |
681 | 681 |
682 HashMap<CSSPropertyID, RefPtr<Interpolation> > activeInterpolationsForTransi
tions; | 682 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > activeI
nterpolationsForTransitions; |
683 if (update->newTransitions().isEmpty() && update->cancelledTransitions().isE
mpty()) { | 683 if (update->newTransitions().isEmpty() && update->cancelledTransitions().isE
mpty()) { |
684 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, 0, 0, Animation::TransitionPriority); | 684 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, 0, 0, Animation::TransitionPriority); |
685 } else { | 685 } else { |
686 Vector<InertAnimation*> newTransitions; | 686 Vector<InertAnimation*> newTransitions; |
687 for (CSSAnimationUpdate::NewTransitionMap::const_iterator iter = update-
>newTransitions().begin(); iter != update->newTransitions().end(); ++iter) | 687 for (CSSAnimationUpdate::NewTransitionMap::const_iterator iter = update-
>newTransitions().begin(); iter != update->newTransitions().end(); ++iter) |
688 newTransitions.append(iter->value.animation.get()); | 688 newTransitions.append(iter->value.animation.get()); |
689 | 689 |
690 HashSet<const AnimationPlayer*> cancelledAnimationPlayers; | 690 HashSet<const AnimationPlayer*> cancelledAnimationPlayers; |
691 if (!update->cancelledTransitions().isEmpty()) { | 691 if (!update->cancelledTransitions().isEmpty()) { |
692 ASSERT(activeAnimations); | 692 ASSERT(activeAnimations); |
693 const TransitionMap& transitionMap = activeAnimations->cssAnimations
().m_transitions; | 693 const TransitionMap& transitionMap = activeAnimations->cssAnimations
().m_transitions; |
694 for (HashSet<CSSPropertyID>::iterator iter = update->cancelledTransi
tions().begin(); iter != update->cancelledTransitions().end(); ++iter) { | 694 for (HashSet<CSSPropertyID>::iterator iter = update->cancelledTransi
tions().begin(); iter != update->cancelledTransitions().end(); ++iter) { |
695 ASSERT(transitionMap.contains(*iter)); | 695 ASSERT(transitionMap.contains(*iter)); |
696 cancelledAnimationPlayers.add(transitionMap.get(*iter).transitio
n->player()); | 696 cancelledAnimationPlayers.add(transitionMap.get(*iter).transitio
n->player()); |
697 } | 697 } |
698 } | 698 } |
699 | 699 |
700 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, &newTransitions, &cancelledAnimationPlayers, Animation::Transi
tionPriority); | 700 activeInterpolationsForTransitions = AnimationStack::activeInterpolation
s(animationStack, &newTransitions, &cancelledAnimationPlayers, Animation::Transi
tionPriority); |
701 } | 701 } |
702 | 702 |
703 // Properties being animated by animations don't get values from transitions
applied. | 703 // Properties being animated by animations don't get values from transitions
applied. |
704 if (!update->activeInterpolationsForAnimations().isEmpty() && !activeInterpo
lationsForTransitions.isEmpty()) { | 704 if (!update->activeInterpolationsForAnimations().isEmpty() && !activeInterpo
lationsForTransitions.isEmpty()) { |
705 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter
= update->activeInterpolationsForAnimations().begin(); iter != update->activeIn
terpolationsForAnimations().end(); ++iter) | 705 for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>
>::const_iterator iter = update->activeInterpolationsForAnimations().begin(); it
er != update->activeInterpolationsForAnimations().end(); ++iter) |
706 activeInterpolationsForTransitions.remove(iter->key); | 706 activeInterpolationsForTransitions.remove(iter->key); |
707 } | 707 } |
708 update->adoptActiveInterpolationsForTransitions(activeInterpolationsForTrans
itions); | 708 update->adoptActiveInterpolationsForTransitions(activeInterpolationsForTrans
itions); |
709 } | 709 } |
710 | 710 |
711 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType
listenerType, const AtomicString& eventName, double elapsedTime) | 711 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType
listenerType, const AtomicString& eventName, double elapsedTime) |
712 { | 712 { |
713 if (m_target->document().hasListenerType(listenerType)) { | 713 if (m_target->document().hasListenerType(listenerType)) { |
714 RefPtr<WebKitAnimationEvent> event = WebKitAnimationEvent::create(eventN
ame, m_name, elapsedTime); | 714 RefPtr<WebKitAnimationEvent> event = WebKitAnimationEvent::create(eventN
ame, m_name, elapsedTime); |
715 event->setTarget(m_target); | 715 event->setTarget(m_target); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 CSSPropertyID id = convertToCSSPropertyID(i); | 890 CSSPropertyID id = convertToCSSPropertyID(i); |
891 if (isAnimatableProperty(id)) | 891 if (isAnimatableProperty(id)) |
892 properties.append(id); | 892 properties.append(id); |
893 } | 893 } |
894 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); | 894 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); |
895 } | 895 } |
896 return propertyShorthand; | 896 return propertyShorthand; |
897 } | 897 } |
898 | 898 |
899 } // namespace WebCore | 899 } // namespace WebCore |
OLD | NEW |