| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 namespace { | 67 namespace { |
| 68 | 68 |
| 69 static StringKeyframeEffectModel* createKeyframeEffectModel(StyleResolver* resol
ver, const Element* animatingElement, Element& element, const ComputedStyle* sty
le, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction*
defaultTimingFunction, size_t animationIndex) | 69 static StringKeyframeEffectModel* createKeyframeEffectModel(StyleResolver* resol
ver, const Element* animatingElement, Element& element, const ComputedStyle* sty
le, const ComputedStyle* parentStyle, const AtomicString& name, TimingFunction*
defaultTimingFunction, size_t animationIndex) |
| 70 { | 70 { |
| 71 // When the animating element is null, use its parent for scoping purposes. | 71 // When the animating element is null, use its parent for scoping purposes. |
| 72 const Element* elementForScoping = animatingElement ? animatingElement : &el
ement; | 72 const Element* elementForScoping = animatingElement ? animatingElement : &el
ement; |
| 73 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen
tForScoping, name); | 73 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen
tForScoping, name); |
| 74 ASSERT(keyframesRule); | 74 ASSERT(keyframesRule); |
| 75 | 75 |
| 76 StringKeyframeVector keyframes; | 76 StringKeyframeVector keyframes; |
| 77 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe
s = keyframesRule->keyframes(); | 77 const HeapVector<Member<StyleRuleKeyframe>>& styleKeyframes = keyframesRule-
>keyframes(); |
| 78 | 78 |
| 79 // Construct and populate the style for each keyframe | 79 // Construct and populate the style for each keyframe |
| 80 PropertySet specifiedPropertiesForUseCounter; | 80 PropertySet specifiedPropertiesForUseCounter; |
| 81 for (size_t i = 0; i < styleKeyframes.size(); ++i) { | 81 for (size_t i = 0; i < styleKeyframes.size(); ++i) { |
| 82 const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get(); | 82 const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get(); |
| 83 RefPtr<StringKeyframe> keyframe = StringKeyframe::create(); | 83 RefPtr<StringKeyframe> keyframe = StringKeyframe::create(); |
| 84 const Vector<double>& offsets = styleKeyframe->keys(); | 84 const Vector<double>& offsets = styleKeyframe->keys(); |
| 85 ASSERT(!offsets.isEmpty()); | 85 ASSERT(!offsets.isEmpty()); |
| 86 keyframe->setOffset(offsets[0]); | 86 keyframe->setOffset(offsets[0]); |
| 87 keyframe->setEasing(defaultTimingFunction); | 87 keyframe->setEasing(defaultTimingFunction); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 nameIndex++; | 296 nameIndex++; |
| 297 } | 297 } |
| 298 | 298 |
| 299 const bool isPaused = CSSTimingData::getRepeated(animationData->play
StateList(), i) == AnimPlayStatePaused; | 299 const bool isPaused = CSSTimingData::getRepeated(animationData->play
StateList(), i) == AnimPlayStatePaused; |
| 300 | 300 |
| 301 Timing timing = animationData->convertToTiming(i); | 301 Timing timing = animationData->convertToTiming(i); |
| 302 Timing specifiedTiming = timing; | 302 Timing specifiedTiming = timing; |
| 303 RefPtr<TimingFunction> keyframeTimingFunction = timing.timingFunctio
n; | 303 RefPtr<TimingFunction> keyframeTimingFunction = timing.timingFunctio
n; |
| 304 timing.timingFunction = Timing::defaults().timingFunction; | 304 timing.timingFunction = Timing::defaults().timingFunction; |
| 305 | 305 |
| 306 RefPtrWillBeRawPtr<StyleRuleKeyframes> keyframesRule = resolver->fin
dKeyframesRule(elementForScoping, name); | 306 RawPtr<StyleRuleKeyframes> keyframesRule = resolver->findKeyframesRu
le(elementForScoping, name); |
| 307 if (!keyframesRule) | 307 if (!keyframesRule) |
| 308 continue; // Cancel the animation if there's no style rule for i
t. | 308 continue; // Cancel the animation if there's no style rule for i
t. |
| 309 | 309 |
| 310 const RunningAnimation* existingAnimation = nullptr; | 310 const RunningAnimation* existingAnimation = nullptr; |
| 311 size_t existingAnimationIndex = 0; | 311 size_t existingAnimationIndex = 0; |
| 312 | 312 |
| 313 if (cssAnimations) { | 313 if (cssAnimations) { |
| 314 for (size_t i = 0; i < cssAnimations->m_runningAnimations.size()
; i++) { | 314 for (size_t i = 0; i < cssAnimations->m_runningAnimations.size()
; i++) { |
| 315 const RunningAnimation& runningAnimation = *cssAnimations->m
_runningAnimations[i]; | 315 const RunningAnimation& runningAnimation = *cssAnimations->m
_runningAnimations[i]; |
| 316 if (runningAnimation.name == name && runningAnimation.nameIn
dex == nameIndex) { | 316 if (runningAnimation.name == name && runningAnimation.nameIn
dex == nameIndex) { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } | 711 } |
| 712 | 712 |
| 713 EventTarget* CSSAnimations::AnimationEventDelegate::eventTarget() const | 713 EventTarget* CSSAnimations::AnimationEventDelegate::eventTarget() const |
| 714 { | 714 { |
| 715 return EventPath::eventTargetRespectingTargetRules(*m_animationTarget); | 715 return EventPath::eventTargetRespectingTargetRules(*m_animationTarget); |
| 716 } | 716 } |
| 717 | 717 |
| 718 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType
listenerType, const AtomicString& eventName, double elapsedTime) | 718 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType
listenerType, const AtomicString& eventName, double elapsedTime) |
| 719 { | 719 { |
| 720 if (m_animationTarget->document().hasListenerType(listenerType)) { | 720 if (m_animationTarget->document().hasListenerType(listenerType)) { |
| 721 RefPtrWillBeRawPtr<AnimationEvent> event = AnimationEvent::create(eventN
ame, m_name, elapsedTime); | 721 RawPtr<AnimationEvent> event = AnimationEvent::create(eventName, m_name,
elapsedTime); |
| 722 event->setTarget(eventTarget()); | 722 event->setTarget(eventTarget()); |
| 723 document().enqueueAnimationFrameEvent(event); | 723 document().enqueueAnimationFrameEvent(event); |
| 724 } | 724 } |
| 725 } | 725 } |
| 726 | 726 |
| 727 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat
ionEffect& animationNode) | 727 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat
ionEffect& animationNode) |
| 728 { | 728 { |
| 729 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER); | 729 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER); |
| 730 } | 730 } |
| 731 | 731 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 | 772 |
| 773 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff
ect& animationNode) | 773 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff
ect& animationNode) |
| 774 { | 774 { |
| 775 const AnimationEffect::Phase currentPhase = animationNode.phase(); | 775 const AnimationEffect::Phase currentPhase = animationNode.phase(); |
| 776 if (currentPhase == AnimationEffect::PhaseAfter && currentPhase != m_previou
sPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { | 776 if (currentPhase == AnimationEffect::PhaseAfter && currentPhase != m_previou
sPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { |
| 777 String propertyName = getPropertyNameString(m_property); | 777 String propertyName = getPropertyNameString(m_property); |
| 778 const Timing& timing = animationNode.specifiedTiming(); | 778 const Timing& timing = animationNode.specifiedTiming(); |
| 779 double elapsedTime = timing.iterationDuration; | 779 double elapsedTime = timing.iterationDuration; |
| 780 const AtomicString& eventType = EventTypeNames::transitionend; | 780 const AtomicString& eventType = EventTypeNames::transitionend; |
| 781 String pseudoElement = PseudoElement::pseudoElementNameForEvents(pseudoI
d()); | 781 String pseudoElement = PseudoElement::pseudoElementNameForEvents(pseudoI
d()); |
| 782 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even
tType, propertyName, elapsedTime, pseudoElement); | 782 RawPtr<TransitionEvent> event = TransitionEvent::create(eventType, prope
rtyName, elapsedTime, pseudoElement); |
| 783 event->setTarget(eventTarget()); | 783 event->setTarget(eventTarget()); |
| 784 document().enqueueAnimationFrameEvent(event); | 784 document().enqueueAnimationFrameEvent(event); |
| 785 } | 785 } |
| 786 | 786 |
| 787 m_previousPhase = currentPhase; | 787 m_previousPhase = currentPhase; |
| 788 } | 788 } |
| 789 | 789 |
| 790 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate) | 790 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate) |
| 791 { | 791 { |
| 792 visitor->trace(m_transitionTarget); | 792 visitor->trace(m_transitionTarget); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 842 } |
| 843 | 843 |
| 844 DEFINE_TRACE(CSSAnimations) | 844 DEFINE_TRACE(CSSAnimations) |
| 845 { | 845 { |
| 846 visitor->trace(m_transitions); | 846 visitor->trace(m_transitions); |
| 847 visitor->trace(m_pendingUpdate); | 847 visitor->trace(m_pendingUpdate); |
| 848 visitor->trace(m_runningAnimations); | 848 visitor->trace(m_runningAnimations); |
| 849 } | 849 } |
| 850 | 850 |
| 851 } // namespace blink | 851 } // namespace blink |
| OLD | NEW |