Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Side by Side Diff: Source/core/animation/StringKeyframe.cpp

Issue 851633002: Animation: Add template for ListStyleInterpolation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Correct rounding in Interpolation LayoutTests and remove WillBeHeapVector Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ShadowStyleInterpolation.h"
19 #include "core/animation/VisibilityStyleInterpolation.h" 20 #include "core/animation/VisibilityStyleInterpolation.h"
20 #include "core/animation/css/CSSAnimations.h" 21 #include "core/animation/css/CSSAnimations.h"
21 #include "core/css/CSSPropertyMetadata.h" 22 #include "core/css/CSSPropertyMetadata.h"
22 #include "core/css/resolver/StyleResolver.h" 23 #include "core/css/resolver/StyleResolver.h"
23 #include "core/rendering/style/RenderStyle.h" 24 #include "core/rendering/style/RenderStyle.h"
24 25
25 namespace blink { 26 namespace blink {
26 27
27 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) 28 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom)
28 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) 29 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 break; 207 break;
207 case CSSPropertyBorderBottomLeftRadius: 208 case CSSPropertyBorderBottomLeftRadius:
208 case CSSPropertyBorderBottomRightRadius: 209 case CSSPropertyBorderBottomRightRadius:
209 case CSSPropertyBorderTopLeftRadius: 210 case CSSPropertyBorderTopLeftRadius:
210 case CSSPropertyBorderTopRightRadius: 211 case CSSPropertyBorderTopRightRadius:
211 range = RangeNonNegative; 212 range = RangeNonNegative;
212 // Fall through 213 // Fall through
213 case CSSPropertyObjectPosition: 214 case CSSPropertyObjectPosition:
214 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length PairStyleInterpolation::canCreateFrom(*toCSSValue)) 215 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length PairStyleInterpolation::canCreateFrom(*toCSSValue))
215 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property, range); 216 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property, range);
217 break;
216 218
217 // FIXME: Handle CSSValueLists. 219 case CSSPropertyPerspectiveOrigin:
220 case CSSPropertyTransformOrigin: {
221 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty, range);
222 if (interpolation)
223 return interpolation.release();
224 break;
225 }
226
227 case CSSPropertyBoxShadow:
228 case CSSPropertyTextShadow:
229 case CSSPropertyWebkitBoxShadow: {
230 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty);
231 if (interpolation)
232 return interpolation.release();
233
234 // Interpolation between inset and non-inset ShadowValues should fall ba ck to DefaultStyleInterpolation
235 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu e, *toCSSValue))
dstockwell 2015/02/02 06:10:12 This seems like the inverse of the legacy check? C
dstockwell 2015/02/02 06:10:12 This seems like the inverse of the legacy check? C
236 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, p roperty);
dstockwell 2015/02/02 06:10:12 Doesn't `break;` fall through to default style int
shans 2015/02/02 23:49:11 AnimatableShadow incorrectly animates between inse
evemj (not active) 2015/02/03 00:25:56 Done.
dstockwell 2015/02/03 02:22:18 Hmm, interesting, I see the spec has changed here,
237
238 // FIXME: Handle interpolation from/to none
218 fallBackToLegacy = true; 239 fallBackToLegacy = true;
240
219 break; 241 break;
220 case CSSPropertyPerspectiveOrigin: 242 }
221 case CSSPropertyTransformOrigin:
222 if (LengthPoint3DStyleInterpolation::canCreateFrom(*fromCSSValue) && Len gthPoint3DStyleInterpolation::canCreateFrom(*toCSSValue))
223 return LengthPoint3DStyleInterpolation::create(*fromCSSValue, *toCSS Value, property);
224 243
225 // FIXME: Handle percentages and 2D origins.
226 fallBackToLegacy = true;
227 break;
228 case CSSPropertyWebkitMaskBoxImageSlice: 244 case CSSPropertyWebkitMaskBoxImageSlice:
229 if (LengthBoxStyleInterpolation::matchingFill(*toCSSValue, *fromCSSValue ) && LengthBoxStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInt erpolation::canCreateFrom(*toCSSValue)) 245 if (LengthBoxStyleInterpolation::matchingFill(*toCSSValue, *fromCSSValue ) && LengthBoxStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInt erpolation::canCreateFrom(*toCSSValue))
230 return LengthBoxStyleInterpolation::createFromBorderImageSlice(*from CSSValue, *toCSSValue, property); 246 return LengthBoxStyleInterpolation::createFromBorderImageSlice(*from CSSValue, *toCSSValue, property);
247 break;
231 248
232 break;
233 default: 249 default:
234 // Fall back to LegacyStyleInterpolation. 250 // Fall back to LegacyStyleInterpolation.
235 fallBackToLegacy = true; 251 fallBackToLegacy = true;
236 break; 252 break;
237 } 253 }
238 254
239 if (fromCSSValue->isUnsetValue() || fromCSSValue->isInheritedValue() || from CSSValue->isInitialValue() 255 if (fromCSSValue->isUnsetValue() || fromCSSValue->isInheritedValue() || from CSSValue->isInitialValue()
240 || toCSSValue->isUnsetValue() || toCSSValue->isInheritedValue() || toCSS Value->isInitialValue()) 256 || toCSSValue->isUnsetValue() || toCSSValue->isInheritedValue() || toCSS Value->isInitialValue())
241 fallBackToLegacy = true; 257 fallBackToLegacy = true;
242 258
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 303 }
288 304
289 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) 305 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor)
290 { 306 {
291 visitor->trace(m_value); 307 visitor->trace(m_value);
292 visitor->trace(m_animatableValueCache); 308 visitor->trace(m_animatableValueCache);
293 Keyframe::PropertySpecificKeyframe::trace(visitor); 309 Keyframe::PropertySpecificKeyframe::trace(visitor);
294 } 310 }
295 311
296 } 312 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698