OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/animation/StringKeyframe.h" | 6 #include "core/animation/StringKeyframe.h" |
7 | 7 |
8 #include "core/animation/css/CSSAnimations.h" | 8 #include "core/animation/css/CSSAnimations.h" |
9 #include "core/animation/interpolation/DefaultStyleInterpolation.h" | 9 #include "core/animation/interpolation/DefaultStyleInterpolation.h" |
| 10 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h" |
10 #include "core/animation/interpolation/LegacyStyleInterpolation.h" | 11 #include "core/animation/interpolation/LegacyStyleInterpolation.h" |
11 #include "core/animation/interpolation/LengthStyleInterpolation.h" | 12 #include "core/animation/interpolation/LengthStyleInterpolation.h" |
12 #include "core/css/resolver/StyleResolver.h" | 13 #include "core/css/resolver/StyleResolver.h" |
13 #include "core/rendering/style/RenderStyle.h" | 14 #include "core/rendering/style/RenderStyle.h" |
14 | 15 |
15 namespace WebCore { | 16 namespace WebCore { |
16 | 17 |
17 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) | 18 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) |
18 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) | 19 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) |
19 , m_propertySet(copyFrom.m_propertySet->mutableCopy()) | 20 , m_propertySet(copyFrom.m_propertySet->mutableCopy()) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 case CSSPropertyTop: | 107 case CSSPropertyTop: |
107 case CSSPropertyVerticalAlign: | 108 case CSSPropertyVerticalAlign: |
108 case CSSPropertyWordSpacing: | 109 case CSSPropertyWordSpacing: |
109 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 110 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl
eInterpolation::canCreateFrom(*toCSSValue)) |
110 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, range); | 111 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, range); |
111 break; | 112 break; |
112 default: | 113 default: |
113 break; | 114 break; |
114 } | 115 } |
115 | 116 |
| 117 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fro
mCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolv
e(*toCSSValue)) |
| 118 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue
, property); |
| 119 |
116 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here
. | 120 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here
. |
117 // FIXME: Remove this cache | 121 // FIXME: Remove this cache |
118 if (!m_animatableValueCache) | 122 if (!m_animatableValueCache) |
119 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e
lement, property, fromCSSValue); | 123 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e
lement, property, *fromCSSValue); |
120 | 124 |
121 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu
eSnapshot(*element, property, toCSSValue); | 125 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu
eSnapshot(*element, property, *toCSSValue); |
122 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to; | 126 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to; |
123 | 127 |
124 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel
ease(), property); | 128 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel
ease(), property); |
125 } | 129 } |
126 | 130 |
127 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope
rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e
asing) const | 131 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope
rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e
asing) const |
128 { | 132 { |
129 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An
imationEffect::CompositeAdd)); | 133 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An
imationEffect::CompositeAdd)); |
130 } | 134 } |
131 | 135 |
132 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope
rtySpecificKeyframe::cloneWithOffset(double offset) const | 136 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope
rtySpecificKeyframe::cloneWithOffset(double offset) const |
133 { | 137 { |
134 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe(
offset, m_easing, m_value.get()); | 138 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe(
offset, m_easing, m_value.get()); |
135 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima
tableValueCache; | 139 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima
tableValueCache; |
136 return adoptPtrWillBeNoop(theClone); | 140 return adoptPtrWillBeNoop(theClone); |
137 } | 141 } |
138 | 142 |
139 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 143 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
140 { | 144 { |
141 visitor->trace(m_value); | 145 visitor->trace(m_value); |
142 visitor->trace(m_animatableValueCache); | 146 visitor->trace(m_animatableValueCache); |
143 Keyframe::PropertySpecificKeyframe::trace(visitor); | 147 Keyframe::PropertySpecificKeyframe::trace(visitor); |
144 } | 148 } |
145 | 149 |
146 } | 150 } |
OLD | NEW |