| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 } | 737 } |
| 738 | 738 |
| 739 EventTarget* CSSAnimations::AnimationEventDelegate::eventTarget() const | 739 EventTarget* CSSAnimations::AnimationEventDelegate::eventTarget() const |
| 740 { | 740 { |
| 741 return EventPath::eventTargetRespectingTargetRules(*m_animationTarget); | 741 return EventPath::eventTargetRespectingTargetRules(*m_animationTarget); |
| 742 } | 742 } |
| 743 | 743 |
| 744 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType
listenerType, const AtomicString& eventName, double elapsedTime) | 744 void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType
listenerType, const AtomicString& eventName, double elapsedTime) |
| 745 { | 745 { |
| 746 if (m_animationTarget->document().hasListenerType(listenerType)) { | 746 if (m_animationTarget->document().hasListenerType(listenerType)) { |
| 747 RefPtrWillBeRawPtr<AnimationEvent> event = AnimationEvent::create(eventN
ame, m_name, elapsedTime); | 747 RawPtr<AnimationEvent> event = AnimationEvent::create(eventName, m_name,
elapsedTime); |
| 748 event->setTarget(eventTarget()); | 748 event->setTarget(eventTarget()); |
| 749 document().enqueueAnimationFrameEvent(event); | 749 document().enqueueAnimationFrameEvent(event); |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 | 752 |
| 753 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat
ionEffect& animationNode) | 753 bool CSSAnimations::AnimationEventDelegate::requiresIterationEvents(const Animat
ionEffect& animationNode) |
| 754 { | 754 { |
| 755 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER); | 755 return document().hasListenerType(Document::ANIMATIONITERATION_LISTENER); |
| 756 } | 756 } |
| 757 | 757 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 798 |
| 799 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff
ect& animationNode) | 799 void CSSAnimations::TransitionEventDelegate::onEventCondition(const AnimationEff
ect& animationNode) |
| 800 { | 800 { |
| 801 const AnimationEffect::Phase currentPhase = animationNode.getPhase(); | 801 const AnimationEffect::Phase currentPhase = animationNode.getPhase(); |
| 802 if (currentPhase == AnimationEffect::PhaseAfter && currentPhase != m_previou
sPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { | 802 if (currentPhase == AnimationEffect::PhaseAfter && currentPhase != m_previou
sPhase && document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { |
| 803 String propertyName = getPropertyNameString(m_property); | 803 String propertyName = getPropertyNameString(m_property); |
| 804 const Timing& timing = animationNode.specifiedTiming(); | 804 const Timing& timing = animationNode.specifiedTiming(); |
| 805 double elapsedTime = timing.iterationDuration; | 805 double elapsedTime = timing.iterationDuration; |
| 806 const AtomicString& eventType = EventTypeNames::transitionend; | 806 const AtomicString& eventType = EventTypeNames::transitionend; |
| 807 String pseudoElement = PseudoElement::pseudoElementNameForEvents(getPseu
doId()); | 807 String pseudoElement = PseudoElement::pseudoElementNameForEvents(getPseu
doId()); |
| 808 RefPtrWillBeRawPtr<TransitionEvent> event = TransitionEvent::create(even
tType, propertyName, elapsedTime, pseudoElement); | 808 RawPtr<TransitionEvent> event = TransitionEvent::create(eventType, prope
rtyName, elapsedTime, pseudoElement); |
| 809 event->setTarget(eventTarget()); | 809 event->setTarget(eventTarget()); |
| 810 document().enqueueAnimationFrameEvent(event); | 810 document().enqueueAnimationFrameEvent(event); |
| 811 } | 811 } |
| 812 | 812 |
| 813 m_previousPhase = currentPhase; | 813 m_previousPhase = currentPhase; |
| 814 } | 814 } |
| 815 | 815 |
| 816 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate) | 816 DEFINE_TRACE(CSSAnimations::TransitionEventDelegate) |
| 817 { | 817 { |
| 818 visitor->trace(m_transitionTarget); | 818 visitor->trace(m_transitionTarget); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 } | 868 } |
| 869 | 869 |
| 870 DEFINE_TRACE(CSSAnimations) | 870 DEFINE_TRACE(CSSAnimations) |
| 871 { | 871 { |
| 872 visitor->trace(m_transitions); | 872 visitor->trace(m_transitions); |
| 873 visitor->trace(m_pendingUpdate); | 873 visitor->trace(m_pendingUpdate); |
| 874 visitor->trace(m_runningAnimations); | 874 visitor->trace(m_runningAnimations); |
| 875 } | 875 } |
| 876 | 876 |
| 877 } // namespace blink | 877 } // namespace blink |
| OLD | NEW |