| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void setPendingUpdate(const CSSAnimationUpdate& update) | 66 void setPendingUpdate(const CSSAnimationUpdate& update) |
| 67 { | 67 { |
| 68 clearPendingUpdate(); | 68 clearPendingUpdate(); |
| 69 m_pendingUpdate.copy(update); | 69 m_pendingUpdate.copy(update); |
| 70 } | 70 } |
| 71 void clearPendingUpdate() | 71 void clearPendingUpdate() |
| 72 { | 72 { |
| 73 m_pendingUpdate.clear(); | 73 m_pendingUpdate.clear(); |
| 74 } | 74 } |
| 75 |
| 75 void maybeApplyPendingUpdate(Element*); | 76 void maybeApplyPendingUpdate(Element*); |
| 76 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && m_pendingUpdate.isEmpty(); } | 77 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && m_pendingUpdate.isEmpty(); } |
| 77 void cancel(); | 78 void cancel(); |
| 78 | 79 |
| 79 DECLARE_TRACE(); | 80 DECLARE_TRACE(); |
| 80 | 81 |
| 81 private: | 82 private: |
| 82 class RunningAnimation final : public RefCountedWillBeGarbageCollectedFinali
zed<RunningAnimation> { | 83 class RunningAnimation final : public GarbageCollectedFinalized<RunningAnima
tion> { |
| 83 public: | 84 public: |
| 84 RunningAnimation(PassRefPtrWillBeRawPtr<Animation> animation, CSSAnimati
onUpdate::NewAnimation newAnimation) | 85 RunningAnimation(Animation* animation, CSSAnimationUpdate::NewAnimation
newAnimation) |
| 85 : animation(animation) | 86 : animation(animation) |
| 86 , specifiedTiming(newAnimation.timing) | 87 , specifiedTiming(newAnimation.timing) |
| 87 , styleRule(newAnimation.styleRule) | 88 , styleRule(newAnimation.styleRule) |
| 88 , styleRuleVersion(newAnimation.styleRuleVersion) | 89 , styleRuleVersion(newAnimation.styleRuleVersion) |
| 89 { | 90 { |
| 90 } | 91 } |
| 92 ~RunningAnimation() |
| 93 { |
| 94 } |
| 91 | 95 |
| 92 void update(CSSAnimationUpdate::UpdatedAnimation update) | 96 void update(CSSAnimationUpdate::UpdatedAnimation update) |
| 93 { | 97 { |
| 94 styleRule = update.styleRule; | 98 styleRule = update.styleRule; |
| 95 styleRuleVersion = update.styleRuleVersion; | 99 styleRuleVersion = update.styleRuleVersion; |
| 96 specifiedTiming = update.specifiedTiming; | 100 specifiedTiming = update.specifiedTiming; |
| 97 } | 101 } |
| 98 | 102 |
| 99 DEFINE_INLINE_TRACE() | 103 DEFINE_INLINE_TRACE() |
| 100 { | 104 { |
| 101 visitor->trace(animation); | 105 visitor->trace(animation); |
| 102 visitor->trace(styleRule); | 106 visitor->trace(styleRule); |
| 103 } | 107 } |
| 104 | 108 |
| 105 RefPtrWillBeMember<Animation> animation; | 109 Member<Animation> animation; |
| 106 Timing specifiedTiming; | 110 Timing specifiedTiming; |
| 107 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; | 111 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
| 108 unsigned styleRuleVersion; | 112 unsigned styleRuleVersion; |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 struct RunningTransition { | 115 struct RunningTransition { |
| 112 ALLOW_ONLY_INLINE_ALLOCATION(); | 116 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 113 public: | 117 public: |
| 114 DEFINE_INLINE_TRACE() | 118 DEFINE_INLINE_TRACE() |
| 115 { | 119 { |
| 116 visitor->trace(animation); | 120 visitor->trace(animation); |
| 117 visitor->trace(from); | 121 visitor->trace(from); |
| 118 visitor->trace(to); | 122 visitor->trace(to); |
| 119 } | 123 } |
| 120 | 124 |
| 121 RefPtrWillBeMember<Animation> animation; | 125 Member<Animation> animation; |
| 122 RawPtrWillBeMember<const AnimatableValue> from; | 126 Member<const AnimatableValue> from; |
| 123 RawPtrWillBeMember<const AnimatableValue> to; | 127 Member<const AnimatableValue> to; |
| 124 }; | 128 }; |
| 125 | 129 |
| 126 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Runn
ingAnimation>>; | 130 using AnimationMap = HeapHashMap<AtomicString, Member<RunningAnimation>>; |
| 127 AnimationMap m_animations; | 131 AnimationMap m_animations; |
| 128 | 132 |
| 129 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; | 133 using TransitionMap = HeapHashMap<CSSPropertyID, RunningTransition>; |
| 130 TransitionMap m_transitions; | 134 TransitionMap m_transitions; |
| 131 | 135 |
| 132 CSSAnimationUpdate m_pendingUpdate; | 136 CSSAnimationUpdate m_pendingUpdate; |
| 133 | 137 |
| 134 ActiveInterpolationMap m_previousActiveInterpolationsForAnimations; | 138 ActiveInterpolationMap m_previousActiveInterpolationsForAnimations; |
| 135 | 139 |
| 136 static void calculateAnimationUpdate(CSSAnimationUpdate&, const Element* ani
matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style
Resolver*); | 140 static void calculateAnimationUpdate(CSSAnimationUpdate&, const Element* ani
matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style
Resolver*); |
| 137 static void calculateTransitionUpdate(CSSAnimationUpdate&, const Element* an
imatingElement, const ComputedStyle&); | 141 static void calculateTransitionUpdate(CSSAnimationUpdate&, const Element* an
imatingElement, const ComputedStyle&); |
| 138 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSTra
nsitionData&, size_t transitionIndex, const ComputedStyle& oldStyle, const Compu
tedStyle&, const TransitionMap* activeTransitions, CSSAnimationUpdate&, const El
ement*); | 142 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSTra
nsitionData&, size_t transitionIndex, const ComputedStyle& oldStyle, const Compu
tedStyle&, const TransitionMap* activeTransitions, CSSAnimationUpdate&, const El
ement*); |
| 139 | 143 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 189 |
| 186 RawPtrWillBeMember<Element> m_transitionTarget; | 190 RawPtrWillBeMember<Element> m_transitionTarget; |
| 187 const CSSPropertyID m_property; | 191 const CSSPropertyID m_property; |
| 188 AnimationEffect::Phase m_previousPhase; | 192 AnimationEffect::Phase m_previousPhase; |
| 189 }; | 193 }; |
| 190 }; | 194 }; |
| 191 | 195 |
| 192 } // namespace blink | 196 } // namespace blink |
| 193 | 197 |
| 194 #endif | 198 #endif |
| OLD | NEW |