Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp

Issue 2236583003: Rename AnimationEffect to AnimationEffectReadOnly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@deprecated-assert
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 void CSSAnimations::calculateUpdate(const Element* animatingElement, Element& el ement, const ComputedStyle& style, ComputedStyle* parentStyle, CSSAnimationUpdat e& animationUpdate, StyleResolver* resolver) 207 void CSSAnimations::calculateUpdate(const Element* animatingElement, Element& el ement, const ComputedStyle& style, ComputedStyle* parentStyle, CSSAnimationUpdat e& animationUpdate, StyleResolver* resolver)
208 { 208 {
209 calculateCompositorAnimationUpdate(animationUpdate, animatingElement, elemen t, style, parentStyle); 209 calculateCompositorAnimationUpdate(animationUpdate, animatingElement, elemen t, style, parentStyle);
210 calculateAnimationUpdate(animationUpdate, animatingElement, element, style, parentStyle, resolver); 210 calculateAnimationUpdate(animationUpdate, animatingElement, element, style, parentStyle, resolver);
211 calculateAnimationActiveInterpolations(animationUpdate, animatingElement); 211 calculateAnimationActiveInterpolations(animationUpdate, animatingElement);
212 calculateTransitionUpdate(animationUpdate, animatingElement, style); 212 calculateTransitionUpdate(animationUpdate, animatingElement, style);
213 calculateTransitionActiveInterpolations(animationUpdate, animatingElement); 213 calculateTransitionActiveInterpolations(animationUpdate, animatingElement);
214 } 214 }
215 215
216 static const KeyframeEffectModelBase* getKeyframeEffectModelBase(const Animation Effect* effect) 216 static const KeyframeEffectModelBase* getKeyframeEffectModelBase(const Animation EffectReadOnly* effect)
217 { 217 {
218 if (!effect) 218 if (!effect)
219 return nullptr; 219 return nullptr;
220 const EffectModel* model = nullptr; 220 const EffectModel* model = nullptr;
221 if (effect->isKeyframeEffect()) 221 if (effect->isKeyframeEffect())
222 model = toKeyframeEffect(effect)->model(); 222 model = toKeyframeEffect(effect)->model();
223 else if (effect->isInertEffect()) 223 else if (effect->isInertEffect())
224 model = toInertEffect(effect)->model(); 224 model = toInertEffect(effect)->model();
225 if (!model || !model->isKeyframeEffectModel()) 225 if (!model || !model->isKeyframeEffectModel())
226 return nullptr; 226 return nullptr;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 for (size_t i = 0; i < cancelRunningAnimationFlags.size(); i++) { 353 for (size_t i = 0; i < cancelRunningAnimationFlags.size(); i++) {
354 if (cancelRunningAnimationFlags[i]) { 354 if (cancelRunningAnimationFlags[i]) {
355 DCHECK(cssAnimations && !isAnimationStyleChange); 355 DCHECK(cssAnimations && !isAnimationStyleChange);
356 update.cancelAnimation(i, *cssAnimations->m_runningAnimations[i]->an imation); 356 update.cancelAnimation(i, *cssAnimations->m_runningAnimations[i]->an imation);
357 } 357 }
358 } 358 }
359 } 359 }
360 360
361 void CSSAnimations::snapshotCompositorKeyframes(Element& element, CSSAnimationUp date& update, const ComputedStyle& style, const ComputedStyle* parentStyle) 361 void CSSAnimations::snapshotCompositorKeyframes(Element& element, CSSAnimationUp date& update, const ComputedStyle& style, const ComputedStyle* parentStyle)
362 { 362 {
363 const auto& snapshot = [&element, &style, parentStyle](const AnimationEffect * effect) 363 const auto& snapshot = [&element, &style, parentStyle](const AnimationEffect ReadOnly* effect)
364 { 364 {
365 const KeyframeEffectModelBase* keyframeEffect = getKeyframeEffectModelBa se(effect); 365 const KeyframeEffectModelBase* keyframeEffect = getKeyframeEffectModelBa se(effect);
366 if (keyframeEffect && keyframeEffect->needsCompositorKeyframesSnapshot() ) 366 if (keyframeEffect && keyframeEffect->needsCompositorKeyframesSnapshot() )
367 keyframeEffect->snapshotAllCompositorKeyframes(element, style, paren tStyle); 367 keyframeEffect->snapshotAllCompositorKeyframes(element, style, paren tStyle);
368 }; 368 };
369 369
370 ElementAnimations* elementAnimations = element.elementAnimations(); 370 ElementAnimations* elementAnimations = element.elementAnimations();
371 if (elementAnimations) { 371 if (elementAnimations) {
372 for (auto& entry : elementAnimations->animations()) 372 for (auto& entry : elementAnimations->animations())
373 snapshot(entry.key->effect()); 373 snapshot(entry.key->effect());
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 772
773 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime) 773 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime)
774 { 774 {
775 if (m_animationTarget->document().hasListenerType(listenerType)) { 775 if (m_animationTarget->document().hasListenerType(listenerType)) {
776 AnimationEvent* event = AnimationEvent::create(eventName, m_name, elapse dTime); 776 AnimationEvent* event = AnimationEvent::create(eventName, m_name, elapse dTime);
777 event->setTarget(eventTarget()); 777 event->setTarget(eventTarget());
778 document().enqueueAnimationFrameEvent(event); 778 document().enqueueAnimationFrameEvent(event);
779 } 779 }
780 } 780 }
781 781
782 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat ionEffect& animationNode) 782 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat ionEffectReadOnly& animationNode)
783 { 783 {
784 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER); 784 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER);
785 } 785 }
786 786
787 void CSSAnimations::AnimationEventDelegate::onEventCondition(const AnimationEffe ct& animationNode) 787 void CSSAnimations::AnimationEventDelegate::onEventCondition(const AnimationEffe ctReadOnly& animationNode)
788 { 788 {
789 const AnimationEffect::Phase currentPhase = animationNode.getPhase(); 789 const AnimationEffectReadOnly::Phase currentPhase = animationNode.getPhase() ;
790 const double currentIteration = animationNode.currentIteration(); 790 const double currentIteration = animationNode.currentIteration();
791 791
792 if (m_previousPhase != currentPhase 792 if (m_previousPhase != currentPhase
793 && (currentPhase == AnimationEffect::PhaseActive || currentPhase == Anim ationEffect::PhaseAfter) 793 && (currentPhase == AnimationEffectReadOnly::PhaseActive || currentPhase == AnimationEffectReadOnly::PhaseAfter)
794 && (m_previousPhase == AnimationEffect::PhaseNone || m_previousPhase == AnimationEffect::PhaseBefore)) { 794 && (m_previousPhase == AnimationEffectReadOnly::PhaseNone || m_previousP hase == AnimationEffectReadOnly::PhaseBefore)) {
795 const double startDelay = animationNode.specifiedTiming().startDelay; 795 const double startDelay = animationNode.specifiedTiming().startDelay;
796 const double elapsedTime = startDelay < 0 ? -startDelay : 0; 796 const double elapsedTime = startDelay < 0 ? -startDelay : 0;
797 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati onstart, elapsedTime); 797 maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animati onstart, elapsedTime);
798 } 798 }
799 799
800 if (currentPhase == AnimationEffect::PhaseActive && m_previousPhase == curre ntPhase && m_previousIteration != currentIteration) { 800 if (currentPhase == AnimationEffectReadOnly::PhaseActive && m_previousPhase == currentPhase && m_previousIteration != currentIteration) {
801 // We fire only a single event for all iterations thast terminate 801 // We fire only a single event for all iterations thast terminate
802 // between a single pair of samples. See http://crbug.com/275263. For 802 // between a single pair of samples. See http://crbug.com/275263. For
803 // compatibility with the existing implementation, this event uses 803 // compatibility with the existing implementation, this event uses
804 // the elapsedTime for the first iteration in question. 804 // the elapsedTime for the first iteration in question.
805 DCHECK(!std::isnan(animationNode.specifiedTiming().iterationDuration)); 805 DCHECK(!std::isnan(animationNode.specifiedTiming().iterationDuration));
806 const double elapsedTime = animationNode.specifiedTiming().iterationDura tion * (m_previousIteration + 1); 806 const double elapsedTime = animationNode.specifiedTiming().iterationDura tion * (m_previousIteration + 1);
807 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime); 807 maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::ani mationiteration, elapsedTime);
808 } 808 }
809 809
810 if (currentPhase == AnimationEffect::PhaseAfter && m_previousPhase != Animat ionEffect::PhaseAfter) 810 if (currentPhase == AnimationEffectReadOnly::PhaseAfter && m_previousPhase ! = AnimationEffectReadOnly::PhaseAfter)
811 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationNode.activeDurationInternal()); 811 maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animation end, animationNode.activeDurationInternal());
812 812
813 m_previousPhase = currentPhase; 813 m_previousPhase = currentPhase;
814 m_previousIteration = currentIteration; 814 m_previousIteration = currentIteration;
815 } 815 }
816 816
817 DEFINE_TRACE(CSSAnimations::AnimationEventDelegate) 817 DEFINE_TRACE(CSSAnimations::AnimationEventDelegate)
818 { 818 {
819 visitor->trace(m_animationTarget); 819 visitor->trace(m_animationTarget);
820 AnimationEffect::EventDelegate::trace(visitor); 820 AnimationEffectReadOnly::EventDelegate::trace(visitor);
821 } 821 }
822 822
823 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const 823 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const
824 { 824 {
825 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget); 825 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget);
826 } 826 }
827 827
828 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff ect& animationNode) 828 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff ectReadOnly& animationNode)
829 { 829 {
830 const AnimationEffect::Phase currentPhase = animationNode.getPhase(); 830 const AnimationEffectReadOnly::Phase currentPhase = animationNode.getPhase() ;
831 if (currentPhase == AnimationEffect::PhaseAfter && currentPhase != m_previou sPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { 831 if (currentPhase == AnimationEffectReadOnly::PhaseAfter && currentPhase != m _previousPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) {
832 String propertyName = getPropertyNameString(m_property); 832 String propertyName = getPropertyNameString(m_property);
833 const Timing& timing = animationNode.specifiedTiming(); 833 const Timing& timing = animationNode.specifiedTiming();
834 double elapsedTime = timing.iterationDuration; 834 double elapsedTime = timing.iterationDuration;
835 const AtomicString& eventType = EventTypeNames::transitionend; 835 const AtomicString& eventType = EventTypeNames::transitionend;
836 String pseudoElement = PseudoElement::pseudoElementNameForEvents(getPseu doId()); 836 String pseudoElement = PseudoElement::pseudoElementNameForEvents(getPseu doId());
837 TransitionEvent* event = TransitionEvent::create(eventType, propertyName , elapsedTime, pseudoElement); 837 TransitionEvent* event = TransitionEvent::create(eventType, propertyName , elapsedTime, pseudoElement);
838 event->setTarget(eventTarget()); 838 event->setTarget(eventTarget());
839 document().enqueueAnimationFrameEvent(event); 839 document().enqueueAnimationFrameEvent(event);
840 } 840 }
841 841
842 m_previousPhase = currentPhase; 842 m_previousPhase = currentPhase;
843 } 843 }
844 844
845 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate) 845 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate)
846 { 846 {
847 visitor->trace(m_transitionTarget); 847 visitor->trace(m_transitionTarget);
848 AnimationEffect::EventDelegate::trace(visitor); 848 AnimationEffectReadOnly::EventDelegate::trace(visitor);
849 } 849 }
850 850
851 const StylePropertyShorthand& CSSAnimations::propertiesForTransitionAll() 851 const StylePropertyShorthand& CSSAnimations::propertiesForTransitionAll()
852 { 852 {
853 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ()); 853 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
854 DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ()); 854 DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ());
855 if (properties.isEmpty()) { 855 if (properties.isEmpty()) {
856 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { 856 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) {
857 CSSPropertyID id = convertToCSSPropertyID(i); 857 CSSPropertyID id = convertToCSSPropertyID(i);
858 // Avoid creating overlapping transitions with perspective-origin an d transition-origin. 858 // Avoid creating overlapping transitions with perspective-origin an d transition-origin.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 } 897 }
898 898
899 DEFINE_TRACE(CSSAnimations) 899 DEFINE_TRACE(CSSAnimations)
900 { 900 {
901 visitor->trace(m_transitions); 901 visitor->trace(m_transitions);
902 visitor->trace(m_pendingUpdate); 902 visitor->trace(m_pendingUpdate);
903 visitor->trace(m_runningAnimations); 903 visitor->trace(m_runningAnimations);
904 } 904 }
905 905
906 } // namespace blink 906 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/css/CSSAnimations.h ('k') | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698