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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/animation/Animation.h" | 32 #include "core/animation/Animation.h" |
33 | 33 |
34 #include "bindings/v8/Dictionary.h" | 34 #include "bindings/v8/Dictionary.h" |
35 #include "core/animation/ActiveAnimations.h" | 35 #include "core/animation/ActiveAnimations.h" |
36 #include "core/animation/AnimationHelpers.h" | 36 #include "core/animation/AnimationHelpers.h" |
37 #include "core/animation/CompositorAnimations.h" | 37 #include "core/animation/CompositorAnimations.h" |
38 #include "core/animation/DocumentTimeline.h" | 38 #include "core/animation/DocumentTimeline.h" |
| 39 #include "core/animation/Interpolation.h" |
39 #include "core/animation/KeyframeEffectModel.h" | 40 #include "core/animation/KeyframeEffectModel.h" |
40 #include "core/animation/Player.h" | 41 #include "core/animation/Player.h" |
41 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
42 #include "core/rendering/RenderLayer.h" | 43 #include "core/rendering/RenderLayer.h" |
43 | 44 |
44 namespace WebCore { | 45 namespace WebCore { |
45 | 46 |
46 PassRefPtr<Animation> Animation::create(PassRefPtr<Element> target, PassRefPtrWi
llBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pas
sOwnPtr<EventDelegate> eventDelegate) | 47 PassRefPtr<Animation> Animation::create(PassRefPtr<Element> target, PassRefPtrWi
llBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pas
sOwnPtr<EventDelegate> eventDelegate) |
47 { | 48 { |
48 return adoptRef(new Animation(target, effect, timing, priority, eventDelegat
e)); | 49 return adoptRef(new Animation(target, effect, timing, priority, eventDelegat
e)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return; | 115 return; |
115 | 116 |
116 if (player() && !previouslyInEffect) { | 117 if (player() && !previouslyInEffect) { |
117 ensureAnimationStack(m_target.get()).add(this); | 118 ensureAnimationStack(m_target.get()).add(this); |
118 m_activeInAnimationStack = true; | 119 m_activeInAnimationStack = true; |
119 } | 120 } |
120 | 121 |
121 double iteration = currentIteration(); | 122 double iteration = currentIteration(); |
122 ASSERT(iteration >= 0); | 123 ASSERT(iteration >= 0); |
123 // FIXME: Handle iteration values which overflow int. | 124 // FIXME: Handle iteration values which overflow int. |
124 m_compositableValues = m_effect->sample(static_cast<int>(iteration), timeFra
ction()); | 125 m_activeInterpolations = m_effect->sample(static_cast<int>(iteration), timeF
raction()); |
125 if (player()) | 126 if (player()) |
126 m_target->setNeedsAnimationStyleRecalc(); | 127 m_target->setNeedsAnimationStyleRecalc(); |
127 } | 128 } |
128 | 129 |
129 void Animation::clearEffects() | 130 void Animation::clearEffects() |
130 { | 131 { |
131 ASSERT(player()); | 132 ASSERT(player()); |
132 ASSERT(m_activeInAnimationStack); | 133 ASSERT(m_activeInAnimationStack); |
133 ensureAnimationStack(m_target.get()).remove(this); | 134 ensureAnimationStack(m_target.get()).remove(this); |
134 | 135 |
135 { | 136 { |
136 // FIXME: clearEffects is called from withins style recalc. | 137 // FIXME: clearEffects is called from withins style recalc. |
137 // This queries compositingState, which is not necessarily up to date. | 138 // This queries compositingState, which is not necessarily up to date. |
138 // https://code.google.com/p/chromium/issues/detail?id=339847 | 139 // https://code.google.com/p/chromium/issues/detail?id=339847 |
139 DisableCompositingQueryAsserts disabler; | 140 DisableCompositingQueryAsserts disabler; |
140 cancelAnimationOnCompositor(); | 141 cancelAnimationOnCompositor(); |
141 } | 142 } |
142 | 143 |
143 m_activeInAnimationStack = false; | 144 m_activeInAnimationStack = false; |
144 m_compositableValues.clear(); | 145 m_activeInterpolations.clear(); |
145 m_target->setNeedsAnimationStyleRecalc(); | 146 m_target->setNeedsAnimationStyleRecalc(); |
146 invalidate(); | 147 invalidate(); |
147 } | 148 } |
148 | 149 |
149 void Animation::updateChildrenAndEffects() const | 150 void Animation::updateChildrenAndEffects() const |
150 { | 151 { |
151 if (!m_effect) | 152 if (!m_effect) |
152 return; | 153 return; |
153 if (isInEffect()) | 154 if (isInEffect()) |
154 const_cast<Animation*>(this)->applyEffects(m_activeInAnimationStack); | 155 const_cast<Animation*>(this)->applyEffects(m_activeInAnimationStack); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) | 241 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) |
241 { | 242 { |
242 ASSERT(hasActiveAnimationsOnCompositor()); | 243 ASSERT(hasActiveAnimationsOnCompositor()); |
243 if (!m_target || !m_target->renderer()) | 244 if (!m_target || !m_target->renderer()) |
244 return; | 245 return; |
245 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) | 246 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) |
246 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target.get(), m_compositorAnimationIds[i], pauseTime); | 247 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(*
m_target.get(), m_compositorAnimationIds[i], pauseTime); |
247 } | 248 } |
248 | 249 |
249 } // namespace WebCore | 250 } // namespace WebCore |
OLD | NEW |