| 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 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/animation/KeyframeEffectModel.h" | 32 #include "core/animation/KeyframeEffectModel.h" |
| 33 | 33 |
| 34 #include "core/StylePropertyShorthand.h" | 34 #include "core/StylePropertyShorthand.h" |
| 35 #include "core/animation/AnimationNode.h" | 35 #include "core/animation/AnimationEffect.h" |
| 36 #include "core/animation/CompositorAnimations.h" | 36 #include "core/animation/CompositorAnimations.h" |
| 37 #include "core/animation/css/CSSAnimatableValueFactory.h" | 37 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 38 #include "core/animation/css/CSSPropertyEquality.h" | 38 #include "core/animation/css/CSSPropertyEquality.h" |
| 39 #include "core/css/resolver/StyleResolver.h" | 39 #include "core/css/resolver/StyleResolver.h" |
| 40 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 41 #include "platform/animation/AnimationUtilities.h" | 41 #include "platform/animation/AnimationUtilities.h" |
| 42 #include "platform/geometry/FloatBox.h" | 42 #include "platform/geometry/FloatBox.h" |
| 43 #include "platform/transforms/TransformationMatrix.h" | 43 #include "platform/transforms/TransformationMatrix.h" |
| 44 #include "wtf/text/StringHash.h" | 44 #include "wtf/text/StringHash.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 PropertyHandleSet KeyframeEffectModelBase::properties() const | 48 PropertyHandleSet KeyframeEffectModelBase::properties() const |
| 49 { | 49 { |
| 50 PropertyHandleSet result; | 50 PropertyHandleSet result; |
| 51 for (const auto& keyframe : m_keyframes) { | 51 for (const auto& keyframe : m_keyframes) { |
| 52 for (const auto& property : keyframe->properties()) | 52 for (const auto& property : keyframe->properties()) |
| 53 result.add(property); | 53 result.add(property); |
| 54 } | 54 } |
| 55 return result; | 55 return result; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void KeyframeEffectModelBase::setFrames(KeyframeVector& keyframes) | 58 void KeyframeEffectModelBase::setFrames(KeyframeVector& keyframes) |
| 59 { | 59 { |
| 60 // TODO(samli): Should also notify/invalidate the player | 60 // TODO(samli): Should also notify/invalidate the animation |
| 61 m_keyframes = keyframes; | 61 m_keyframes = keyframes; |
| 62 m_keyframeGroups = nullptr; | 62 m_keyframeGroups = nullptr; |
| 63 m_interpolationEffect = nullptr; | 63 m_interpolationEffect = nullptr; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void KeyframeEffectModelBase::sample(int iteration, double fraction, double iter
ationDuration, OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolat
ion>>>& result) const | 66 void KeyframeEffectModelBase::sample(int iteration, double fraction, double iter
ationDuration, OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolat
ion>>>& result) const |
| 67 { | 67 { |
| 68 ASSERT(iteration >= 0); | 68 ASSERT(iteration >= 0); |
| 69 ASSERT(!isNull(fraction)); | 69 ASSERT(!isNull(fraction)); |
| 70 ensureKeyframeGroups(); | 70 ensureKeyframeGroups(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 m_interpolationEffect->addInterpolationsFromKeyframes(entry.key, ele
ment, baseStyle, *keyframes[i], *keyframes[i + 1], applyFrom, applyTo); | 203 m_interpolationEffect->addInterpolationsFromKeyframes(entry.key, ele
ment, baseStyle, *keyframes[i], *keyframes[i + 1], applyFrom, applyTo); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool KeyframeEffectModelBase::isReplaceOnly() | 208 bool KeyframeEffectModelBase::isReplaceOnly() |
| 209 { | 209 { |
| 210 ensureKeyframeGroups(); | 210 ensureKeyframeGroups(); |
| 211 for (const auto& entry : *m_keyframeGroups) { | 211 for (const auto& entry : *m_keyframeGroups) { |
| 212 for (const auto& keyframe : entry.value->keyframes()) { | 212 for (const auto& keyframe : entry.value->keyframes()) { |
| 213 if (keyframe->composite() != AnimationEffect::CompositeReplace) | 213 if (keyframe->composite() != EffectModel::CompositeReplace) |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 DEFINE_TRACE(KeyframeEffectModelBase) | 220 DEFINE_TRACE(KeyframeEffectModelBase) |
| 221 { | 221 { |
| 222 visitor->trace(m_keyframes); | 222 visitor->trace(m_keyframes); |
| 223 #if ENABLE(OILPAN) | 223 #if ENABLE(OILPAN) |
| 224 visitor->trace(m_keyframeGroups); | 224 visitor->trace(m_keyframeGroups); |
| 225 #endif | 225 #endif |
| 226 visitor->trace(m_interpolationEffect); | 226 visitor->trace(m_interpolationEffect); |
| 227 AnimationEffect::trace(visitor); | 227 EffectModel::trace(visitor); |
| 228 } | 228 } |
| 229 | 229 |
| 230 Keyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, Pass
RefPtr<TimingFunction> easing, AnimationEffect::CompositeOperation composite) | 230 Keyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, Pass
RefPtr<TimingFunction> easing, EffectModel::CompositeOperation composite) |
| 231 : m_offset(offset) | 231 : m_offset(offset) |
| 232 , m_easing(easing) | 232 , m_easing(easing) |
| 233 , m_composite(composite) | 233 , m_composite(composite) |
| 234 { | 234 { |
| 235 } | 235 } |
| 236 | 236 |
| 237 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::appendKeyframe(Pass
OwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> keyframe) | 237 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::appendKeyframe(Pass
OwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> keyframe) |
| 238 { | 238 { |
| 239 ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->of
fset()); | 239 ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->of
fset()); |
| 240 m_keyframes.append(keyframe); | 240 m_keyframes.append(keyframe); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 DEFINE_TRACE(KeyframeEffectModelBase::PropertySpecificKeyframeGroup) | 280 DEFINE_TRACE(KeyframeEffectModelBase::PropertySpecificKeyframeGroup) |
| 281 { | 281 { |
| 282 #if ENABLE(OILPAN) | 282 #if ENABLE(OILPAN) |
| 283 visitor->trace(m_keyframes); | 283 visitor->trace(m_keyframes); |
| 284 #endif | 284 #endif |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace | 287 } // namespace |
| OLD | NEW |