Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 WTF_MAKE_NONCOPYABLE(CSSAnimations); | 53 WTF_MAKE_NONCOPYABLE(CSSAnimations); |
| 54 DISALLOW_ALLOCATION(); | 54 DISALLOW_ALLOCATION(); |
| 55 public: | 55 public: |
| 56 CSSAnimations(); | 56 CSSAnimations(); |
| 57 | 57 |
| 58 bool isAnimationForInspector(const Animation&); | 58 bool isAnimationForInspector(const Animation&); |
| 59 bool isTransitionAnimationForInspector(const Animation&) const; | 59 bool isTransitionAnimationForInspector(const Animation&) const; |
| 60 | 60 |
| 61 static const StylePropertyShorthand& propertiesForTransitionAll(); | 61 static const StylePropertyShorthand& propertiesForTransitionAll(); |
| 62 static bool isAllowedAnimation(CSSPropertyID); | 62 static bool isAllowedAnimation(CSSPropertyID); |
| 63 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem ent* animatingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyl e, StyleResolver*); | 63 static CSSAnimationUpdate* calculateUpdate(const Element* animatingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, StyleResolver*); |
| 64 | 64 |
| 65 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m _pendingUpdate = update; } | 65 void setPendingUpdate(CSSAnimationUpdate* update) { m_pendingUpdate = update ; } |
| 66 void maybeApplyPendingUpdate(Element*); | 66 void maybeApplyPendingUpdate(Element*); |
| 67 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } | 67 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } |
| 68 void cancel(); | 68 void cancel(); |
| 69 | 69 |
| 70 DECLARE_TRACE(); | 70 DECLARE_TRACE(); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 class RunningAnimation final : public RefCountedWillBeGarbageCollectedFinali zed<RunningAnimation> { | 73 class RunningAnimation final : public GarbageCollectedFinalized<RunningAnima tion> { |
| 74 public: | 74 public: |
| 75 RunningAnimation(PassRefPtrWillBeRawPtr<Animation> animation, CSSAnimati onUpdate::NewAnimation newAnimation) | 75 RunningAnimation(Animation* animation, CSSAnimationUpdate::NewAnimation newAnimation) |
| 76 : animation(animation) | 76 : animation(animation) |
| 77 , specifiedTiming(newAnimation.timing) | 77 , specifiedTiming(newAnimation.timing) |
| 78 , styleRule(newAnimation.styleRule) | 78 , styleRule(newAnimation.styleRule) |
| 79 , styleRuleVersion(newAnimation.styleRuleVersion) | 79 , styleRuleVersion(newAnimation.styleRuleVersion) |
| 80 { | 80 { |
| 81 } | 81 } |
| 82 ~RunningAnimation() { } | |
|
sof
2015/05/30 11:34:05
Define it out-of-line?
peria
2015/06/01 04:43:02
Done.
| |
| 82 | 83 |
| 83 void update(CSSAnimationUpdate::UpdatedAnimation update) | 84 void update(CSSAnimationUpdate::UpdatedAnimation update) |
| 84 { | 85 { |
| 85 styleRule = update.styleRule; | 86 styleRule = update.styleRule; |
| 86 styleRuleVersion = update.styleRuleVersion; | 87 styleRuleVersion = update.styleRuleVersion; |
| 87 specifiedTiming = update.specifiedTiming; | 88 specifiedTiming = update.specifiedTiming; |
| 88 } | 89 } |
| 89 | 90 |
| 90 DEFINE_INLINE_TRACE() | 91 DEFINE_INLINE_TRACE() |
| 91 { | 92 { |
| 92 visitor->trace(animation); | 93 visitor->trace(animation); |
| 93 visitor->trace(styleRule); | 94 visitor->trace(styleRule); |
| 94 } | 95 } |
| 95 | 96 |
| 96 RefPtrWillBeMember<Animation> animation; | 97 Member<Animation> animation; |
| 97 Timing specifiedTiming; | 98 Timing specifiedTiming; |
| 98 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; | 99 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
| 99 unsigned styleRuleVersion; | 100 unsigned styleRuleVersion; |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 struct RunningTransition { | 103 struct RunningTransition { |
| 103 ALLOW_ONLY_INLINE_ALLOCATION(); | 104 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 104 public: | 105 public: |
| 105 DEFINE_INLINE_TRACE() | 106 DEFINE_INLINE_TRACE() |
| 106 { | 107 { |
| 107 visitor->trace(animation); | 108 visitor->trace(animation); |
| 108 visitor->trace(from); | 109 visitor->trace(from); |
| 109 visitor->trace(to); | 110 visitor->trace(to); |
| 110 } | 111 } |
| 111 | 112 |
| 112 RefPtrWillBeMember<Animation> animation; | 113 Member<Animation> animation; |
| 113 RawPtrWillBeMember<const AnimatableValue> from; | 114 Member<const AnimatableValue> from; |
| 114 RawPtrWillBeMember<const AnimatableValue> to; | 115 Member<const AnimatableValue> to; |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Runn ingAnimation>>; | 118 using AnimationMap = HeapHashMap<AtomicString, Member<RunningAnimation>>; |
| 118 AnimationMap m_animations; | 119 AnimationMap m_animations; |
| 119 | 120 |
| 120 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; | 121 using TransitionMap = HeapHashMap<CSSPropertyID, RunningTransition>; |
| 121 TransitionMap m_transitions; | 122 TransitionMap m_transitions; |
| 122 | 123 |
| 123 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate; | 124 Member<CSSAnimationUpdate> m_pendingUpdate; |
| 124 | 125 |
| 125 ActiveInterpolationMap m_previousActiveInterpolationsForAnimations; | 126 ActiveInterpolationMap m_previousActiveInterpolationsForAnimations; |
| 126 | 127 |
| 127 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style Resolver*); | 128 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style Resolver*); |
| 128 static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element* an imatingElement, const ComputedStyle&); | 129 static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element* an imatingElement, const ComputedStyle&); |
| 129 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSTra nsitionData&, size_t transitionIndex, const ComputedStyle& oldStyle, const Compu tedStyle&, const TransitionMap* activeTransitions, CSSAnimationUpdate*, const El ement*); | 130 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSTra nsitionData&, size_t transitionIndex, const ComputedStyle& oldStyle, const Compu tedStyle&, const TransitionMap* activeTransitions, CSSAnimationUpdate*, const El ement*); |
| 130 | 131 |
| 131 static void calculateAnimationActiveInterpolations(CSSAnimationUpdate*, cons t Element* animatingElement, double timelineCurrentTime); | 132 static void calculateAnimationActiveInterpolations(CSSAnimationUpdate*, cons t Element* animatingElement, double timelineCurrentTime); |
| 132 static void calculateTransitionActiveInterpolations(CSSAnimationUpdate*, con st Element* animatingElement, double timelineCurrentTime); | 133 static void calculateTransitionActiveInterpolations(CSSAnimationUpdate*, con st Element* animatingElement, double timelineCurrentTime); |
| 133 | 134 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 | 177 |
| 177 RawPtrWillBeMember<Element> m_transitionTarget; | 178 RawPtrWillBeMember<Element> m_transitionTarget; |
| 178 const CSSPropertyID m_property; | 179 const CSSPropertyID m_property; |
| 179 AnimationEffect::Phase m_previousPhase; | 180 AnimationEffect::Phase m_previousPhase; |
| 180 }; | 181 }; |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 } // namespace blink | 184 } // namespace blink |
| 184 | 185 |
| 185 #endif | 186 #endif |
| OLD | NEW |