| 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/XLinkNames.h" |
| 8 #include "core/animation/AngleSVGInterpolation.h" | 9 #include "core/animation/AngleSVGInterpolation.h" |
| 9 #include "core/animation/CSSColorInterpolationType.h" | 10 #include "core/animation/CSSColorInterpolationType.h" |
| 10 #include "core/animation/CSSImageInterpolationType.h" | 11 #include "core/animation/CSSImageInterpolationType.h" |
| 11 #include "core/animation/CSSImageListInterpolationType.h" | 12 #include "core/animation/CSSImageListInterpolationType.h" |
| 12 #include "core/animation/CSSLengthInterpolationType.h" | 13 #include "core/animation/CSSLengthInterpolationType.h" |
| 13 #include "core/animation/CSSNumberInterpolationType.h" | 14 #include "core/animation/CSSNumberInterpolationType.h" |
| 14 #include "core/animation/CSSPaintInterpolationType.h" | 15 #include "core/animation/CSSPaintInterpolationType.h" |
| 15 #include "core/animation/CSSShadowListInterpolationType.h" | 16 #include "core/animation/CSSShadowListInterpolationType.h" |
| 16 #include "core/animation/CSSValueInterpolationType.h" | 17 #include "core/animation/CSSValueInterpolationType.h" |
| 17 #include "core/animation/CompositorAnimations.h" | 18 #include "core/animation/CompositorAnimations.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 #include "core/animation/LengthSVGInterpolation.h" | 32 #include "core/animation/LengthSVGInterpolation.h" |
| 32 #include "core/animation/LengthStyleInterpolation.h" | 33 #include "core/animation/LengthStyleInterpolation.h" |
| 33 #include "core/animation/ListSVGInterpolation.h" | 34 #include "core/animation/ListSVGInterpolation.h" |
| 34 #include "core/animation/ListStyleInterpolation.h" | 35 #include "core/animation/ListStyleInterpolation.h" |
| 35 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" | 36 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" |
| 36 #include "core/animation/NumberSVGInterpolation.h" | 37 #include "core/animation/NumberSVGInterpolation.h" |
| 37 #include "core/animation/PathSVGInterpolation.h" | 38 #include "core/animation/PathSVGInterpolation.h" |
| 38 #include "core/animation/PointSVGInterpolation.h" | 39 #include "core/animation/PointSVGInterpolation.h" |
| 39 #include "core/animation/RectSVGInterpolation.h" | 40 #include "core/animation/RectSVGInterpolation.h" |
| 40 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" | 41 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
| 42 #include "core/animation/SVGValueInterpolationType.h" |
| 41 #include "core/animation/TransformSVGInterpolation.h" | 43 #include "core/animation/TransformSVGInterpolation.h" |
| 42 #include "core/animation/VisibilityStyleInterpolation.h" | 44 #include "core/animation/VisibilityStyleInterpolation.h" |
| 43 #include "core/animation/css/CSSAnimations.h" | 45 #include "core/animation/css/CSSAnimations.h" |
| 44 #include "core/css/CSSPropertyMetadata.h" | 46 #include "core/css/CSSPropertyMetadata.h" |
| 45 #include "core/css/resolver/StyleResolver.h" | 47 #include "core/css/resolver/StyleResolver.h" |
| 46 #include "core/style/ComputedStyle.h" | 48 #include "core/style/ComputedStyle.h" |
| 47 #include "core/svg/SVGElement.h" | 49 #include "core/svg/SVGElement.h" |
| 48 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
| 49 | 51 |
| 50 namespace blink { | 52 namespace blink { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (!baseStyle && (!m_value || DeferredLegacyStyleInterpolation::interpolati
onRequiresStyleResolve(*m_value))) | 125 if (!baseStyle && (!m_value || DeferredLegacyStyleInterpolation::interpolati
onRequiresStyleResolve(*m_value))) |
| 124 return false; | 126 return false; |
| 125 if (!element.document().frame()) | 127 if (!element.document().frame()) |
| 126 return false; | 128 return false; |
| 127 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen
t, baseStyle, property, m_value.get()); | 129 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen
t, baseStyle, property, m_value.get()); |
| 128 return true; | 130 return true; |
| 129 } | 131 } |
| 130 | 132 |
| 131 namespace { | 133 namespace { |
| 132 | 134 |
| 133 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID
property) | 135 // TODO(alancutter): Move this into its own file. |
| 136 const Vector<const InterpolationType*>* applicableTypesForProperty(PropertyHandl
e property) |
| 134 { | 137 { |
| 135 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo
lationType*>*>; | 138 // TODO(alancutter): Initialise this entire HashMap once instead of initiali
sing each property individually. |
| 139 using ApplicableTypesMap = HashMap<PropertyHandle, const Vector<const Interp
olationType*>*>; |
| 136 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); | 140 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); |
| 137 auto entry = applicableTypesMap.find(property); | 141 auto entry = applicableTypesMap.find(property); |
| 138 if (entry != applicableTypesMap.end()) | 142 if (entry != applicableTypesMap.end()) |
| 139 return entry->value; | 143 return entry->value; |
| 140 | 144 |
| 145 bool fallbackToLegacy = false; |
| 141 auto applicableTypes = new Vector<const InterpolationType*>(); | 146 auto applicableTypes = new Vector<const InterpolationType*>(); |
| 142 switch (property) { | 147 |
| 143 case CSSPropertyBaselineShift: | 148 if (property.isCSSProperty()) { |
| 144 case CSSPropertyBorderBottomWidth: | 149 CSSPropertyID cssProperty = property.cssProperty(); |
| 145 case CSSPropertyBorderLeftWidth: | 150 switch (cssProperty) { |
| 146 case CSSPropertyBorderRightWidth: | 151 case CSSPropertyBaselineShift: |
| 147 case CSSPropertyBorderTopWidth: | 152 case CSSPropertyBorderBottomWidth: |
| 148 case CSSPropertyBottom: | 153 case CSSPropertyBorderLeftWidth: |
| 149 case CSSPropertyCx: | 154 case CSSPropertyBorderRightWidth: |
| 150 case CSSPropertyCy: | 155 case CSSPropertyBorderTopWidth: |
| 151 case CSSPropertyFlexBasis: | 156 case CSSPropertyBottom: |
| 152 case CSSPropertyHeight: | 157 case CSSPropertyCx: |
| 153 case CSSPropertyLeft: | 158 case CSSPropertyCy: |
| 154 case CSSPropertyLetterSpacing: | 159 case CSSPropertyFlexBasis: |
| 155 case CSSPropertyMarginBottom: | 160 case CSSPropertyHeight: |
| 156 case CSSPropertyMarginLeft: | 161 case CSSPropertyLeft: |
| 157 case CSSPropertyMarginRight: | 162 case CSSPropertyLetterSpacing: |
| 158 case CSSPropertyMarginTop: | 163 case CSSPropertyMarginBottom: |
| 159 case CSSPropertyMaxHeight: | 164 case CSSPropertyMarginLeft: |
| 160 case CSSPropertyMaxWidth: | 165 case CSSPropertyMarginRight: |
| 161 case CSSPropertyMinHeight: | 166 case CSSPropertyMarginTop: |
| 162 case CSSPropertyMinWidth: | 167 case CSSPropertyMaxHeight: |
| 163 case CSSPropertyMotionOffset: | 168 case CSSPropertyMaxWidth: |
| 164 case CSSPropertyOutlineOffset: | 169 case CSSPropertyMinHeight: |
| 165 case CSSPropertyOutlineWidth: | 170 case CSSPropertyMinWidth: |
| 166 case CSSPropertyPaddingBottom: | 171 case CSSPropertyMotionOffset: |
| 167 case CSSPropertyPaddingLeft: | 172 case CSSPropertyOutlineOffset: |
| 168 case CSSPropertyPaddingRight: | 173 case CSSPropertyOutlineWidth: |
| 169 case CSSPropertyPaddingTop: | 174 case CSSPropertyPaddingBottom: |
| 170 case CSSPropertyPerspective: | 175 case CSSPropertyPaddingLeft: |
| 171 case CSSPropertyR: | 176 case CSSPropertyPaddingRight: |
| 172 case CSSPropertyRight: | 177 case CSSPropertyPaddingTop: |
| 173 case CSSPropertyRx: | 178 case CSSPropertyPerspective: |
| 174 case CSSPropertyRy: | 179 case CSSPropertyR: |
| 175 case CSSPropertyShapeMargin: | 180 case CSSPropertyRight: |
| 176 case CSSPropertyStrokeDashoffset: | 181 case CSSPropertyRx: |
| 177 case CSSPropertyStrokeWidth: | 182 case CSSPropertyRy: |
| 178 case CSSPropertyTop: | 183 case CSSPropertyShapeMargin: |
| 179 case CSSPropertyVerticalAlign: | 184 case CSSPropertyStrokeDashoffset: |
| 180 case CSSPropertyWebkitBorderHorizontalSpacing: | 185 case CSSPropertyStrokeWidth: |
| 181 case CSSPropertyWebkitBorderVerticalSpacing: | 186 case CSSPropertyTop: |
| 182 case CSSPropertyWebkitColumnGap: | 187 case CSSPropertyVerticalAlign: |
| 183 case CSSPropertyWebkitColumnRuleWidth: | 188 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 184 case CSSPropertyWebkitColumnWidth: | 189 case CSSPropertyWebkitBorderVerticalSpacing: |
| 185 case CSSPropertyWebkitPerspectiveOriginX: | 190 case CSSPropertyWebkitColumnGap: |
| 186 case CSSPropertyWebkitPerspectiveOriginY: | 191 case CSSPropertyWebkitColumnRuleWidth: |
| 187 case CSSPropertyWebkitTransformOriginX: | 192 case CSSPropertyWebkitColumnWidth: |
| 188 case CSSPropertyWebkitTransformOriginY: | 193 case CSSPropertyWebkitPerspectiveOriginX: |
| 189 case CSSPropertyWebkitTransformOriginZ: | 194 case CSSPropertyWebkitPerspectiveOriginY: |
| 190 case CSSPropertyWidth: | 195 case CSSPropertyWebkitTransformOriginX: |
| 191 case CSSPropertyWordSpacing: | 196 case CSSPropertyWebkitTransformOriginY: |
| 192 case CSSPropertyX: | 197 case CSSPropertyWebkitTransformOriginZ: |
| 193 case CSSPropertyY: | 198 case CSSPropertyWidth: |
| 194 applicableTypes->append(new CSSLengthInterpolationType(property)); | 199 case CSSPropertyWordSpacing: |
| 195 break; | 200 case CSSPropertyX: |
| 196 case CSSPropertyFlexGrow: | 201 case CSSPropertyY: |
| 197 case CSSPropertyFlexShrink: | 202 applicableTypes->append(new CSSLengthInterpolationType(cssProperty))
; |
| 198 case CSSPropertyFillOpacity: | 203 break; |
| 199 case CSSPropertyFloodOpacity: | 204 case CSSPropertyFlexGrow: |
| 200 case CSSPropertyFontSizeAdjust: | 205 case CSSPropertyFlexShrink: |
| 201 case CSSPropertyOpacity: | 206 case CSSPropertyFillOpacity: |
| 202 case CSSPropertyOrphans: | 207 case CSSPropertyFloodOpacity: |
| 203 case CSSPropertyShapeImageThreshold: | 208 case CSSPropertyFontSizeAdjust: |
| 204 case CSSPropertyStopOpacity: | 209 case CSSPropertyOpacity: |
| 205 case CSSPropertyStrokeMiterlimit: | 210 case CSSPropertyOrphans: |
| 206 case CSSPropertyStrokeOpacity: | 211 case CSSPropertyShapeImageThreshold: |
| 207 case CSSPropertyWebkitColumnCount: | 212 case CSSPropertyStopOpacity: |
| 208 case CSSPropertyWidows: | 213 case CSSPropertyStrokeMiterlimit: |
| 209 case CSSPropertyZIndex: | 214 case CSSPropertyStrokeOpacity: |
| 210 applicableTypes->append(new CSSNumberInterpolationType(property)); | 215 case CSSPropertyWebkitColumnCount: |
| 211 break; | 216 case CSSPropertyWidows: |
| 212 case CSSPropertyLineHeight: | 217 case CSSPropertyZIndex: |
| 213 applicableTypes->append(new CSSLengthInterpolationType(property)); | 218 applicableTypes->append(new CSSNumberInterpolationType(cssProperty))
; |
| 214 applicableTypes->append(new CSSNumberInterpolationType(property)); | 219 break; |
| 215 break; | 220 case CSSPropertyLineHeight: |
| 216 case CSSPropertyBackgroundColor: | 221 applicableTypes->append(new CSSLengthInterpolationType(cssProperty))
; |
| 217 case CSSPropertyBorderBottomColor: | 222 applicableTypes->append(new CSSNumberInterpolationType(cssProperty))
; |
| 218 case CSSPropertyBorderLeftColor: | 223 break; |
| 219 case CSSPropertyBorderRightColor: | 224 case CSSPropertyBackgroundColor: |
| 220 case CSSPropertyBorderTopColor: | 225 case CSSPropertyBorderBottomColor: |
| 221 case CSSPropertyColor: | 226 case CSSPropertyBorderLeftColor: |
| 222 case CSSPropertyFloodColor: | 227 case CSSPropertyBorderRightColor: |
| 223 case CSSPropertyLightingColor: | 228 case CSSPropertyBorderTopColor: |
| 224 case CSSPropertyOutlineColor: | 229 case CSSPropertyColor: |
| 225 case CSSPropertyStopColor: | 230 case CSSPropertyFloodColor: |
| 226 case CSSPropertyTextDecorationColor: | 231 case CSSPropertyLightingColor: |
| 227 case CSSPropertyWebkitColumnRuleColor: | 232 case CSSPropertyOutlineColor: |
| 228 case CSSPropertyWebkitTextStrokeColor: | 233 case CSSPropertyStopColor: |
| 229 applicableTypes->append(new CSSColorInterpolationType(property)); | 234 case CSSPropertyTextDecorationColor: |
| 230 break; | 235 case CSSPropertyWebkitColumnRuleColor: |
| 231 case CSSPropertyFill: | 236 case CSSPropertyWebkitTextStrokeColor: |
| 232 case CSSPropertyStroke: | 237 applicableTypes->append(new CSSColorInterpolationType(cssProperty)); |
| 233 applicableTypes->append(new CSSPaintInterpolationType(property)); | 238 break; |
| 234 break; | 239 case CSSPropertyFill: |
| 235 case CSSPropertyBoxShadow: | 240 case CSSPropertyStroke: |
| 236 case CSSPropertyTextShadow: | 241 applicableTypes->append(new CSSPaintInterpolationType(cssProperty)); |
| 237 applicableTypes->append(new CSSShadowListInterpolationType(property)); | 242 break; |
| 238 break; | 243 case CSSPropertyBoxShadow: |
| 239 case CSSPropertyBorderImageSource: | 244 case CSSPropertyTextShadow: |
| 240 case CSSPropertyListStyleImage: | 245 applicableTypes->append(new CSSShadowListInterpolationType(cssProper
ty)); |
| 241 case CSSPropertyWebkitMaskBoxImageSource: | 246 break; |
| 242 applicableTypes->append(new CSSImageInterpolationType(property)); | 247 case CSSPropertyBorderImageSource: |
| 243 break; | 248 case CSSPropertyListStyleImage: |
| 244 case CSSPropertyBackgroundImage: | 249 case CSSPropertyWebkitMaskBoxImageSource: |
| 245 case CSSPropertyWebkitMaskImage: | 250 applicableTypes->append(new CSSImageInterpolationType(cssProperty)); |
| 246 applicableTypes->append(new CSSImageListInterpolationType(property)); | 251 break; |
| 247 break; | 252 case CSSPropertyBackgroundImage: |
| 248 default: | 253 case CSSPropertyWebkitMaskImage: |
| 249 // TODO(alancutter): Support all interpolable CSS properties here so we
can stop falling back to the old StyleInterpolation implementation. | 254 applicableTypes->append(new CSSImageListInterpolationType(cssPropert
y)); |
| 250 if (CSSPropertyMetadata::isInterpolableProperty(property)) { | 255 break; |
| 251 delete applicableTypes; | 256 default: |
| 252 applicableTypesMap.add(property, nullptr); | 257 // TODO(alancutter): Support all interpolable CSS properties here so
we can stop falling back to the old StyleInterpolation implementation. |
| 253 return nullptr; | 258 if (CSSPropertyMetadata::isInterpolableProperty(cssProperty)) |
| 259 fallbackToLegacy = true; |
| 260 break; |
| 254 } | 261 } |
| 255 break; | 262 applicableTypes->append(new CSSValueInterpolationType(cssProperty)); |
| 263 } else { |
| 264 const QualifiedName& attribute = property.svgAttribute(); |
| 265 if (attribute == HTMLNames::classAttr |
| 266 || attribute == SVGNames::clipPathUnitsAttr |
| 267 || attribute == SVGNames::edgeModeAttr |
| 268 || attribute == SVGNames::filterUnitsAttr |
| 269 || attribute == SVGNames::gradientUnitsAttr |
| 270 || attribute == SVGNames::inAttr |
| 271 || attribute == SVGNames::in2Attr |
| 272 || attribute == SVGNames::lengthAdjustAttr |
| 273 || attribute == SVGNames::markerUnitsAttr |
| 274 || attribute == SVGNames::maskContentUnitsAttr |
| 275 || attribute == SVGNames::maskUnitsAttr |
| 276 || attribute == SVGNames::methodAttr |
| 277 || attribute == SVGNames::modeAttr |
| 278 || attribute == SVGNames::operatorAttr |
| 279 || attribute == SVGNames::patternContentUnitsAttr |
| 280 || attribute == SVGNames::patternUnitsAttr |
| 281 || attribute == SVGNames::preserveAlphaAttr |
| 282 || attribute == SVGNames::preserveAspectRatioAttr |
| 283 || attribute == SVGNames::primitiveUnitsAttr |
| 284 || attribute == SVGNames::resultAttr |
| 285 || attribute == SVGNames::spacingAttr |
| 286 || attribute == SVGNames::spreadMethodAttr |
| 287 || attribute == SVGNames::stitchTilesAttr |
| 288 || attribute == SVGNames::targetAttr |
| 289 || attribute == SVGNames::typeAttr |
| 290 || attribute == SVGNames::xChannelSelectorAttr |
| 291 || attribute == SVGNames::yChannelSelectorAttr |
| 292 || attribute == XLinkNames::hrefAttr) { |
| 293 applicableTypes->append(new SVGValueInterpolationType(attribute)); |
| 294 } else { |
| 295 fallbackToLegacy = true; |
| 296 } |
| 256 } | 297 } |
| 257 applicableTypes->append(new CSSValueInterpolationType(property)); | 298 |
| 299 if (fallbackToLegacy) { |
| 300 delete applicableTypes; |
| 301 applicableTypesMap.add(property, nullptr); |
| 302 return nullptr; |
| 303 } |
| 304 |
| 258 applicableTypesMap.add(property, applicableTypes); | 305 applicableTypesMap.add(property, applicableTypes); |
| 259 return applicableTypes; | 306 return applicableTypes; |
| 260 } | 307 } |
| 261 | 308 |
| 262 } // namespace | 309 } // namespace |
| 263 | 310 |
| 264 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::createLeg
acyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe
& end, Element* element, const ComputedStyle* baseStyle) const | 311 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::createLeg
acyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe
& end, Element* element, const ComputedStyle* baseStyle) const |
| 265 { | 312 { |
| 266 CSSValue& fromCSSValue = *m_value.get(); | 313 CSSValue& fromCSSValue = *m_value.get(); |
| 267 CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value(); | 314 CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value(); |
| 268 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(from
CSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve
(toCSSValue)) { | 315 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(from
CSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve
(toCSSValue)) { |
| 269 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation
. | 316 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation
. |
| 270 return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSVal
ue, property); | 317 return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSVal
ue, property); |
| 271 } | 318 } |
| 272 | 319 |
| 273 // FIXME: Remove the use of AnimatableValues and Elements here. | 320 // FIXME: Remove the use of AnimatableValues and Elements here. |
| 274 ASSERT(element); | 321 ASSERT(element); |
| 275 populateAnimatableValue(property, *element, baseStyle, false); | 322 populateAnimatableValue(property, *element, baseStyle, false); |
| 276 end.populateAnimatableValue(property, *element, baseStyle, false); | 323 end.populateAnimatableValue(property, *element, baseStyle, false); |
| 277 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimata
bleValue(), property); | 324 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimata
bleValue(), property); |
| 278 } | 325 } |
| 279 | 326 |
| 280 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea
teInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyfram
e& end, Element* element, const ComputedStyle* baseStyle) const | 327 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea
teInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyfram
e& end, Element* element, const ComputedStyle* baseStyle) const |
| 281 { | 328 { |
| 282 CSSPropertyID property = propertyHandle.cssProperty(); | 329 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor
Property(propertyHandle); |
| 283 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor
Property(property); | |
| 284 if (applicableTypes) | 330 if (applicableTypes) |
| 285 return InvalidatableInterpolation::create(*applicableTypes, *this, end); | 331 return InvalidatableInterpolation::create(*applicableTypes, *this, end); |
| 286 | 332 |
| 287 // TODO(alancutter): Remove the remainder of this function. | 333 // TODO(alancutter): Remove the remainder of this function. |
| 288 | 334 |
| 289 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. | 335 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. |
| 336 CSSPropertyID property = propertyHandle.cssProperty(); |
| 290 CSSValue* fromCSSValue = m_value.get(); | 337 CSSValue* fromCSSValue = m_value.get(); |
| 291 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); | 338 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); |
| 292 InterpolationRange range = RangeAll; | 339 InterpolationRange range = RangeAll; |
| 293 | 340 |
| 294 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. | 341 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. |
| 295 bool forceDefaultInterpolation = false; | 342 bool forceDefaultInterpolation = false; |
| 296 | 343 |
| 297 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. | 344 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. |
| 298 if (!fromCSSValue || !toCSSValue) | 345 if (!fromCSSValue || !toCSSValue) |
| 299 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue
, property); | 346 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue
, property); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 if (interpolation) | 567 if (interpolation) |
| 521 return interpolation.release(); | 568 return interpolation.release(); |
| 522 | 569 |
| 523 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); | 570 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); |
| 524 } | 571 } |
| 525 | 572 |
| 526 } // namespace | 573 } // namespace |
| 527 | 574 |
| 528 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation(
PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*
element, const ComputedStyle* baseStyle) const | 575 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation(
PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*
element, const ComputedStyle* baseStyle) const |
| 529 { | 576 { |
| 577 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor
Property(propertyHandle); |
| 578 if (applicableTypes) |
| 579 return InvalidatableInterpolation::create(*applicableTypes, *this, end); |
| 580 |
| 530 ASSERT(element); | 581 ASSERT(element); |
| 531 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element
)->propertyFromAttribute(propertyHandle.svgAttribute()); | 582 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element
)->propertyFromAttribute(propertyHandle.svgAttribute()); |
| 532 ASSERT(attribute); | 583 ASSERT(attribute); |
| 533 | 584 |
| 534 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 585 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
| 535 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 586 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 536 | 587 |
| 537 if (!fromValue || !toValue) | 588 if (!fromValue || !toValue) |
| 538 return nullptr; | 589 return nullptr; |
| 539 | 590 |
| 540 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 591 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
| 541 } | 592 } |
| 542 | 593 |
| 543 } // namespace blink | 594 } // namespace blink |
| OLD | NEW |