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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.get()); |
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 CSSPropertyColumnCount: |
130 case CSSPropertyWidows: | 130 case CSSPropertyWidows: |
131 return RangeRoundGreaterThanOrEqualToOne; | 131 return RangeRoundGreaterThanOrEqualToOne; |
132 case CSSPropertyWebkitColumnRuleWidth: | 132 case CSSPropertyColumnRuleWidth: |
133 case CSSPropertyZIndex: | 133 case CSSPropertyZIndex: |
134 return RangeRound; | 134 return RangeRound; |
135 case CSSPropertyFloodOpacity: | 135 case CSSPropertyFloodOpacity: |
136 case CSSPropertyStopOpacity: | 136 case CSSPropertyStopOpacity: |
137 case CSSPropertyStrokeOpacity: | 137 case CSSPropertyStrokeOpacity: |
138 case CSSPropertyShapeImageThreshold: | 138 case CSSPropertyShapeImageThreshold: |
139 return RangeZeroToOne; | 139 return RangeZeroToOne; |
140 case CSSPropertyFillOpacity: | 140 case CSSPropertyFillOpacity: |
141 case CSSPropertyOpacity: | 141 case CSSPropertyOpacity: |
142 return RangeOpacityFIXME; | 142 return RangeOpacityFIXME; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 case CSSPropertyPaddingRight: | 205 case CSSPropertyPaddingRight: |
206 case CSSPropertyPaddingTop: | 206 case CSSPropertyPaddingTop: |
207 case CSSPropertyPerspective: | 207 case CSSPropertyPerspective: |
208 case CSSPropertyR: | 208 case CSSPropertyR: |
209 case CSSPropertyRx: | 209 case CSSPropertyRx: |
210 case CSSPropertyRy: | 210 case CSSPropertyRy: |
211 case CSSPropertyShapeMargin: | 211 case CSSPropertyShapeMargin: |
212 case CSSPropertyStrokeWidth: | 212 case CSSPropertyStrokeWidth: |
213 case CSSPropertyWebkitBorderHorizontalSpacing: | 213 case CSSPropertyWebkitBorderHorizontalSpacing: |
214 case CSSPropertyWebkitBorderVerticalSpacing: | 214 case CSSPropertyWebkitBorderVerticalSpacing: |
215 case CSSPropertyWebkitColumnGap: | 215 case CSSPropertyColumnGap: |
216 case CSSPropertyWebkitColumnWidth: | 216 case CSSPropertyColumnWidth: |
217 case CSSPropertyWidth: | 217 case CSSPropertyWidth: |
218 range = RangeNonNegative; | 218 range = RangeNonNegative; |
219 // Fall through | 219 // Fall through |
220 case CSSPropertyBaselineShift: | 220 case CSSPropertyBaselineShift: |
221 case CSSPropertyBottom: | 221 case CSSPropertyBottom: |
222 case CSSPropertyCx: | 222 case CSSPropertyCx: |
223 case CSSPropertyCy: | 223 case CSSPropertyCy: |
224 case CSSPropertyLeft: | 224 case CSSPropertyLeft: |
225 case CSSPropertyLetterSpacing: | 225 case CSSPropertyLetterSpacing: |
226 case CSSPropertyMarginBottom: | 226 case CSSPropertyMarginBottom: |
227 case CSSPropertyMarginLeft: | 227 case CSSPropertyMarginLeft: |
228 case CSSPropertyMarginRight: | 228 case CSSPropertyMarginRight: |
229 case CSSPropertyMarginTop: | 229 case CSSPropertyMarginTop: |
230 case CSSPropertyMotionOffset: | 230 case CSSPropertyMotionOffset: |
231 case CSSPropertyOutlineOffset: | 231 case CSSPropertyOutlineOffset: |
232 case CSSPropertyRight: | 232 case CSSPropertyRight: |
233 case CSSPropertyStrokeDashoffset: | 233 case CSSPropertyStrokeDashoffset: |
234 case CSSPropertyTop: | 234 case CSSPropertyTop: |
235 case CSSPropertyVerticalAlign: | 235 case CSSPropertyVerticalAlign: |
236 case CSSPropertyWordSpacing: | 236 case CSSPropertyWordSpacing: |
237 case CSSPropertyWebkitColumnRuleWidth: | 237 case CSSPropertyColumnRuleWidth: |
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) &&
LengthStyleInterpolation::canCreateFrom(*toCSSValue, property)) |
246 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, range); | 246 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, 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 CSSPropertyColumnCount: |
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) && DoubleStyl
eInterpolation::canCreateFrom(*toCSSValue)) |
270 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property)
); | 270 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property)
); |
(...skipping 17 matching lines...) Expand all Loading... |
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 CSSPropertyColumnRuleColor: |
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(*from
CSSValue, *toCSSValue)) |
307 fallBackToLegacy = true; | 307 fallBackToLegacy = true; |
308 | 308 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 549 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
550 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 550 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
551 | 551 |
552 if (!fromValue || !toValue) | 552 if (!fromValue || !toValue) |
553 return nullptr; | 553 return nullptr; |
554 | 554 |
555 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 555 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
556 } | 556 } |
557 | 557 |
558 } // namespace blink | 558 } // namespace blink |
OLD | NEW |