| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef CSSAnimations_h | 31 #ifndef CSSAnimations_h |
| 32 #define CSSAnimations_h | 32 #define CSSAnimations_h |
| 33 | 33 |
| 34 #include "core/animation/InertEffect.h" | 34 #include "core/animation/InertEffect.h" |
| 35 #include "core/animation/Interpolation.h" | 35 #include "core/animation/Interpolation.h" |
| 36 #include "core/animation/css/CSSAnimationData.h" | 36 #include "core/animation/css/CSSAnimationData.h" |
| 37 #include "core/animation/css/CSSAnimationUpdate.h" | 37 #include "core/animation/css/CSSAnimationUpdate.h" |
| 38 #include "core/css/CSSKeyframesRule.h" | 38 #include "core/css/CSSKeyframesRule.h" |
| 39 #include "core/css/StylePropertySet.h" | 39 #include "core/css/StylePropertySet.h" |
| 40 #include "core/css/resolver/StyleResolverState.h" |
| 40 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 41 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
| 42 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 43 #include "wtf/text/AtomicString.h" | 44 #include "wtf/text/AtomicString.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 class CSSTransitionData; | 48 class CSSTransitionData; |
| 48 class Element; | 49 class Element; |
| 49 class StylePropertyShorthand; | 50 class StylePropertyShorthand; |
| 50 class StyleResolver; | 51 class StyleResolver; |
| 51 | 52 |
| 52 class CSSAnimations final { | 53 class CSSAnimations final { |
| 53 WTF_MAKE_NONCOPYABLE(CSSAnimations); | 54 WTF_MAKE_NONCOPYABLE(CSSAnimations); |
| 54 DISALLOW_ALLOCATION(); | 55 DISALLOW_ALLOCATION(); |
| 55 public: | 56 public: |
| 56 CSSAnimations(); | 57 CSSAnimations(); |
| 57 | 58 |
| 58 bool isAnimationForInspector(const Animation&); | 59 bool isAnimationForInspector(const Animation&); |
| 59 bool isTransitionAnimationForInspector(const Animation&) const; | 60 bool isTransitionAnimationForInspector(const Animation&) const; |
| 60 | 61 |
| 61 static const StylePropertyShorthand& propertiesForTransitionAll(); | 62 static const StylePropertyShorthand& propertiesForTransitionAll(); |
| 62 static bool isAnimatableProperty(CSSPropertyID); | 63 static bool isAnimatableProperty(CSSPropertyID); |
| 63 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem
ent* animatingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyl
e, StyleResolver*); | 64 static void calculateUpdate(const Element* animatingElement, Element&, Style
ResolverState&, StyleResolver*); |
| 64 | 65 |
| 65 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m
_pendingUpdate = update; } | 66 void setPendingUpdate(const CSSAnimationUpdate& update) |
| 67 { |
| 68 clearPendingUpdate(); |
| 69 m_pendingUpdate.setPendingUpdate(update); |
| 70 } |
| 71 void clearPendingUpdate() |
| 72 { |
| 73 m_pendingUpdate.clear(); |
| 74 } |
| 66 void maybeApplyPendingUpdate(Element*); | 75 void maybeApplyPendingUpdate(Element*); |
| 67 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && !m_pendingUpdate; } | 76 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && m_pendingUpdate.isEmpty(); } |
| 68 void cancel(); | 77 void cancel(); |
| 69 | 78 |
| 70 DECLARE_TRACE(); | 79 DECLARE_TRACE(); |
| 71 | 80 |
| 72 private: | 81 private: |
| 73 class RunningAnimation final : public RefCountedWillBeGarbageCollectedFinali
zed<RunningAnimation> { | 82 class RunningAnimation final : public RefCountedWillBeGarbageCollectedFinali
zed<RunningAnimation> { |
| 74 public: | 83 public: |
| 75 RunningAnimation(PassRefPtrWillBeRawPtr<Animation> animation, CSSAnimati
onUpdate::NewAnimation newAnimation) | 84 RunningAnimation(PassRefPtrWillBeRawPtr<Animation> animation, CSSAnimati
onUpdate::NewAnimation newAnimation) |
| 76 : animation(animation) | 85 : animation(animation) |
| 77 , specifiedTiming(newAnimation.timing) | 86 , specifiedTiming(newAnimation.timing) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 RawPtrWillBeMember<const AnimatableValue> from; | 122 RawPtrWillBeMember<const AnimatableValue> from; |
| 114 RawPtrWillBeMember<const AnimatableValue> to; | 123 RawPtrWillBeMember<const AnimatableValue> to; |
| 115 }; | 124 }; |
| 116 | 125 |
| 117 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Runn
ingAnimation>>; | 126 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Runn
ingAnimation>>; |
| 118 AnimationMap m_animations; | 127 AnimationMap m_animations; |
| 119 | 128 |
| 120 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; | 129 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; |
| 121 TransitionMap m_transitions; | 130 TransitionMap m_transitions; |
| 122 | 131 |
| 123 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate; | 132 PendingAnimationUpdate m_pendingUpdate; |
| 124 | 133 |
| 125 ActiveInterpolationMap m_previousActiveInterpolationsForAnimations; | 134 ActiveInterpolationMap m_previousActiveInterpolationsForAnimations; |
| 126 | 135 |
| 127 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani
matingElement, Element&, const ComputedStyle&, ComputedStyle* parentStyle, Style
Resolver*); | 136 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&); | 137 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*); | 138 static void calculateTransitionUpdateForProperty(CSSPropertyID, const CSSTra
nsitionData&, size_t transitionIndex, const ComputedStyle& oldStyle, const Compu
tedStyle&, const TransitionMap* activeTransitions, CSSAnimationUpdate&, const El
ement*); |
| 130 | 139 |
| 131 static void calculateAnimationActiveInterpolations(CSSAnimationUpdate*, cons
t Element* animatingElement, double timelineCurrentTime); | 140 static void calculateAnimationActiveInterpolations(CSSAnimationUpdate&, cons
t Element* animatingElement, double timelineCurrentTime); |
| 132 static void calculateTransitionActiveInterpolations(CSSAnimationUpdate*, con
st Element* animatingElement, double timelineCurrentTime); | 141 static void calculateTransitionActiveInterpolations(CSSAnimationUpdate&, con
st Element* animatingElement, double timelineCurrentTime); |
| 133 | 142 |
| 134 class AnimationEventDelegate final : public AnimationEffect::EventDelegate { | 143 class AnimationEventDelegate final : public AnimationEffect::EventDelegate { |
| 135 public: | 144 public: |
| 136 AnimationEventDelegate(Element* animationTarget, const AtomicString& nam
e) | 145 AnimationEventDelegate(Element* animationTarget, const AtomicString& nam
e) |
| 137 : m_animationTarget(animationTarget) | 146 : m_animationTarget(animationTarget) |
| 138 , m_name(name) | 147 , m_name(name) |
| 139 , m_previousPhase(AnimationEffect::PhaseNone) | 148 , m_previousPhase(AnimationEffect::PhaseNone) |
| 140 , m_previousIteration(nullValue()) | 149 , m_previousIteration(nullValue()) |
| 141 { | 150 { |
| 142 } | 151 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 185 |
| 177 RawPtrWillBeMember<Element> m_transitionTarget; | 186 RawPtrWillBeMember<Element> m_transitionTarget; |
| 178 const CSSPropertyID m_property; | 187 const CSSPropertyID m_property; |
| 179 AnimationEffect::Phase m_previousPhase; | 188 AnimationEffect::Phase m_previousPhase; |
| 180 }; | 189 }; |
| 181 }; | 190 }; |
| 182 | 191 |
| 183 } // namespace blink | 192 } // namespace blink |
| 184 | 193 |
| 185 #endif | 194 #endif |
| OLD | NEW |