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/ColorStyleInterpolation.h" | 8 #include "core/animation/ColorStyleInterpolation.h" |
9 #include "core/animation/ConstantStyleInterpolation.h" | 9 #include "core/animation/ConstantStyleInterpolation.h" |
10 #include "core/animation/DefaultStyleInterpolation.h" | 10 #include "core/animation/DefaultStyleInterpolation.h" |
11 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 11 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
12 #include "core/animation/DoubleStyleInterpolation.h" | 12 #include "core/animation/DoubleStyleInterpolation.h" |
13 #include "core/animation/ImageStyleInterpolation.h" | 13 #include "core/animation/ImageStyleInterpolation.h" |
14 #include "core/animation/LegacyStyleInterpolation.h" | 14 #include "core/animation/LegacyStyleInterpolation.h" |
15 #include "core/animation/LengthBoxStyleInterpolation.h" | 15 #include "core/animation/LengthBoxStyleInterpolation.h" |
16 #include "core/animation/LengthPairStyleInterpolation.h" | 16 #include "core/animation/LengthPairStyleInterpolation.h" |
17 #include "core/animation/LengthPoint3DStyleInterpolation.h" | |
18 #include "core/animation/LengthStyleInterpolation.h" | 17 #include "core/animation/LengthStyleInterpolation.h" |
| 18 #include "core/animation/ListStyleInterpolation.h" |
19 #include "core/animation/SVGLengthStyleInterpolation.h" | 19 #include "core/animation/SVGLengthStyleInterpolation.h" |
| 20 #include "core/animation/ShadowStyleInterpolation.h" |
20 #include "core/animation/VisibilityStyleInterpolation.h" | 21 #include "core/animation/VisibilityStyleInterpolation.h" |
21 #include "core/animation/css/CSSAnimations.h" | 22 #include "core/animation/css/CSSAnimations.h" |
22 #include "core/css/CSSPropertyMetadata.h" | 23 #include "core/css/CSSPropertyMetadata.h" |
23 #include "core/css/resolver/StyleResolver.h" | 24 #include "core/css/resolver/StyleResolver.h" |
24 #include "core/rendering/style/RenderStyle.h" | 25 #include "core/rendering/style/RenderStyle.h" |
25 | 26 |
26 namespace blink { | 27 namespace blink { |
27 | 28 |
28 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) | 29 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) |
29 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) | 30 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 break; | 208 break; |
208 case CSSPropertyBorderBottomLeftRadius: | 209 case CSSPropertyBorderBottomLeftRadius: |
209 case CSSPropertyBorderBottomRightRadius: | 210 case CSSPropertyBorderBottomRightRadius: |
210 case CSSPropertyBorderTopLeftRadius: | 211 case CSSPropertyBorderTopLeftRadius: |
211 case CSSPropertyBorderTopRightRadius: | 212 case CSSPropertyBorderTopRightRadius: |
212 range = RangeNonNegative; | 213 range = RangeNonNegative; |
213 // Fall through | 214 // Fall through |
214 case CSSPropertyObjectPosition: | 215 case CSSPropertyObjectPosition: |
215 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length
PairStyleInterpolation::canCreateFrom(*toCSSValue)) | 216 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length
PairStyleInterpolation::canCreateFrom(*toCSSValue)) |
216 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal
ue, property, range); | 217 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal
ue, property, range); |
| 218 break; |
217 | 219 |
218 // FIXME: Handle CSSValueLists. | 220 case CSSPropertyPerspectiveOrigin: |
| 221 case CSSPropertyTransformOrigin: { |
| 222 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty, range); |
| 223 if (interpolation) |
| 224 return interpolation.release(); |
| 225 break; |
| 226 } |
| 227 |
| 228 case CSSPropertyBoxShadow: |
| 229 case CSSPropertyTextShadow: |
| 230 case CSSPropertyWebkitBoxShadow: { |
| 231 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty); |
| 232 if (interpolation) |
| 233 return interpolation.release(); |
| 234 |
| 235 // FIXME: AnimatableShadow incorrectly animates between inset and non-in
set values so it will never indicate it needs default interpolation |
| 236 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu
e, *toCSSValue)) |
| 237 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, p
roperty); |
| 238 |
| 239 // FIXME: Handle interpolation from/to none, unspecified color values |
219 fallBackToLegacy = true; | 240 fallBackToLegacy = true; |
| 241 |
220 break; | 242 break; |
221 case CSSPropertyPerspectiveOrigin: | 243 } |
222 case CSSPropertyTransformOrigin: | |
223 if (LengthPoint3DStyleInterpolation::canCreateFrom(*fromCSSValue) && Len
gthPoint3DStyleInterpolation::canCreateFrom(*toCSSValue)) | |
224 return LengthPoint3DStyleInterpolation::create(*fromCSSValue, *toCSS
Value, property); | |
225 | 244 |
226 // FIXME: Handle percentages and 2D origins. | |
227 fallBackToLegacy = true; | |
228 break; | |
229 case CSSPropertyWebkitMaskBoxImageSlice: | 245 case CSSPropertyWebkitMaskBoxImageSlice: |
230 if (LengthBoxStyleInterpolation::matchingFill(*toCSSValue, *fromCSSValue
) && LengthBoxStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInt
erpolation::canCreateFrom(*toCSSValue)) | 246 if (LengthBoxStyleInterpolation::matchingFill(*toCSSValue, *fromCSSValue
) && LengthBoxStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInt
erpolation::canCreateFrom(*toCSSValue)) |
231 return LengthBoxStyleInterpolation::createFromBorderImageSlice(*from
CSSValue, *toCSSValue, property); | 247 return LengthBoxStyleInterpolation::createFromBorderImageSlice(*from
CSSValue, *toCSSValue, property); |
| 248 break; |
232 | 249 |
233 break; | |
234 case CSSPropertyStrokeWidth: | 250 case CSSPropertyStrokeWidth: |
235 range = RangeNonNegative; | 251 range = RangeNonNegative; |
236 // Fall through | 252 // Fall through |
237 case CSSPropertyBaselineShift: | 253 case CSSPropertyBaselineShift: |
238 case CSSPropertyStrokeDashoffset: { | 254 case CSSPropertyStrokeDashoffset: { |
239 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGLengthStyleInterpol
ation::maybeCreate(*fromCSSValue, *toCSSValue, property, range); | 255 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGLengthStyleInterpol
ation::maybeCreate(*fromCSSValue, *toCSSValue, property, range); |
240 if (interpolation) | 256 if (interpolation) |
241 return interpolation.release(); | 257 return interpolation.release(); |
242 | 258 |
243 // We use default interpolation for | 259 // We use default interpolation for |
244 // baseline-shift keywords 'super', 'sub', and | 260 // baseline-shift keywords 'super', 'sub', and |
245 // from and to values with distinct units. | 261 // from and to values with distinct units. |
246 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope
rty); | 262 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope
rty); |
247 } | 263 } |
| 264 |
248 default: | 265 default: |
249 // Fall back to LegacyStyleInterpolation. | 266 // Fall back to LegacyStyleInterpolation. |
250 fallBackToLegacy = true; | 267 fallBackToLegacy = true; |
251 break; | 268 break; |
252 } | 269 } |
253 | 270 |
254 if (fromCSSValue->isUnsetValue() || fromCSSValue->isInheritedValue() || from
CSSValue->isInitialValue() | 271 if (fromCSSValue->isUnsetValue() || fromCSSValue->isInheritedValue() || from
CSSValue->isInitialValue() |
255 || toCSSValue->isUnsetValue() || toCSSValue->isInheritedValue() || toCSS
Value->isInitialValue()) | 272 || toCSSValue->isUnsetValue() || toCSSValue->isInheritedValue() || toCSS
Value->isInitialValue()) |
256 fallBackToLegacy = true; | 273 fallBackToLegacy = true; |
257 | 274 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 319 } |
303 | 320 |
304 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 321 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
305 { | 322 { |
306 visitor->trace(m_value); | 323 visitor->trace(m_value); |
307 visitor->trace(m_animatableValueCache); | 324 visitor->trace(m_animatableValueCache); |
308 Keyframe::PropertySpecificKeyframe::trace(visitor); | 325 Keyframe::PropertySpecificKeyframe::trace(visitor); |
309 } | 326 } |
310 | 327 |
311 } | 328 } |
OLD | NEW |