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 14 matching lines...) Expand all Loading... | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef CSSAnimations_h | 31 #ifndef CSSAnimations_h |
| 32 #define CSSAnimations_h | 32 #define CSSAnimations_h |
| 33 | 33 |
| 34 #include "core/animation/InertAnimation.h" | 34 #include "core/animation/InertAnimation.h" |
| 35 #include "core/animation/Interpolation.h" | |
| 36 #include "core/animation/css/CSSAnimationData.h" | |
| 35 #include "core/animation/css/CSSAnimationUpdate.h" | 37 #include "core/animation/css/CSSAnimationUpdate.h" |
| 38 #include "core/css/CSSKeyframesRule.h" | |
| 36 #include "core/css/StylePropertySet.h" | 39 #include "core/css/StylePropertySet.h" |
| 37 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 38 #include "wtf/HashMap.h" | 41 #include "wtf/HashMap.h" |
| 39 #include "wtf/text/AtomicString.h" | 42 #include "wtf/text/AtomicString.h" |
| 40 | 43 |
| 41 namespace blink { | 44 namespace blink { |
| 42 | 45 |
| 43 class CSSTransitionData; | 46 class CSSTransitionData; |
| 44 class Element; | 47 class Element; |
| 45 class StylePropertyShorthand; | 48 class StylePropertyShorthand; |
| 46 class StyleResolver; | 49 class StyleResolver; |
| 47 class StyleRuleKeyframes; | |
| 48 | 50 |
| 49 class CSSAnimations final { | 51 class CSSAnimations final { |
| 50 WTF_MAKE_NONCOPYABLE(CSSAnimations); | 52 WTF_MAKE_NONCOPYABLE(CSSAnimations); |
| 51 DISALLOW_ALLOCATION(); | 53 DISALLOW_ALLOCATION(); |
| 52 public: | 54 public: |
| 53 CSSAnimations(); | 55 CSSAnimations(); |
| 54 | 56 |
| 55 const AtomicString getAnimationNameForInspector(const AnimationPlayer&); | 57 const AtomicString getAnimationNameForInspector(const AnimationPlayer&); |
| 56 | 58 |
| 57 static const StylePropertyShorthand& animatableProperties(); | 59 static const StylePropertyShorthand& animatableProperties(); |
| 58 static bool isAllowedAnimation(CSSPropertyID); | 60 static bool isAllowedAnimation(CSSPropertyID); |
| 59 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem ent* animatingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, S tyleResolver*); | 61 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem ent* animatingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, S tyleResolver*); |
| 60 | 62 |
| 61 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m _pendingUpdate = update; } | 63 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m _pendingUpdate = update; } |
| 62 void maybeApplyPendingUpdate(Element*); | 64 void maybeApplyPendingUpdate(Element*); |
| 63 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } | 65 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } |
| 64 void cancel(); | 66 void cancel(); |
| 65 | 67 |
| 66 void trace(Visitor*); | 68 void trace(Visitor*); |
| 67 | 69 |
| 68 private: | 70 private: |
| 71 struct RunningAnimation { | |
| 72 ALLOW_ONLY_INLINE_ALLOCATION(); | |
| 73 public: | |
| 74 void trace(Visitor* visitor) | |
| 75 { | |
| 76 visitor->trace(player); | |
| 77 } | |
| 78 | |
| 79 RefPtrWillBeMember<AnimationPlayer> player; | |
| 80 Timing specifiedTiming; | |
| 81 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; | |
| 82 unsigned styleChangeCounter; | |
|
esprehn
2015/01/29 04:23:19
constructor needs to set this to 0
shend
2015/01/30 00:03:10
Done.
| |
| 83 }; | |
| 84 | |
| 69 struct RunningTransition { | 85 struct RunningTransition { |
| 70 ALLOW_ONLY_INLINE_ALLOCATION(); | 86 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 71 public: | 87 public: |
| 72 void trace(Visitor* visitor) | 88 void trace(Visitor* visitor) |
| 73 { | 89 { |
| 74 visitor->trace(player); | 90 visitor->trace(player); |
| 75 visitor->trace(from); | 91 visitor->trace(from); |
| 76 visitor->trace(to); | 92 visitor->trace(to); |
| 77 } | 93 } |
| 78 | 94 |
| 79 RefPtrWillBeMember<AnimationPlayer> player; | 95 RefPtrWillBeMember<AnimationPlayer> player; |
| 80 RawPtrWillBeMember<const AnimatableValue> from; | 96 RawPtrWillBeMember<const AnimatableValue> from; |
| 81 RawPtrWillBeMember<const AnimatableValue> to; | 97 RawPtrWillBeMember<const AnimatableValue> to; |
| 82 }; | 98 }; |
| 83 | 99 |
| 84 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Anim ationPlayer>>; | 100 using AnimationMap = WillBeHeapHashMap<AtomicString, RunningAnimation>; |
| 85 AnimationMap m_animations; | 101 AnimationMap m_animations; |
| 86 | 102 |
| 87 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; | 103 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; |
| 88 TransitionMap m_transitions; | 104 TransitionMap m_transitions; |
| 89 | 105 |
| 90 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate; | 106 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate; |
| 91 | 107 |
| 92 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> m_previo usActiveInterpolationsForAnimations; | 108 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> m_previo usActiveInterpolationsForAnimations; |
| 93 | 109 |
| 94 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani matingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, StyleReso lver*); | 110 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani matingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, StyleReso lver*); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 private: | 150 private: |
| 135 RawPtrWillBeMember<Element> m_target; | 151 RawPtrWillBeMember<Element> m_target; |
| 136 const CSSPropertyID m_property; | 152 const CSSPropertyID m_property; |
| 137 AnimationNode::Phase m_previousPhase; | 153 AnimationNode::Phase m_previousPhase; |
| 138 }; | 154 }; |
| 139 }; | 155 }; |
| 140 | 156 |
| 141 } // namespace blink | 157 } // namespace blink |
| 142 | 158 |
| 143 #endif | 159 #endif |
| OLD | NEW |