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/AngleSVGInterpolation.h" | 8 #include "core/animation/AngleSVGInterpolation.h" |
9 #include "core/animation/ColorStyleInterpolation.h" | 9 #include "core/animation/ColorStyleInterpolation.h" |
10 #include "core/animation/CompositorAnimations.h" | 10 #include "core/animation/CompositorAnimations.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu
e, Element* element, StyleSheetContents* styleSheetContents) | 52 void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu
e, Element* element, StyleSheetContents* styleSheetContents) |
53 { | 53 { |
54 ASSERT(property != CSSPropertyInvalid); | 54 ASSERT(property != CSSPropertyInvalid); |
55 if (CSSAnimations::isAllowedAnimation(property)) | 55 if (CSSAnimations::isAllowedAnimation(property)) |
56 m_propertySet->setProperty(property, value, false, styleSheetContents); | 56 m_propertySet->setProperty(property, value, false, styleSheetContents); |
57 } | 57 } |
58 | 58 |
59 void StringKeyframe::setPropertyValue(CSSPropertyID property, PassRefPtrWillBeRa
wPtr<CSSValue> value) | 59 void StringKeyframe::setPropertyValue(CSSPropertyID property, CSSValue value) |
60 { | 60 { |
61 ASSERT(property != CSSPropertyInvalid); | 61 ASSERT(property != CSSPropertyInvalid); |
62 ASSERT(CSSAnimations::isAllowedAnimation(property)); | 62 ASSERT(CSSAnimations::isAllowedAnimation(property)); |
63 m_propertySet->setProperty(property, value, false); | 63 m_propertySet->setProperty(property, value, false); |
64 } | 64 } |
65 | 65 |
66 void StringKeyframe::setPropertyValue(const QualifiedName& attributeName, const
String& value, Element* element) | 66 void StringKeyframe::setPropertyValue(const QualifiedName& attributeName, const
String& value, Element* element) |
67 { | 67 { |
68 ASSERT(element->isSVGElement()); | 68 ASSERT(element->isSVGElement()); |
69 m_svgPropertyMap.set(&attributeName, value); | 69 m_svgPropertyMap.set(&attributeName, value); |
(...skipping 26 matching lines...) Expand all Loading... |
96 ASSERT(property.isSVGAttribute()); | 96 ASSERT(property.isSVGAttribute()); |
97 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing(
), svgPropertyValue(*property.svgAttribute()), composite())); | 97 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing(
), svgPropertyValue(*property.svgAttribute()), composite())); |
98 } | 98 } |
99 | 99 |
100 DEFINE_TRACE(StringKeyframe) | 100 DEFINE_TRACE(StringKeyframe) |
101 { | 101 { |
102 visitor->trace(m_propertySet); | 102 visitor->trace(m_propertySet); |
103 Keyframe::trace(visitor); | 103 Keyframe::trace(visitor); |
104 } | 104 } |
105 | 105 |
106 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi
teOperation op) | 106 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value, EffectModel::
CompositeOperation op) |
107 : Keyframe::PropertySpecificKeyframe(offset, easing, op) | 107 : Keyframe::PropertySpecificKeyframe(offset, easing, op) |
108 , m_value(value) | 108 , m_value(value) |
109 { } | 109 { } |
110 | 110 |
111 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, CSSValue* value) | 111 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value) |
112 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) | 112 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) |
113 , m_value(value) | 113 , m_value(value) |
114 { | 114 { |
115 ASSERT(!isNull(m_offset)); | 115 ASSERT(!isNull(m_offset)); |
116 } | 116 } |
117 | 117 |
118 void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle) const | 118 void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle) const |
119 { | 119 { |
120 if (!m_animatableValueCache && (baseStyle || !m_value->isInheritedValue())) | 120 if (!m_animatableValueCache && (baseStyle || !m_value->isInheritedValue())) |
121 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(el
ement, baseStyle, property, m_value.get()); | 121 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(el
ement, baseStyle, property, m_value); |
122 } | 122 } |
123 | 123 |
124 namespace { | 124 namespace { |
125 InterpolationRange setRange(CSSPropertyID id) | 125 InterpolationRange setRange(CSSPropertyID id) |
126 { | 126 { |
127 switch (id) { | 127 switch (id) { |
128 case CSSPropertyOrphans: | 128 case CSSPropertyOrphans: |
129 case CSSPropertyWebkitColumnCount: | 129 case CSSPropertyWebkitColumnCount: |
130 case CSSPropertyWidows: | 130 case CSSPropertyWidows: |
131 return RangeRoundGreaterThanOrEqualToOne; | 131 return RangeRoundGreaterThanOrEqualToOne; |
(...skipping 18 matching lines...) Expand all Loading... |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 } // namespace | 153 } // namespace |
154 | 154 |
155 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const | 155 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const |
156 { | 156 { |
157 CSSPropertyID property = propertyHandle.cssProperty(); | 157 CSSPropertyID property = propertyHandle.cssProperty(); |
158 | 158 |
159 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. | 159 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. |
160 CSSValue* fromCSSValue = m_value.get(); | 160 NullableCSSValue nullableFromCSSValue = m_value; |
161 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); | 161 NullableCSSValue nullableToCSSValue = toCSSPropertySpecificKeyframe(end).val
ue(); |
162 InterpolationRange range = RangeAll; | 162 InterpolationRange range = RangeAll; |
163 bool fallBackToLegacy = false; | 163 bool fallBackToLegacy = false; |
164 | 164 |
165 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. | 165 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. |
166 bool forceDefaultInterpolation = false; | 166 bool forceDefaultInterpolation = false; |
167 | 167 |
168 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. | 168 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. |
169 if (!fromCSSValue || !toCSSValue) | 169 if (!nullableFromCSSValue || !nullableToCSSValue) |
170 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue
, property); | 170 return DeferredLegacyStyleInterpolation::create(nullableFromCSSValue, nu
llableToCSSValue, property); |
171 | 171 CSSValue& fromCSSValue = *nullableFromCSSValue; |
172 ASSERT(fromCSSValue && toCSSValue); | 172 CSSValue& toCSSValue = *nullableToCSSValue; |
173 | 173 |
174 if (!CSSPropertyMetadata::isAnimatableProperty(property)) { | 174 if (!CSSPropertyMetadata::isAnimatableProperty(property)) { |
175 if (fromCSSValue == toCSSValue) | 175 if (fromCSSValue.ptrEquals(toCSSValue)) |
176 return ConstantStyleInterpolation::create(fromCSSValue, property); | 176 return ConstantStyleInterpolation::create(fromCSSValue, property); |
177 | 177 |
178 return nullptr; | 178 return nullptr; |
179 } | 179 } |
180 | 180 |
181 // FIXME: Generate this giant switch statement. | 181 // FIXME: Generate this giant switch statement. |
182 switch (property) { | 182 switch (property) { |
183 case CSSPropertyLineHeight: | 183 case CSSPropertyLineHeight: |
184 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 184 if (LengthStyleInterpolation::canCreateFrom(fromCSSValue) && LengthStyle
Interpolation::canCreateFrom(toCSSValue)) |
185 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, RangeNonNegative); | 185 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, RangeNonNegative); |
186 | 186 |
187 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 187 if (DoubleStyleInterpolation::canCreateFrom(fromCSSValue) && DoubleStyle
Interpolation::canCreateFrom(toCSSValue)) |
188 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, CSSPrimitiveValue::CSS_NUMBER, RangeNonNegative); | 188 return DoubleStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, CSSPrimitiveValue::CSS_NUMBER, RangeNonNegative); |
189 | 189 |
190 break; | 190 break; |
191 case CSSPropertyBorderBottomWidth: | 191 case CSSPropertyBorderBottomWidth: |
192 case CSSPropertyBorderLeftWidth: | 192 case CSSPropertyBorderLeftWidth: |
193 case CSSPropertyBorderRightWidth: | 193 case CSSPropertyBorderRightWidth: |
194 case CSSPropertyBorderTopWidth: | 194 case CSSPropertyBorderTopWidth: |
195 case CSSPropertyFlexBasis: | 195 case CSSPropertyFlexBasis: |
196 case CSSPropertyFontSize: | 196 case CSSPropertyFontSize: |
197 case CSSPropertyHeight: | 197 case CSSPropertyHeight: |
198 case CSSPropertyMaxHeight: | 198 case CSSPropertyMaxHeight: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 case CSSPropertyVerticalAlign: | 235 case CSSPropertyVerticalAlign: |
236 case CSSPropertyWordSpacing: | 236 case CSSPropertyWordSpacing: |
237 case CSSPropertyWebkitColumnRuleWidth: | 237 case CSSPropertyWebkitColumnRuleWidth: |
238 case CSSPropertyWebkitPerspectiveOriginX: | 238 case CSSPropertyWebkitPerspectiveOriginX: |
239 case CSSPropertyWebkitPerspectiveOriginY: | 239 case CSSPropertyWebkitPerspectiveOriginY: |
240 case CSSPropertyWebkitTransformOriginX: | 240 case CSSPropertyWebkitTransformOriginX: |
241 case CSSPropertyWebkitTransformOriginY: | 241 case CSSPropertyWebkitTransformOriginY: |
242 case CSSPropertyWebkitTransformOriginZ: | 242 case CSSPropertyWebkitTransformOriginZ: |
243 case CSSPropertyX: | 243 case CSSPropertyX: |
244 case CSSPropertyY: | 244 case CSSPropertyY: |
245 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue, property) &&
LengthStyleInterpolation::canCreateFrom(*toCSSValue, property)) | 245 if (LengthStyleInterpolation::canCreateFrom(fromCSSValue, property) && L
engthStyleInterpolation::canCreateFrom(toCSSValue, property)) |
246 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, range); | 246 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, range); |
247 | 247 |
248 // FIXME: Handle keywords e.g. 'smaller', 'larger'. | 248 // FIXME: Handle keywords e.g. 'smaller', 'larger'. |
249 if (property == CSSPropertyFontSize) | 249 if (property == CSSPropertyFontSize) |
250 fallBackToLegacy = true; | 250 fallBackToLegacy = true; |
251 | 251 |
252 // FIXME: Handle keywords e.g. 'baseline', 'sub'. | 252 // FIXME: Handle keywords e.g. 'baseline', 'sub'. |
253 if (property == CSSPropertyBaselineShift) | 253 if (property == CSSPropertyBaselineShift) |
254 fallBackToLegacy = true; | 254 fallBackToLegacy = true; |
255 | 255 |
256 break; | 256 break; |
257 case CSSPropertyOrphans: | 257 case CSSPropertyOrphans: |
258 case CSSPropertyWidows: | 258 case CSSPropertyWidows: |
259 case CSSPropertyZIndex: | 259 case CSSPropertyZIndex: |
260 case CSSPropertyWebkitColumnCount: | 260 case CSSPropertyWebkitColumnCount: |
261 case CSSPropertyShapeImageThreshold: | 261 case CSSPropertyShapeImageThreshold: |
262 case CSSPropertyFillOpacity: | 262 case CSSPropertyFillOpacity: |
263 case CSSPropertyFloodOpacity: | 263 case CSSPropertyFloodOpacity: |
264 case CSSPropertyFontSizeAdjust: | 264 case CSSPropertyFontSizeAdjust: |
265 case CSSPropertyOpacity: | 265 case CSSPropertyOpacity: |
266 case CSSPropertyStopOpacity: | 266 case CSSPropertyStopOpacity: |
267 case CSSPropertyStrokeOpacity: | 267 case CSSPropertyStrokeOpacity: |
268 case CSSPropertyStrokeMiterlimit: | 268 case CSSPropertyStrokeMiterlimit: |
269 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 269 if (DoubleStyleInterpolation::canCreateFrom(fromCSSValue) && DoubleStyle
Interpolation::canCreateFrom(toCSSValue)) |
270 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property)
); | 270 return DoubleStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, toCSSPrimitiveValue(fromCSSValue).primitiveType(), setRange(property)); |
271 break; | 271 break; |
272 | 272 |
273 case CSSPropertyMotionRotation: { | 273 case CSSPropertyMotionRotation: { |
274 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati
on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); | 274 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati
on::maybeCreateFromMotionRotation(fromCSSValue, toCSSValue, property); |
275 if (interpolation) | 275 if (interpolation) |
276 return interpolation.release(); | 276 return interpolation.release(); |
277 break; | 277 break; |
278 } | 278 } |
279 case CSSPropertyVisibility: | 279 case CSSPropertyVisibility: |
280 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi
lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat
ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV
alue))) | 280 if (VisibilityStyleInterpolation::canCreateFrom(fromCSSValue) && Visibil
ityStyleInterpolation::canCreateFrom(toCSSValue) && (VisibilityStyleInterpolatio
n::isVisible(fromCSSValue) || VisibilityStyleInterpolation::isVisible(toCSSValue
))) |
281 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal
ue, property); | 281 return VisibilityStyleInterpolation::create(fromCSSValue, toCSSValue
, property); |
282 | 282 |
283 break; | 283 break; |
284 | 284 |
285 case CSSPropertyBackgroundColor: | 285 case CSSPropertyBackgroundColor: |
286 case CSSPropertyBorderBottomColor: | 286 case CSSPropertyBorderBottomColor: |
287 case CSSPropertyBorderLeftColor: | 287 case CSSPropertyBorderLeftColor: |
288 case CSSPropertyBorderRightColor: | 288 case CSSPropertyBorderRightColor: |
289 case CSSPropertyBorderTopColor: | 289 case CSSPropertyBorderTopColor: |
290 case CSSPropertyColor: | 290 case CSSPropertyColor: |
291 case CSSPropertyFill: | 291 case CSSPropertyFill: |
292 case CSSPropertyFloodColor: | 292 case CSSPropertyFloodColor: |
293 case CSSPropertyLightingColor: | 293 case CSSPropertyLightingColor: |
294 case CSSPropertyOutlineColor: | 294 case CSSPropertyOutlineColor: |
295 case CSSPropertyStopColor: | 295 case CSSPropertyStopColor: |
296 case CSSPropertyStroke: | 296 case CSSPropertyStroke: |
297 case CSSPropertyTextDecorationColor: | 297 case CSSPropertyTextDecorationColor: |
298 case CSSPropertyWebkitColumnRuleColor: | 298 case CSSPropertyWebkitColumnRuleColor: |
299 case CSSPropertyWebkitTextStrokeColor: | 299 case CSSPropertyWebkitTextStrokeColor: |
300 { | 300 { |
301 RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpol
ation::maybeCreateFromColor(*fromCSSValue, *toCSSValue, property); | 301 RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpol
ation::maybeCreateFromColor(fromCSSValue, toCSSValue, property); |
302 if (interpolation) | 302 if (interpolation) |
303 return interpolation.release(); | 303 return interpolation.release(); |
304 | 304 |
305 // Current color should use LegacyStyleInterpolation | 305 // Current color should use LegacyStyleInterpolation |
306 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*from
CSSValue, *toCSSValue)) | 306 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(fromC
SSValue, toCSSValue)) |
307 fallBackToLegacy = true; | 307 fallBackToLegacy = true; |
308 | 308 |
309 break; | 309 break; |
310 } | 310 } |
311 | 311 |
312 case CSSPropertyBorderImageSource: | 312 case CSSPropertyBorderImageSource: |
313 case CSSPropertyListStyleImage: | 313 case CSSPropertyListStyleImage: |
314 case CSSPropertyWebkitMaskBoxImageSource: | 314 case CSSPropertyWebkitMaskBoxImageSource: |
315 if (fromCSSValue == toCSSValue) | 315 if (fromCSSValue.ptrEquals(toCSSValue)) |
316 return ConstantStyleInterpolation::create(fromCSSValue, property); | 316 return ConstantStyleInterpolation::create(fromCSSValue, property); |
317 | 317 |
318 if (ImageStyleInterpolation::canCreateFrom(*fromCSSValue) && ImageStyleI
nterpolation::canCreateFrom(*toCSSValue)) | 318 if (ImageStyleInterpolation::canCreateFrom(fromCSSValue) && ImageStyleIn
terpolation::canCreateFrom(toCSSValue)) |
319 return ImageStyleInterpolation::create(*fromCSSValue, *toCSSValue, p
roperty); | 319 return ImageStyleInterpolation::create(fromCSSValue, toCSSValue, pro
perty); |
320 | 320 |
321 forceDefaultInterpolation = true; | 321 forceDefaultInterpolation = true; |
322 break; | 322 break; |
323 case CSSPropertyBorderBottomLeftRadius: | 323 case CSSPropertyBorderBottomLeftRadius: |
324 case CSSPropertyBorderBottomRightRadius: | 324 case CSSPropertyBorderBottomRightRadius: |
325 case CSSPropertyBorderTopLeftRadius: | 325 case CSSPropertyBorderTopLeftRadius: |
326 case CSSPropertyBorderTopRightRadius: | 326 case CSSPropertyBorderTopRightRadius: |
327 range = RangeNonNegative; | 327 range = RangeNonNegative; |
328 // Fall through | 328 // Fall through |
329 case CSSPropertyObjectPosition: | 329 case CSSPropertyObjectPosition: |
330 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length
PairStyleInterpolation::canCreateFrom(*toCSSValue)) | 330 if (LengthPairStyleInterpolation::canCreateFrom(fromCSSValue) && LengthP
airStyleInterpolation::canCreateFrom(toCSSValue)) |
331 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal
ue, property, range); | 331 return LengthPairStyleInterpolation::create(fromCSSValue, toCSSValue
, property, range); |
332 break; | 332 break; |
333 | 333 |
334 case CSSPropertyPerspectiveOrigin: | 334 case CSSPropertyPerspectiveOrigin: |
335 case CSSPropertyTransformOrigin: { | 335 case CSSPropertyTransformOrigin: { |
336 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty, range); | 336 if (fromCSSValue.isValueList() && toCSSValue.isValueList()) { |
337 if (interpolation) | 337 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpola
tion<LengthStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue)
, toCSSValueList(toCSSValue), property, range); |
338 return interpolation.release(); | 338 if (interpolation) |
| 339 return interpolation.release(); |
| 340 } |
339 | 341 |
340 // FIXME: Handle keywords: top, right, left, center, bottom | 342 // FIXME: Handle keywords: top, right, left, center, bottom |
341 fallBackToLegacy = true; | 343 fallBackToLegacy = true; |
342 | 344 |
343 break; | 345 break; |
344 } | 346 } |
345 | 347 |
346 case CSSPropertyBoxShadow: | 348 case CSSPropertyBoxShadow: |
347 case CSSPropertyTextShadow: { | 349 case CSSPropertyTextShadow: { |
348 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty); | 350 if (fromCSSValue.isValueList() && toCSSValue.isValueList()) { |
349 if (interpolation) | 351 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpola
tion<ShadowStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue)
, toCSSValueList(toCSSValue), property); |
350 return interpolation.release(); | 352 if (interpolation) |
| 353 return interpolation.release(); |
| 354 } |
351 | 355 |
352 // FIXME: AnimatableShadow incorrectly animates between inset and non-in
set values so it will never indicate it needs default interpolation | 356 // FIXME: AnimatableShadow incorrectly animates between inset and non-in
set values so it will never indicate it needs default interpolation |
353 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu
e, *toCSSValue)) { | 357 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(fromCSSValue
, toCSSValue)) { |
354 forceDefaultInterpolation = true; | 358 forceDefaultInterpolation = true; |
355 break; | 359 break; |
356 } | 360 } |
357 | 361 |
358 // FIXME: Handle interpolation from/to none, unspecified color values | 362 // FIXME: Handle interpolation from/to none, unspecified color values |
359 fallBackToLegacy = true; | 363 fallBackToLegacy = true; |
360 | 364 |
361 break; | 365 break; |
362 | 366 |
363 } | 367 } |
364 | 368 |
365 case CSSPropertyClip: { | 369 case CSSPropertyClip: { |
366 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue,
*toCSSValue)) { | 370 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(fromCSSValue,
toCSSValue)) { |
367 forceDefaultInterpolation = true; | 371 forceDefaultInterpolation = true; |
368 break; | 372 break; |
369 } | 373 } |
370 RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpol
ation::maybeCreateFrom(*fromCSSValue, *toCSSValue, property); | 374 RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpol
ation::maybeCreateFrom(fromCSSValue, toCSSValue, property); |
371 if (interpolation) | 375 if (interpolation) |
372 return interpolation.release(); | 376 return interpolation.release(); |
373 break; | 377 break; |
374 } | 378 } |
375 | 379 |
376 case CSSPropertyBorderImageSlice: | 380 case CSSPropertyBorderImageSlice: |
377 case CSSPropertyWebkitMaskBoxImageSlice: { | 381 case CSSPropertyWebkitMaskBoxImageSlice: { |
378 RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpo
lation::maybeCreate(*fromCSSValue, *toCSSValue, property); | 382 RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpo
lation::maybeCreate(fromCSSValue, toCSSValue, property); |
379 if (interpolation) | 383 if (interpolation) |
380 return interpolation.release(); | 384 return interpolation.release(); |
381 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue
, *toCSSValue)) | 385 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(fromCSSValue,
toCSSValue)) |
382 forceDefaultInterpolation = true; | 386 forceDefaultInterpolation = true; |
383 | 387 |
384 break; | 388 break; |
385 } | 389 } |
386 | 390 |
387 case CSSPropertyStrokeDasharray: { | 391 case CSSPropertyStrokeDasharray: { |
388 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyl
eInterpolation::maybeCreate(*fromCSSValue, *toCSSValue, property); | 392 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyl
eInterpolation::maybeCreate(fromCSSValue, toCSSValue, property); |
389 if (interpolation) | 393 if (interpolation) |
390 return interpolation.release(); | 394 return interpolation.release(); |
391 | 395 |
392 break; | 396 break; |
393 } | 397 } |
394 | 398 |
395 case CSSPropertyWebkitFilter: { | 399 case CSSPropertyWebkitFilter: { |
396 RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolati
on::maybeCreateList(*fromCSSValue, *toCSSValue, property); | 400 RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolati
on::maybeCreateList(fromCSSValue, toCSSValue, property); |
397 if (interpolation) | 401 if (interpolation) |
398 return interpolation.release(); | 402 return interpolation.release(); |
399 | 403 |
400 // FIXME: Support drop shadow interpolation. | 404 // FIXME: Support drop shadow interpolation. |
401 fallBackToLegacy = true; | 405 fallBackToLegacy = true; |
402 break; | 406 break; |
403 } | 407 } |
404 | 408 |
405 default: | 409 default: |
406 // Fall back to LegacyStyleInterpolation. | 410 // Fall back to LegacyStyleInterpolation. |
407 fallBackToLegacy = true; | 411 fallBackToLegacy = true; |
408 break; | 412 break; |
409 } | 413 } |
410 | 414 |
411 if (fromCSSValue == toCSSValue) | 415 if (fromCSSValue.ptrEquals(toCSSValue)) |
412 return ConstantStyleInterpolation::create(fromCSSValue, property); | 416 return ConstantStyleInterpolation::create(fromCSSValue, property); |
413 | 417 |
414 if (forceDefaultInterpolation) | 418 if (forceDefaultInterpolation) |
415 return nullptr; | 419 return nullptr; |
416 | 420 |
417 if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword()) | 421 if (fromCSSValue.isCSSWideKeyword() || toCSSValue.isCSSWideKeyword()) |
418 fallBackToLegacy = true; | 422 fallBackToLegacy = true; |
419 | 423 |
420 if (fallBackToLegacy) { | 424 if (fallBackToLegacy) { |
421 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(
*fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleRe
solve(*toCSSValue)) { | 425 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(
fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleRes
olve(toCSSValue)) { |
422 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpola
tion. | 426 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpola
tion. |
423 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSV
alue, property); | 427 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSV
alue, property); |
424 } | 428 } |
425 | 429 |
426 // FIXME: Remove the use of AnimatableValues and Elements here. | 430 // FIXME: Remove the use of AnimatableValues and Elements here. |
427 ASSERT(element); | 431 ASSERT(element); |
428 populateAnimatableValue(property, *element, baseStyle); | 432 populateAnimatableValue(property, *element, baseStyle); |
429 end.populateAnimatableValue(property, *element, baseStyle); | 433 end.populateAnimatableValue(property, *element, baseStyle); |
430 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAni
matableValue(), property); | 434 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAni
matableValue(), property); |
431 } | 435 } |
432 | 436 |
433 ASSERT(AnimatableValue::usesDefaultInterpolation( | 437 ASSERT(AnimatableValue::usesDefaultInterpolation( |
434 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, fromCSSValue).get(), | 438 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, fromCSSValue).get(), |
435 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, toCSSValue).get())); | 439 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, toCSSValue).get())); |
436 | 440 |
437 return nullptr; | 441 return nullptr; |
438 | 442 |
439 } | 443 } |
440 | 444 |
441 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction
> easing) const | 445 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction
> easing) const |
442 { | 446 { |
443 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, st
atic_cast<CSSValue*>(0), EffectModel::CompositeAdd)); | 447 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, nu
llptr, EffectModel::CompositeAdd)); |
444 } | 448 } |
445 | 449 |
446 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::cloneWithOffset(double offset) const | 450 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::cloneWithOffset(double offset) const |
447 { | 451 { |
448 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra
me(offset, m_easing, m_value.get()); | 452 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra
me(offset, m_easing, m_value); |
449 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab
leValueCache; | 453 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab
leValueCache; |
450 return adoptPtrWillBeNoop(theClone); | 454 return adoptPtrWillBeNoop(theClone); |
451 } | 455 } |
452 | 456 |
453 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe) | 457 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe) |
454 { | 458 { |
455 visitor->trace(m_value); | 459 visitor->trace(m_value); |
456 visitor->trace(m_animatableValueCache); | 460 visitor->trace(m_animatableValueCache); |
457 Keyframe::PropertySpecificKeyframe::trace(visitor); | 461 Keyframe::PropertySpecificKeyframe::trace(visitor); |
458 } | 462 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 553 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
550 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 554 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
551 | 555 |
552 if (!fromValue || !toValue) | 556 if (!fromValue || !toValue) |
553 return nullptr; | 557 return nullptr; |
554 | 558 |
555 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 559 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
556 } | 560 } |
557 | 561 |
558 } // namespace blink | 562 } // namespace blink |
OLD | NEW |